From a3d18cca4a42a6290d582c2ea2b7bb50189a65ac Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 16 Jul 2022 11:09:36 -0400 Subject: [PATCH 01/73] fix: require python 3.7+ (#177) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(python): drop python 3.6 Source-Link: https://github.com/googleapis/synthtool/commit/4f89b13af10d086458f9b379e56a614f9d6dab7b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c * add api_description to .repo-metadata.json * require python 3.7+ in setup.py * remove python 3.6 sample configs * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix typo * fix typo * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 4 +- .github/workflows/unittest.yml | 2 +- .kokoro/samples/python3.6/common.cfg | 40 --------- .kokoro/samples/python3.6/continuous.cfg | 7 -- .kokoro/samples/python3.6/periodic-head.cfg | 11 --- .kokoro/samples/python3.6/periodic.cfg | 6 -- .kokoro/samples/python3.6/presubmit.cfg | 6 -- .kokoro/test-samples-impl.sh | 4 +- .repo-metadata.json | 5 +- CONTRIBUTING.rst | 6 +- README.rst | 45 +++++++--- noxfile.py | 85 ++++++++++++------- .../templates/install_deps.tmpl.rst | 2 +- setup.py | 3 +- 14 files changed, 99 insertions(+), 127 deletions(-) delete mode 100644 .kokoro/samples/python3.6/common.cfg delete mode 100644 .kokoro/samples/python3.6/continuous.cfg delete mode 100644 .kokoro/samples/python3.6/periodic-head.cfg delete mode 100644 .kokoro/samples/python3.6/periodic.cfg delete mode 100644 .kokoro/samples/python3.6/presubmit.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 50b29ff..1ce6085 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97 -# created: 2022-06-12T16:09:31.61859086Z + digest: sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c +# created: 2022-07-05T18:31:20.838186805Z diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e5be6ed..5531b01 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python: ['3.7', '3.8', '3.9', '3.10'] steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg deleted file mode 100644 index 32d117a..0000000 --- a/.kokoro/samples/python3.6/common.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "py-3.6" -} - -# Declare build specific Cloud project. -env_vars: { - key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests-py36" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/continuous.cfg b/.kokoro/samples/python3.6/continuous.cfg deleted file mode 100644 index 7218af1..0000000 --- a/.kokoro/samples/python3.6/continuous.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} - diff --git a/.kokoro/samples/python3.6/periodic-head.cfg b/.kokoro/samples/python3.6/periodic-head.cfg deleted file mode 100644 index 302c7b0..0000000 --- a/.kokoro/samples/python3.6/periodic-head.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# 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-appengine-admin/.kokoro/test-samples-against-head.sh" -} diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.6/periodic.cfg deleted file mode 100644 index 71cd1e5..0000000 --- a/.kokoro/samples/python3.6/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} diff --git a/.kokoro/samples/python3.6/presubmit.cfg b/.kokoro/samples/python3.6/presubmit.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.6/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh index 8a324c9..2c6500c 100755 --- a/.kokoro/test-samples-impl.sh +++ b/.kokoro/test-samples-impl.sh @@ -33,7 +33,7 @@ export PYTHONUNBUFFERED=1 env | grep KOKORO # Install nox -python3.6 -m pip install --upgrade --quiet nox +python3.9 -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 @@ -76,7 +76,7 @@ for file in samples/**/requirements.txt; do echo "------------------------------------------------------------" # Use nox to execute the tests for the project. - python3.6 -m nox -s "$RUN_TESTS_SESSION" + python3.9 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? # If this is a periodic build, send the test log to the FlakyBot. diff --git a/.repo-metadata.json b/.repo-metadata.json index b3acb0a..a492776 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,6 +1,6 @@ { "name": "appengine", - "name_pretty": "App Engine Admin API", + "name_pretty": "App Engine Admin", "product_documentation": "https://cloud.google.com/appengine/docs/admin-api/", "client_documentation": "https://cloud.google.com/python/docs/reference/appengine/latest", "issue_tracker": "", @@ -12,5 +12,6 @@ "api_id": "appengine.googleapis.com", "default_version": "v1", "codeowner_team": "@googleapis/aap-dpes", - "api_shortname": "appengine" + "api_shortname": "appengine", + "api_description": "allows you to manage your App Engine applications." } diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0799fc5..f449f7f 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.6, 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows. + 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -221,13 +221,11 @@ Supported Python Versions We support: -- `Python 3.6`_ - `Python 3.7`_ - `Python 3.8`_ - `Python 3.9`_ - `Python 3.10`_ -.. _Python 3.6: https://docs.python.org/3.6/ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ .. _Python 3.9: https://docs.python.org/3.9/ @@ -239,7 +237,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/python-appengine-admin/blob/main/noxfile.py -We also explicitly decided to support Python 3 beginning with version 3.6. +We also explicitly decided to support Python 3 beginning with version 3.7. Reasons for this include: - Encouraging use of newest versions of Python 3 diff --git a/README.rst b/README.rst index 692ff64..09be495 100644 --- a/README.rst +++ b/README.rst @@ -1,20 +1,20 @@ -Python Client for App Engine Admin -================================== +Python Client for App Engine Admin API +====================================== -|GA| |pypi| |versions| +|stable| |pypi| |versions| -`App Engine Admin`_ allows you to manage your App Engine applications. +`App Engine Admin API`_: allows you to manage your App Engine applications. - `Client Library Documentation`_ - `Product Documentation`_ -.. |GA| image:: https://img.shields.io/badge/support-ga-gold.svg - :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability +.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg + :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-appengine-admin.svg :target: https://pypi.org/project/google-cloud-appengine-admin/ .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-appengine-admin.svg :target: https://pypi.org/project/google-cloud-appengine-admin/ -.. _App Engine Admin: https://cloud.google.com/appengine/docs/admin-api/ +.. _App Engine Admin API: https://cloud.google.com/appengine/docs/admin-api/ .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/appengine/latest .. _Product Documentation: https://cloud.google.com/appengine/docs/admin-api/ @@ -25,12 +25,12 @@ In order to use this library, you first need to go through the following steps: 1. `Select or create a Cloud Platform project.`_ 2. `Enable billing for your project.`_ -3. `Enable the App Engine Admin.`_ +3. `Enable the App Engine Admin API.`_ 4. `Setup Authentication.`_ .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Enable the App Engine Admin.: https://cloud.google.com/appengine/docs/admin-api/ +.. _Enable the App Engine Admin API.: https://cloud.google.com/appengine/docs/admin-api/ .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html Installation @@ -47,6 +47,27 @@ dependencies. .. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ +Code samples and snippets +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Code samples and snippets live in the `samples/` folder. + + +Supported Python Versions +^^^^^^^^^^^^^^^^^^^^^^^^^ +Our client libraries are compatible with all current [active](https://devguide.python.org/devcycle/#in-development-main-branch) and [maintenance](https://devguide.python.org/devcycle/#maintenance-branches) versions of +Python. + +Python >= 3.7 + +Unsupported Python Versions +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Python <= 3.6 + +If you are using an [end-of-life](https://devguide.python.org/devcycle/#end-of-life-branches) +version of Python, we recommend that you update as soon as possible to an actively supported version. + + Mac/Linux ^^^^^^^^^ @@ -71,12 +92,12 @@ Windows Next Steps ~~~~~~~~~~ -- Read the `Client Library Documentation`_ for App Engine Admin +- Read the `Client Library Documentation`_ for App Engine Admin API to see other available methods on the client. -- Read the `App Engine Admin Product documentation`_ to learn +- Read the `App Engine Admin API Product documentation`_ to learn more about the product and see How-to Guides. - View this `README`_ to see the full list of Cloud APIs that we cover. -.. _App Engine Admin Product documentation: https://cloud.google.com/appengine/docs/admin-api/ +.. _App Engine Admin API Product documentation: https://cloud.google.com/appengine/docs/admin-api/ .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst diff --git a/noxfile.py b/noxfile.py index fe3a1fe..001ec73 100644 --- a/noxfile.py +++ b/noxfile.py @@ -31,7 +31,7 @@ DEFAULT_PYTHON_VERSION = "3.8" -UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", "asyncmock", @@ -331,28 +331,15 @@ def docfx(session): def prerelease_deps(session): """Run all tests with prerelease versions of dependencies installed.""" - prerel_deps = [ - "protobuf", - "googleapis-common-protos", - "google-auth", - "grpcio", - "grpcio-status", - "google-api-core", - "proto-plus", - # dependencies of google-auth - "cryptography", - "pyasn1", - ] - - for dep in prerel_deps: - session.install("--pre", "--no-deps", "--upgrade", dep) - - # Remaining dependencies - other_deps = ["requests"] - session.install(*other_deps) - + # Install all dependencies + session.install("-e", ".[all, tests, tracing]") session.install(*UNIT_TEST_STANDARD_DEPENDENCIES) - session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES) + system_deps_all = ( + SYSTEM_TEST_STANDARD_DEPENDENCIES + + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + + SYSTEM_TEST_EXTRAS + ) + session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a @@ -366,19 +353,44 @@ def prerelease_deps(session): constraints_text = constraints_file.read() # Ignore leading whitespace and comment lines. - deps = [ + constraints_deps = [ match.group(1) for match in re.finditer( r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE ) ] - # Don't overwrite prerelease packages. - deps = [dep for dep in deps if dep not in prerel_deps] - # We use --no-deps to ensure that pre-release versions aren't overwritten - # by the version ranges in setup.py. - session.install(*deps) - session.install("--no-deps", "-e", ".[all]") + session.install(*constraints_deps) + + if os.path.exists("samples/snippets/requirements.txt"): + session.install("-r", "samples/snippets/requirements.txt") + + if os.path.exists("samples/snippets/requirements-test.txt"): + session.install("-r", "samples/snippets/requirements-test.txt") + + prerel_deps = [ + "protobuf", + # dependency of grpc + "six", + "googleapis-common-protos", + "grpcio", + "grpcio-status", + "google-api-core", + "proto-plus", + "google-cloud-testutils", + # dependencies of google-cloud-testutils" + "click", + ] + + for dep in prerel_deps: + session.install("--pre", "--no-deps", "--upgrade", dep) + + # Remaining dependencies + other_deps = [ + "requests", + "google-auth", + ] + session.install(*other_deps) # Print out prerelease package versions session.run( @@ -387,5 +399,16 @@ def prerelease_deps(session): session.run("python", "-c", "import grpc; print(grpc.__version__)") session.run("py.test", "tests/unit") - session.run("py.test", "tests/system") - session.run("py.test", "samples/snippets") + + system_test_path = os.path.join("tests", "system.py") + system_test_folder_path = os.path.join("tests", "system") + + # Only run system tests if found. + if os.path.exists(system_test_path) or os.path.exists(system_test_folder_path): + session.run("py.test", "tests/system") + + snippets_test_path = os.path.join("samples", "snippets") + + # Only run samples tests if found. + if os.path.exists(snippets_test_path): + session.run("py.test", "samples/snippets") diff --git a/scripts/readme-gen/templates/install_deps.tmpl.rst b/scripts/readme-gen/templates/install_deps.tmpl.rst index 275d649..6f069c6 100644 --- a/scripts/readme-gen/templates/install_deps.tmpl.rst +++ b/scripts/readme-gen/templates/install_deps.tmpl.rst @@ -12,7 +12,7 @@ Install Dependencies .. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup -#. Create a virtualenv. Samples are compatible with Python 3.6+. +#. Create a virtualenv. Samples are compatible with Python 3.7+. .. code-block:: bash diff --git a/setup.py b/setup.py index 16e2282..35d7cdb 100644 --- a/setup.py +++ b/setup.py @@ -58,12 +58,11 @@ platforms="Posix; MacOS X; Windows", include_package_data=True, install_requires=dependencies, - python_requires=">=3.6", + python_requires=">=3.7", classifiers=[ release_status, "Intended Audience :: Developers", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", From 4c025831c1d8273f8ce451604cc20b6359b2b373 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 16 Jul 2022 14:28:32 -0400 Subject: [PATCH 02/73] chore(python): allow client documentation to be customized in README (#179) Source-Link: https://github.com/googleapis/synthtool/commit/95d9289ac3dc1ca2edae06619c82fe7a24d555f1 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c8878270182edaab99f2927969d4f700c3af265accd472c3425deedff2b7fd93 Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 4 ++-- README.rst | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 1ce6085..58fcbee 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c -# created: 2022-07-05T18:31:20.838186805Z + digest: sha256:c8878270182edaab99f2927969d4f700c3af265accd472c3425deedff2b7fd93 +# created: 2022-07-14T01:58:16.015625351Z diff --git a/README.rst b/README.rst index 09be495..37da229 100644 --- a/README.rst +++ b/README.rst @@ -55,18 +55,22 @@ Code samples and snippets live in the `samples/` folder. Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ -Our client libraries are compatible with all current [active](https://devguide.python.org/devcycle/#in-development-main-branch) and [maintenance](https://devguide.python.org/devcycle/#maintenance-branches) versions of +Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of Python. Python >= 3.7 +.. _active: https://devguide.python.org/devcycle/#in-development-main-branch +.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches + Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Python <= 3.6 -If you are using an [end-of-life](https://devguide.python.org/devcycle/#end-of-life-branches) +If you are using an `end-of-life`_ version of Python, we recommend that you update as soon as possible to an actively supported version. +.. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches Mac/Linux ^^^^^^^^^ From 307bdf56fccbb04229dd4fae1ae6d425e2c51bcc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 18 Jul 2022 13:24:11 +0000 Subject: [PATCH 03/73] fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#175) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 459095142 Source-Link: https://github.com/googleapis/googleapis/commit/4f1be992601ed740a581a32cedc4e7b6c6a27793 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ae686d9cde4fc3e36d0ac02efb8643b15890c1ed Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: https://github.com/googleapis/googleapis/commit/23f1a157189581734c7a77cddfeb7c5bc1e440ae Source-Link: https://github.com/googleapis/googleapis-gen/commit/4075a8514f676691ec156688a5bbf183aa9893ce Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9 --- .../services/applications/client.py | 1 + .../services/applications/transports/base.py | 16 ++++-- .../services/applications/transports/grpc.py | 2 + .../applications/transports/grpc_asyncio.py | 2 + .../authorized_certificates/client.py | 1 + .../transports/base.py | 16 ++++-- .../transports/grpc.py | 2 + .../transports/grpc_asyncio.py | 2 + .../services/authorized_domains/client.py | 1 + .../authorized_domains/transports/base.py | 16 ++++-- .../authorized_domains/transports/grpc.py | 2 + .../transports/grpc_asyncio.py | 2 + .../services/domain_mappings/client.py | 1 + .../domain_mappings/transports/base.py | 16 ++++-- .../domain_mappings/transports/grpc.py | 2 + .../transports/grpc_asyncio.py | 2 + .../services/firewall/client.py | 1 + .../services/firewall/transports/base.py | 16 ++++-- .../services/firewall/transports/grpc.py | 2 + .../firewall/transports/grpc_asyncio.py | 2 + .../services/instances/client.py | 1 + .../services/instances/transports/base.py | 16 ++++-- .../services/instances/transports/grpc.py | 2 + .../instances/transports/grpc_asyncio.py | 2 + .../services/services/client.py | 1 + .../services/services/transports/base.py | 16 ++++-- .../services/services/transports/grpc.py | 2 + .../services/transports/grpc_asyncio.py | 2 + .../services/versions/client.py | 1 + .../services/versions/transports/base.py | 16 ++++-- .../services/versions/transports/grpc.py | 2 + .../versions/transports/grpc_asyncio.py | 2 + setup.py | 5 +- testing/constraints-3.6.txt | 11 ---- testing/constraints-3.7.txt | 2 +- .../appengine_admin_v1/test_applications.py | 52 +++++++++++++++++++ .../test_authorized_certificates.py | 52 +++++++++++++++++++ .../test_authorized_domains.py | 52 +++++++++++++++++++ .../test_domain_mappings.py | 52 +++++++++++++++++++ .../gapic/appengine_admin_v1/test_firewall.py | 52 +++++++++++++++++++ .../appengine_admin_v1/test_instances.py | 52 +++++++++++++++++++ .../gapic/appengine_admin_v1/test_services.py | 52 +++++++++++++++++++ .../gapic/appengine_admin_v1/test_versions.py | 52 +++++++++++++++++++ 43 files changed, 546 insertions(+), 56 deletions(-) delete mode 100644 testing/constraints-3.6.txt diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 59b9cd8..0790314 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -404,6 +404,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def get_application( diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/base.py b/google/cloud/appengine_admin_v1/services/applications/transports/base.py index 646f4b5..099d857 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -88,11 +89,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -113,6 +109,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -125,6 +126,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py index 53f5dbe..29f6f96 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -157,6 +158,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py index a4315b9..2b3d91f 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -202,6 +203,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index 4ad2d1e..02c3597 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -407,6 +407,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_authorized_certificates( diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py index 5a69af8..efdba67 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py @@ -60,6 +60,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -87,11 +88,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -112,6 +108,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -124,6 +125,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py index 7601960..4d9d7c8 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py @@ -62,6 +62,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -157,6 +158,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py index 2e16bdc..ddd61b9 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py @@ -107,6 +107,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -202,6 +203,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index 23e7bbe..5478ac4 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -406,6 +406,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_authorized_domains( diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py index a1ba556..db83423 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py @@ -58,6 +58,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -85,11 +86,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -110,6 +106,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -122,6 +123,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py index d240b77..c8959d7 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py @@ -60,6 +60,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -155,6 +156,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py index 56763fe..16207f5 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py @@ -105,6 +105,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -200,6 +201,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index 74d81ae..cca07c4 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -407,6 +407,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_domain_mappings( diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py index 8732532..25d9be8 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -88,11 +89,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -113,6 +109,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -125,6 +126,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py index 368a4ed..01492e9 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -157,6 +158,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py index 7749c25..ca7c706 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -202,6 +203,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index f9a4604..d241d18 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -412,6 +412,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_ingress_rules( diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py index 1a5df11..4e4bbb7 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -60,6 +60,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -87,11 +88,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -112,6 +108,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -124,6 +125,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py index 259d8ab..cdf8c0c 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -70,6 +70,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -165,6 +166,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py index ff660d4..a49184d 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py @@ -115,6 +115,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -210,6 +211,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 0cfc8bb..8a8d3f5 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -430,6 +430,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_instances( diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/base.py b/google/cloud/appengine_admin_v1/services/instances/transports/base.py index 05142c4..1b81edd 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -88,11 +89,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -113,6 +109,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -125,6 +126,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py index 65243b6..ebdf3e0 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -157,6 +158,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py index aae1f75..2289fea 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -202,6 +203,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index fc289ad..603a883 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -406,6 +406,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_services( diff --git a/google/cloud/appengine_admin_v1/services/services/transports/base.py b/google/cloud/appengine_admin_v1/services/services/transports/base.py index 5d763b4..872bfb8 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -88,11 +89,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -113,6 +109,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -125,6 +126,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py index 31bd346..2f3fc04 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -157,6 +158,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py index 4f3d79c..0858cb6 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -202,6 +203,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 297e033..356b458 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -409,6 +409,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_versions( diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/base.py b/google/cloud/appengine_admin_v1/services/versions/transports/base.py index 1ccc203..f8ddd2c 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -88,11 +89,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -113,6 +109,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -125,6 +126,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py index 2b94752..8d3657e 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -157,6 +158,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py index d187eca..d91e4a7 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -202,6 +203,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/setup.py b/setup.py index 35d7cdb..126e4ff 100644 --- a/setup.py +++ b/setup.py @@ -25,10 +25,7 @@ release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" dependencies = [ - # NOTE: Maintainers, please do not require google-api-core>=2.x.x - # Until this issue is closed - # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", + "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.18.1, <2.0.0dev", "protobuf >= 3.19.0, <4.0.0dev", "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt deleted file mode 100644 index 85fd9f0..0000000 --- a/testing/constraints-3.6.txt +++ /dev/null @@ -1,11 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List *all* library dependencies and extras in this file. -# Pin the version to the lower bound. -# -# 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.31.5 -proto-plus==1.18.1 -grpc-google-iam-v1==0.12.4 -protobuf==3.19.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 85fd9f0..a25839e 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -5,7 +5,7 @@ # # 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.31.5 +google-api-core==1.32.0 proto-plus==1.18.1 grpc-google-iam-v1==0.12.4 protobuf==3.19.0 diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index dcd6dfb..a6dcefe 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -229,6 +229,7 @@ def test_applications_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -246,6 +247,7 @@ def test_applications_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -263,6 +265,7 @@ def test_applications_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -292,6 +295,25 @@ def test_applications_client_client_options( quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -357,6 +379,7 @@ def test_applications_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -391,6 +414,7 @@ def test_applications_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -413,6 +437,7 @@ def test_applications_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -523,6 +548,7 @@ def test_applications_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -561,6 +587,7 @@ def test_applications_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -579,6 +606,7 @@ def test_applications_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -617,6 +645,7 @@ def test_applications_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -1564,6 +1593,28 @@ def test_applications_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ApplicationsGrpcTransport, + transports.ApplicationsGrpcAsyncIOTransport, + ], +) +def test_applications_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -2033,4 +2084,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index b19deae..907de24 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -240,6 +240,7 @@ def test_authorized_certificates_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -257,6 +258,7 @@ def test_authorized_certificates_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -274,6 +276,7 @@ def test_authorized_certificates_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -303,6 +306,25 @@ def test_authorized_certificates_client_client_options( quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -380,6 +402,7 @@ def test_authorized_certificates_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -414,6 +437,7 @@ def test_authorized_certificates_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -436,6 +460,7 @@ def test_authorized_certificates_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -554,6 +579,7 @@ def test_authorized_certificates_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -592,6 +618,7 @@ def test_authorized_certificates_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -612,6 +639,7 @@ def test_authorized_certificates_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -650,6 +678,7 @@ def test_authorized_certificates_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -1971,6 +2000,28 @@ def test_authorized_certificates_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.AuthorizedCertificatesGrpcTransport, + transports.AuthorizedCertificatesGrpcAsyncIOTransport, + ], +) +def test_authorized_certificates_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -2424,4 +2475,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index 6a618f6..45354e1 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -234,6 +234,7 @@ def test_authorized_domains_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -251,6 +252,7 @@ def test_authorized_domains_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -268,6 +270,7 @@ def test_authorized_domains_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -297,6 +300,25 @@ def test_authorized_domains_client_client_options( quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -374,6 +396,7 @@ def test_authorized_domains_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -408,6 +431,7 @@ def test_authorized_domains_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -430,6 +454,7 @@ def test_authorized_domains_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -544,6 +569,7 @@ def test_authorized_domains_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -582,6 +608,7 @@ def test_authorized_domains_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -602,6 +629,7 @@ def test_authorized_domains_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -640,6 +668,7 @@ def test_authorized_domains_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -1260,6 +1289,28 @@ def test_authorized_domains_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.AuthorizedDomainsGrpcTransport, + transports.AuthorizedDomainsGrpcAsyncIOTransport, + ], +) +def test_authorized_domains_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -1709,4 +1760,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index 76999df..d5a8e70 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -236,6 +236,7 @@ def test_domain_mappings_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -253,6 +254,7 @@ def test_domain_mappings_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -270,6 +272,7 @@ def test_domain_mappings_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -299,6 +302,25 @@ def test_domain_mappings_client_client_options( quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -366,6 +388,7 @@ def test_domain_mappings_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -400,6 +423,7 @@ def test_domain_mappings_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -422,6 +446,7 @@ def test_domain_mappings_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -536,6 +561,7 @@ def test_domain_mappings_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -574,6 +600,7 @@ def test_domain_mappings_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -594,6 +621,7 @@ def test_domain_mappings_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -632,6 +660,7 @@ def test_domain_mappings_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -1889,6 +1918,28 @@ def test_domain_mappings_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.DomainMappingsGrpcTransport, + transports.DomainMappingsGrpcAsyncIOTransport, + ], +) +def test_domain_mappings_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -2369,4 +2420,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index dea4bbd..68ddac8 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -213,6 +213,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -230,6 +231,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -247,6 +249,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -276,6 +279,25 @@ def test_firewall_client_client_options(client_class, transport_class, transport quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -341,6 +363,7 @@ def test_firewall_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -375,6 +398,7 @@ def test_firewall_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -397,6 +421,7 @@ def test_firewall_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -503,6 +528,7 @@ def test_firewall_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -536,6 +562,7 @@ def test_firewall_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -554,6 +581,7 @@ def test_firewall_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -587,6 +615,7 @@ def test_firewall_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -2025,6 +2054,28 @@ def test_firewall_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.FirewallGrpcTransport, + transports.FirewallGrpcAsyncIOTransport, + ], +) +def test_firewall_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -2460,4 +2511,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 22591dd..1a5b12b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -223,6 +223,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -240,6 +241,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -257,6 +259,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -286,6 +289,25 @@ def test_instances_client_client_options(client_class, transport_class, transpor quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -351,6 +373,7 @@ def test_instances_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -385,6 +408,7 @@ def test_instances_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -407,6 +431,7 @@ def test_instances_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -517,6 +542,7 @@ def test_instances_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -550,6 +576,7 @@ def test_instances_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -568,6 +595,7 @@ def test_instances_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -601,6 +629,7 @@ def test_instances_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -1709,6 +1738,28 @@ def test_instances_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.InstancesGrpcTransport, + transports.InstancesGrpcAsyncIOTransport, + ], +) +def test_instances_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -2209,4 +2260,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index c2a22ff..47a9710 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -220,6 +220,7 @@ def test_services_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -237,6 +238,7 @@ def test_services_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -254,6 +256,7 @@ def test_services_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -283,6 +286,25 @@ def test_services_client_client_options(client_class, transport_class, transport quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -348,6 +370,7 @@ def test_services_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -382,6 +405,7 @@ def test_services_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -404,6 +428,7 @@ def test_services_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -510,6 +535,7 @@ def test_services_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -543,6 +569,7 @@ def test_services_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -561,6 +588,7 @@ def test_services_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -594,6 +622,7 @@ def test_services_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -1646,6 +1675,28 @@ def test_services_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ServicesGrpcTransport, + transports.ServicesGrpcAsyncIOTransport, + ], +) +def test_services_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -2115,4 +2166,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index d66081a..b594ffa 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -223,6 +223,7 @@ def test_versions_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -240,6 +241,7 @@ def test_versions_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -257,6 +259,7 @@ def test_versions_client_client_options(client_class, transport_class, transport quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -286,6 +289,25 @@ def test_versions_client_client_options(client_class, transport_class, transport quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + 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, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -351,6 +373,7 @@ def test_versions_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -385,6 +408,7 @@ def test_versions_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -407,6 +431,7 @@ def test_versions_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -513,6 +538,7 @@ def test_versions_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -546,6 +572,7 @@ def test_versions_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -564,6 +591,7 @@ def test_versions_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -597,6 +625,7 @@ def test_versions_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -1869,6 +1898,28 @@ def test_versions_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.VersionsGrpcTransport, + transports.VersionsGrpcAsyncIOTransport, + ], +) +def test_versions_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -2338,4 +2389,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) From 26c3ba8160019d02e058017ab2d1d84017281d50 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 19 Jul 2022 08:18:56 -0400 Subject: [PATCH 04/73] chore(main): release 1.5.0 (#180) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ setup.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f65ffc..40f4fba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.5.0](https://github.com/googleapis/python-appengine-admin/compare/v1.4.1...v1.5.0) (2022-07-18) + + +### Features + +* add audience parameter ([307bdf5](https://github.com/googleapis/python-appengine-admin/commit/307bdf56fccbb04229dd4fae1ae6d425e2c51bcc)) + + +### Bug Fixes + +* **deps:** require google-api-core>=1.32.0,>=2.8.0 ([#175](https://github.com/googleapis/python-appengine-admin/issues/175)) ([307bdf5](https://github.com/googleapis/python-appengine-admin/commit/307bdf56fccbb04229dd4fae1ae6d425e2c51bcc)) +* require python 3.7+ ([#177](https://github.com/googleapis/python-appengine-admin/issues/177)) ([a3d18cc](https://github.com/googleapis/python-appengine-admin/commit/a3d18cca4a42a6290d582c2ea2b7bb50189a65ac)) + ## [1.4.1](https://github.com/googleapis/python-appengine-admin/compare/v1.4.0...v1.4.1) (2022-06-03) diff --git a/setup.py b/setup.py index 126e4ff..ae4ea03 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.4.1" +version = "1.5.0" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From f277aab1829a3aef5dc84d5eaab0d5ec30129942 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 26 Jul 2022 00:50:11 +0000 Subject: [PATCH 05/73] chore: resolve issue with prerelease presubmit [autoapprove] (#181) Source-Link: https://github.com/googleapis/synthtool/commit/1b9ad7694e44ddb4d9844df55ff7af77b51a4435 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:9db98b055a7f8bd82351238ccaacfd3cda58cdf73012ab58b8da146368330021 --- .github/.OwlBot.lock.yaml | 4 ++-- noxfile.py | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58fcbee..0eb02fd 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:c8878270182edaab99f2927969d4f700c3af265accd472c3425deedff2b7fd93 -# created: 2022-07-14T01:58:16.015625351Z + digest: sha256:9db98b055a7f8bd82351238ccaacfd3cda58cdf73012ab58b8da146368330021 +# created: 2022-07-25T16:02:49.174178716Z diff --git a/noxfile.py b/noxfile.py index 001ec73..70739b1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -333,7 +333,8 @@ def prerelease_deps(session): # Install all dependencies session.install("-e", ".[all, tests, tracing]") - session.install(*UNIT_TEST_STANDARD_DEPENDENCIES) + unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES + session.install(*unit_deps_all) system_deps_all = ( SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES @@ -362,12 +363,6 @@ def prerelease_deps(session): session.install(*constraints_deps) - if os.path.exists("samples/snippets/requirements.txt"): - session.install("-r", "samples/snippets/requirements.txt") - - if os.path.exists("samples/snippets/requirements-test.txt"): - session.install("-r", "samples/snippets/requirements-test.txt") - prerel_deps = [ "protobuf", # dependency of grpc @@ -404,11 +399,19 @@ def prerelease_deps(session): system_test_folder_path = os.path.join("tests", "system") # Only run system tests if found. - if os.path.exists(system_test_path) or os.path.exists(system_test_folder_path): - session.run("py.test", "tests/system") - - snippets_test_path = os.path.join("samples", "snippets") - - # Only run samples tests if found. - if os.path.exists(snippets_test_path): - session.run("py.test", "samples/snippets") + if os.path.exists(system_test_path): + session.run( + "py.test", + "--verbose", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_path, + *session.posargs, + ) + if os.path.exists(system_test_folder_path): + session.run( + "py.test", + "--verbose", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_folder_path, + *session.posargs, + ) From 7572619b66b688b77a1db51084b982ca543f3d18 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 25 Jul 2022 20:59:06 -0400 Subject: [PATCH 06/73] chore(bazel): update protobuf to v3.21.3 (#182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(bazel): update protobuf to v3.21.3 chore(bazel): update gax-java to 2.18.4 PiperOrigin-RevId: 463115700 Source-Link: https://github.com/googleapis/googleapis/commit/52130a9c3c289e6bc4ab1784bdde6081abdf3dd9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6a4d9d9bb3afb20b0f5fa4f5d9f6740b1d0eb19a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmE0ZDlkOWJiM2FmYjIwYjBmNWZhNGY1ZDlmNjc0MGIxZDBlYjE5YSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../services/domain_mappings/async_client.py | 3 --- .../appengine_admin_v1/services/domain_mappings/client.py | 3 --- .../appengine_admin_v1/services/instances/async_client.py | 3 --- google/cloud/appengine_admin_v1/services/instances/client.py | 3 --- .../cloud/appengine_admin_v1/services/services/async_client.py | 3 --- google/cloud/appengine_admin_v1/services/services/client.py | 3 --- .../cloud/appengine_admin_v1/services/versions/async_client.py | 3 --- google/cloud/appengine_admin_v1/services/versions/client.py | 3 --- 8 files changed, 24 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 69c656a..f0eae80 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -601,9 +601,6 @@ async def sample_delete_domain_mapping(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. request = appengine.DeleteDomainMappingRequest(request) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index cca07c4..5eb702a 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -810,9 +810,6 @@ def sample_delete_domain_mapping(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 7ac7e95..960a309 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -434,9 +434,6 @@ async def sample_delete_instance(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. request = appengine.DeleteInstanceRequest(request) diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 8a8d3f5..5cd1b2b 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -667,9 +667,6 @@ def sample_delete_instance(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 1e28bde..fdc288c 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -516,9 +516,6 @@ async def sample_delete_service(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. request = appengine.DeleteServiceRequest(request) diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 603a883..09508c4 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -730,9 +730,6 @@ def sample_delete_service(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index 1ed6d88..6a60290 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -624,9 +624,6 @@ async def sample_delete_version(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. request = appengine.DeleteVersionRequest(request) diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 356b458..da022f2 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -839,9 +839,6 @@ def sample_delete_version(): } - The JSON representation for Empty is empty JSON - object {}. - """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes From 7a29e09698175d998c4fa3dcea8f2f59a5f41221 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:10:36 +0000 Subject: [PATCH 07/73] chore(deps): update actions/setup-python action to v4 [autoapprove] (#183) Source-Link: https://github.com/googleapis/synthtool/commit/8e55b327bae44b6640c7ab4be91df85fc4d6fe8a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c6c965a4bf40c19011b11f87dbc801a66d3a23fbc6704102be064ef31c51f1c3 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/workflows/docs.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/unittest.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0eb02fd..c701359 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:9db98b055a7f8bd82351238ccaacfd3cda58cdf73012ab58b8da146368330021 -# created: 2022-07-25T16:02:49.174178716Z + digest: sha256:c6c965a4bf40c19011b11f87dbc801a66d3a23fbc6704102be064ef31c51f1c3 +# created: 2022-08-09T15:58:56.463048506Z diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b46d730..7092a13 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: "3.10" - name: Install nox @@ -26,7 +26,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: "3.10" - name: Install nox diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f512a49..d2aee5b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: "3.10" - name: Install nox diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 5531b01..87ade4d 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - name: Install nox @@ -39,7 +39,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: "3.10" - name: Install coverage From ee28547fb402ae8917a70ad776fa99e927599852 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 11 Aug 2022 15:10:12 -0400 Subject: [PATCH 08/73] fix(deps): allow protobuf < 5.0.0 (#184) fix(deps): require proto-plus >= 1.22.0 --- setup.py | 4 ++-- testing/constraints-3.7.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ae4ea03..e9e6f6b 100644 --- a/setup.py +++ b/setup.py @@ -26,8 +26,8 @@ url = "https://github.com/googleapis/python-appengine-admin" dependencies = [ "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", - "proto-plus >= 1.18.1, <2.0.0dev", - "protobuf >= 3.19.0, <4.0.0dev", + "proto-plus >= 1.22.0, <2.0.0dev", + "protobuf >= 3.19.0, <5.0.0dev", "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", ] diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index a25839e..75306b3 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -6,6 +6,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.32.0 -proto-plus==1.18.1 +proto-plus==1.22.0 grpc-google-iam-v1==0.12.4 protobuf==3.19.0 From 05568a163bbadf5b958cd5aef24403cb622e3ae0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 15 Aug 2022 10:27:45 -0400 Subject: [PATCH 09/73] chore(main): release 1.5.1 (#185) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f4fba..c90ceec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.5.1](https://github.com/googleapis/python-appengine-admin/compare/v1.5.0...v1.5.1) (2022-08-11) + + +### Bug Fixes + +* **deps:** allow protobuf < 5.0.0 ([#184](https://github.com/googleapis/python-appengine-admin/issues/184)) ([ee28547](https://github.com/googleapis/python-appengine-admin/commit/ee28547fb402ae8917a70ad776fa99e927599852)) +* **deps:** require proto-plus >= 1.22.0 ([ee28547](https://github.com/googleapis/python-appengine-admin/commit/ee28547fb402ae8917a70ad776fa99e927599852)) + ## [1.5.0](https://github.com/googleapis/python-appengine-admin/compare/v1.4.1...v1.5.0) (2022-07-18) diff --git a/setup.py b/setup.py index e9e6f6b..eccde45 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.5.0" +version = "1.5.1" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 2c074516a83ef6d0eaaadc1afe08b168c0b36dea Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 24 Aug 2022 15:38:25 +0000 Subject: [PATCH 10/73] chore: remove 'pip install' statements from python_library templates [autoapprove] (#187) Source-Link: https://github.com/googleapis/synthtool/commit/1f37ce74cbc4897f35c9ba5c40393b102da913b1 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8e84e0e0d71a0d681668461bba02c9e1394c785f31a10ae3470660235b673086 --- .github/.OwlBot.lock.yaml | 4 +- .kokoro/publish-docs.sh | 4 +- .kokoro/release.sh | 5 +- .kokoro/requirements.in | 8 + .kokoro/requirements.txt | 464 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 476 insertions(+), 9 deletions(-) create mode 100644 .kokoro/requirements.in create mode 100644 .kokoro/requirements.txt diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index c701359..1c14d7f 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:c6c965a4bf40c19011b11f87dbc801a66d3a23fbc6704102be064ef31c51f1c3 -# created: 2022-08-09T15:58:56.463048506Z + digest: sha256:8e84e0e0d71a0d681668461bba02c9e1394c785f31a10ae3470660235b673086 +# created: 2022-08-24T15:24:05.205983455Z diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 8acb14e..1c4d623 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -21,14 +21,12 @@ export PYTHONUNBUFFERED=1 export PATH="${HOME}/.local/bin:${PATH}" # Install nox -python3 -m pip install --user --upgrade --quiet nox +python3 -m pip install --require-hashes -r .kokoro/requirements.txt python3 -m nox --version # build docs nox -s docs -python3 -m pip install --user gcp-docuploader - # create metadata python3 -m docuploader create-metadata \ --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \ diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 5bbb5f5..f777b02 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -16,12 +16,9 @@ set -eo pipefail # Start the releasetool reporter -python3 -m pip install gcp-releasetool +python3 -m pip install --require-hashes -r .kokoro/requirements.txt python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script -# Ensure that we have the latest versions of Twine, Wheel, and Setuptools. -python3 -m pip install --upgrade twine wheel setuptools - # Disable buffering, so that the logs stream through. export PYTHONUNBUFFERED=1 diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in new file mode 100644 index 0000000..7718391 --- /dev/null +++ b/.kokoro/requirements.in @@ -0,0 +1,8 @@ +gcp-docuploader +gcp-releasetool +importlib-metadata +typing-extensions +twine +wheel +setuptools +nox \ No newline at end of file diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt new file mode 100644 index 0000000..c4b824f --- /dev/null +++ b/.kokoro/requirements.txt @@ -0,0 +1,464 @@ +# +# This file is autogenerated by pip-compile with python 3.10 +# To update, run: +# +# pip-compile --allow-unsafe --generate-hashes requirements.in +# +argcomplete==2.0.0 \ + --hash=sha256:6372ad78c89d662035101418ae253668445b391755cfe94ea52f1b9d22425b20 \ + --hash=sha256:cffa11ea77999bb0dd27bb25ff6dc142a6796142f68d45b1a26b11f58724561e + # via nox +attrs==22.1.0 \ + --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ + --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c + # via gcp-releasetool +bleach==5.0.1 \ + --hash=sha256:085f7f33c15bd408dd9b17a4ad77c577db66d76203e5984b1bd59baeee948b2a \ + --hash=sha256:0d03255c47eb9bd2f26aa9bb7f2107732e7e8fe195ca2f64709fcf3b0a4a085c + # via readme-renderer +cachetools==5.2.0 \ + --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ + --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db + # via google-auth +certifi==2022.6.15 \ + --hash=sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d \ + --hash=sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412 + # via requests +cffi==1.15.1 \ + --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ + --hash=sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef \ + --hash=sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104 \ + --hash=sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426 \ + --hash=sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405 \ + --hash=sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375 \ + --hash=sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a \ + --hash=sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e \ + --hash=sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc \ + --hash=sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf \ + --hash=sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185 \ + --hash=sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497 \ + --hash=sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3 \ + --hash=sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35 \ + --hash=sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c \ + --hash=sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83 \ + --hash=sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21 \ + --hash=sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca \ + --hash=sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984 \ + --hash=sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac \ + --hash=sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd \ + --hash=sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee \ + --hash=sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a \ + --hash=sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2 \ + --hash=sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192 \ + --hash=sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7 \ + --hash=sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585 \ + --hash=sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f \ + --hash=sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e \ + --hash=sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27 \ + --hash=sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b \ + --hash=sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e \ + --hash=sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e \ + --hash=sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d \ + --hash=sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c \ + --hash=sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415 \ + --hash=sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82 \ + --hash=sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02 \ + --hash=sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314 \ + --hash=sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325 \ + --hash=sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c \ + --hash=sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3 \ + --hash=sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914 \ + --hash=sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045 \ + --hash=sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d \ + --hash=sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9 \ + --hash=sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5 \ + --hash=sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2 \ + --hash=sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c \ + --hash=sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3 \ + --hash=sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2 \ + --hash=sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8 \ + --hash=sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d \ + --hash=sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d \ + --hash=sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9 \ + --hash=sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162 \ + --hash=sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76 \ + --hash=sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4 \ + --hash=sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e \ + --hash=sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9 \ + --hash=sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6 \ + --hash=sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b \ + --hash=sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01 \ + --hash=sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0 + # via cryptography +charset-normalizer==2.1.1 \ + --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 \ + --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f + # via requests +click==8.0.4 \ + --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ + --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb + # via + # gcp-docuploader + # gcp-releasetool +colorlog==6.6.0 \ + --hash=sha256:344f73204009e4c83c5b6beb00b3c45dc70fcdae3c80db919e0a4171d006fde8 \ + --hash=sha256:351c51e866c86c3217f08e4b067a7974a678be78f07f85fc2d55b8babde6d94e + # via + # gcp-docuploader + # nox +commonmark==0.9.1 \ + --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ + --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 + # via rich +cryptography==37.0.4 \ + --hash=sha256:190f82f3e87033821828f60787cfa42bff98404483577b591429ed99bed39d59 \ + --hash=sha256:2be53f9f5505673eeda5f2736bea736c40f051a739bfae2f92d18aed1eb54596 \ + --hash=sha256:30788e070800fec9bbcf9faa71ea6d8068f5136f60029759fd8c3efec3c9dcb3 \ + --hash=sha256:3d41b965b3380f10e4611dbae366f6dc3cefc7c9ac4e8842a806b9672ae9add5 \ + --hash=sha256:4c590ec31550a724ef893c50f9a97a0c14e9c851c85621c5650d699a7b88f7ab \ + --hash=sha256:549153378611c0cca1042f20fd9c5030d37a72f634c9326e225c9f666d472884 \ + --hash=sha256:63f9c17c0e2474ccbebc9302ce2f07b55b3b3fcb211ded18a42d5764f5c10a82 \ + --hash=sha256:6bc95ed67b6741b2607298f9ea4932ff157e570ef456ef7ff0ef4884a134cc4b \ + --hash=sha256:7099a8d55cd49b737ffc99c17de504f2257e3787e02abe6d1a6d136574873441 \ + --hash=sha256:75976c217f10d48a8b5a8de3d70c454c249e4b91851f6838a4e48b8f41eb71aa \ + --hash=sha256:7bc997818309f56c0038a33b8da5c0bfbb3f1f067f315f9abd6fc07ad359398d \ + --hash=sha256:80f49023dd13ba35f7c34072fa17f604d2f19bf0989f292cedf7ab5770b87a0b \ + --hash=sha256:91ce48d35f4e3d3f1d83e29ef4a9267246e6a3be51864a5b7d2247d5086fa99a \ + --hash=sha256:a958c52505c8adf0d3822703078580d2c0456dd1d27fabfb6f76fe63d2971cd6 \ + --hash=sha256:b62439d7cd1222f3da897e9a9fe53bbf5c104fff4d60893ad1355d4c14a24157 \ + --hash=sha256:b7f8dd0d4c1f21759695c05a5ec8536c12f31611541f8904083f3dc582604280 \ + --hash=sha256:d204833f3c8a33bbe11eda63a54b1aad7aa7456ed769a982f21ec599ba5fa282 \ + --hash=sha256:e007f052ed10cc316df59bc90fbb7ff7950d7e2919c9757fd42a2b8ecf8a5f67 \ + --hash=sha256:f2dcb0b3b63afb6df7fd94ec6fbddac81b5492513f7b0436210d390c14d46ee8 \ + --hash=sha256:f721d1885ecae9078c3f6bbe8a88bc0786b6e749bf32ccec1ef2b18929a05046 \ + --hash=sha256:f7a6de3e98771e183645181b3627e2563dcde3ce94a9e42a3f427d2255190327 \ + --hash=sha256:f8c0a6e9e1dd3eb0414ba320f85da6b0dcbd543126e30fcc546e7372a7fbf3b9 + # via + # gcp-releasetool + # secretstorage +distlib==0.3.5 \ + --hash=sha256:a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe \ + --hash=sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c + # via virtualenv +docutils==0.19 \ + --hash=sha256:33995a6753c30b7f577febfc2c50411fec6aac7f7ffeb7c4cfe5991072dcf9e6 \ + --hash=sha256:5e1de4d849fee02c63b040a4a3fd567f4ab104defd8a5511fbbc24a8a017efbc + # via readme-renderer +filelock==3.8.0 \ + --hash=sha256:55447caa666f2198c5b6b13a26d2084d26fa5b115c00d065664b2124680c4edc \ + --hash=sha256:617eb4e5eedc82fc5f47b6d61e4d11cb837c56cb4544e39081099fa17ad109d4 + # via virtualenv +gcp-docuploader==0.6.3 \ + --hash=sha256:ba8c9d76b3bbac54b0311c503a373b00edc2dc02d6d54ea9507045adb8e870f7 \ + --hash=sha256:c0f5aaa82ce1854a386197e4e359b120ad6d4e57ae2c812fce42219a3288026b + # via -r requirements.in +gcp-releasetool==1.8.6 \ + --hash=sha256:42e51ab8e2e789bc8e22a03c09352962cd3452951c801a2230d564816630304a \ + --hash=sha256:a3518b79d1b243c494eac392a01c7fd65187fd6d52602dcab9b529bc934d4da1 + # via -r requirements.in +google-api-core==2.8.2 \ + --hash=sha256:06f7244c640322b508b125903bb5701bebabce8832f85aba9335ec00b3d02edc \ + --hash=sha256:93c6a91ccac79079ac6bbf8b74ee75db970cc899278b97d53bc012f35908cf50 + # via + # google-cloud-core + # google-cloud-storage +google-auth==2.11.0 \ + --hash=sha256:be62acaae38d0049c21ca90f27a23847245c9f161ff54ede13af2cb6afecbac9 \ + --hash=sha256:ed65ecf9f681832298e29328e1ef0a3676e3732b2e56f41532d45f70a22de0fb + # via + # gcp-releasetool + # google-api-core + # google-cloud-core + # google-cloud-storage +google-cloud-core==2.3.2 \ + --hash=sha256:8417acf6466be2fa85123441696c4badda48db314c607cf1e5d543fa8bdc22fe \ + --hash=sha256:b9529ee7047fd8d4bf4a2182de619154240df17fbe60ead399078c1ae152af9a + # via google-cloud-storage +google-cloud-storage==2.5.0 \ + --hash=sha256:19a26c66c317ce542cea0830b7e787e8dac2588b6bfa4d3fd3b871ba16305ab0 \ + --hash=sha256:382f34b91de2212e3c2e7b40ec079d27ee2e3dbbae99b75b1bcd8c63063ce235 + # via gcp-docuploader +google-crc32c==1.3.0 \ + --hash=sha256:04e7c220798a72fd0f08242bc8d7a05986b2a08a0573396187fd32c1dcdd58b3 \ + --hash=sha256:05340b60bf05b574159e9bd940152a47d38af3fb43803ffe71f11d704b7696a6 \ + --hash=sha256:12674a4c3b56b706153a358eaa1018c4137a5a04635b92b4652440d3d7386206 \ + --hash=sha256:127f9cc3ac41b6a859bd9dc4321097b1a4f6aa7fdf71b4f9227b9e3ebffb4422 \ + --hash=sha256:13af315c3a0eec8bb8b8d80b8b128cb3fcd17d7e4edafc39647846345a3f003a \ + --hash=sha256:1926fd8de0acb9d15ee757175ce7242e235482a783cd4ec711cc999fc103c24e \ + --hash=sha256:226f2f9b8e128a6ca6a9af9b9e8384f7b53a801907425c9a292553a3a7218ce0 \ + --hash=sha256:276de6273eb074a35bc598f8efbc00c7869c5cf2e29c90748fccc8c898c244df \ + --hash=sha256:318f73f5484b5671f0c7f5f63741ab020a599504ed81d209b5c7129ee4667407 \ + --hash=sha256:3bbce1be3687bbfebe29abdb7631b83e6b25da3f4e1856a1611eb21854b689ea \ + --hash=sha256:42ae4781333e331a1743445931b08ebdad73e188fd554259e772556fc4937c48 \ + --hash=sha256:58be56ae0529c664cc04a9c76e68bb92b091e0194d6e3c50bea7e0f266f73713 \ + --hash=sha256:5da2c81575cc3ccf05d9830f9e8d3c70954819ca9a63828210498c0774fda1a3 \ + --hash=sha256:6311853aa2bba4064d0c28ca54e7b50c4d48e3de04f6770f6c60ebda1e975267 \ + --hash=sha256:650e2917660e696041ab3dcd7abac160b4121cd9a484c08406f24c5964099829 \ + --hash=sha256:6a4db36f9721fdf391646685ecffa404eb986cbe007a3289499020daf72e88a2 \ + --hash=sha256:779cbf1ce375b96111db98fca913c1f5ec11b1d870e529b1dc7354b2681a8c3a \ + --hash=sha256:7f6fe42536d9dcd3e2ffb9d3053f5d05221ae3bbcefbe472bdf2c71c793e3183 \ + --hash=sha256:891f712ce54e0d631370e1f4997b3f182f3368179198efc30d477c75d1f44942 \ + --hash=sha256:95c68a4b9b7828ba0428f8f7e3109c5d476ca44996ed9a5f8aac6269296e2d59 \ + --hash=sha256:96a8918a78d5d64e07c8ea4ed2bc44354e3f93f46a4866a40e8db934e4c0d74b \ + --hash=sha256:9c3cf890c3c0ecfe1510a452a165431b5831e24160c5fcf2071f0f85ca5a47cd \ + --hash=sha256:9f58099ad7affc0754ae42e6d87443299f15d739b0ce03c76f515153a5cda06c \ + --hash=sha256:a0b9e622c3b2b8d0ce32f77eba617ab0d6768b82836391e4f8f9e2074582bf02 \ + --hash=sha256:a7f9cbea4245ee36190f85fe1814e2d7b1e5f2186381b082f5d59f99b7f11328 \ + --hash=sha256:bab4aebd525218bab4ee615786c4581952eadc16b1ff031813a2fd51f0cc7b08 \ + --hash=sha256:c124b8c8779bf2d35d9b721e52d4adb41c9bfbde45e6a3f25f0820caa9aba73f \ + --hash=sha256:c9da0a39b53d2fab3e5467329ed50e951eb91386e9d0d5b12daf593973c3b168 \ + --hash=sha256:ca60076c388728d3b6ac3846842474f4250c91efbfe5afa872d3ffd69dd4b318 \ + --hash=sha256:cb6994fff247987c66a8a4e550ef374671c2b82e3c0d2115e689d21e511a652d \ + --hash=sha256:d1c1d6236feab51200272d79b3d3e0f12cf2cbb12b208c835b175a21efdb0a73 \ + --hash=sha256:dd7760a88a8d3d705ff562aa93f8445ead54f58fd482e4f9e2bafb7e177375d4 \ + --hash=sha256:dda4d8a3bb0b50f540f6ff4b6033f3a74e8bf0bd5320b70fab2c03e512a62812 \ + --hash=sha256:e0f1ff55dde0ebcfbef027edc21f71c205845585fffe30d4ec4979416613e9b3 \ + --hash=sha256:e7a539b9be7b9c00f11ef16b55486141bc2cdb0c54762f84e3c6fc091917436d \ + --hash=sha256:eb0b14523758e37802f27b7f8cd973f5f3d33be7613952c0df904b68c4842f0e \ + --hash=sha256:ed447680ff21c14aaceb6a9f99a5f639f583ccfe4ce1a5e1d48eb41c3d6b3217 \ + --hash=sha256:f52a4ad2568314ee713715b1e2d79ab55fab11e8b304fd1462ff5cccf4264b3e \ + --hash=sha256:fbd60c6aaa07c31d7754edbc2334aef50601b7f1ada67a96eb1eb57c7c72378f \ + --hash=sha256:fc28e0db232c62ca0c3600884933178f0825c99be4474cdd645e378a10588125 \ + --hash=sha256:fe31de3002e7b08eb20823b3735b97c86c5926dd0581c7710a680b418a8709d4 \ + --hash=sha256:fec221a051150eeddfdfcff162e6db92c65ecf46cb0f7bb1bf812a1520ec026b \ + --hash=sha256:ff71073ebf0e42258a42a0b34f2c09ec384977e7f6808999102eedd5b49920e3 + # via google-resumable-media +google-resumable-media==2.3.3 \ + --hash=sha256:27c52620bd364d1c8116eaac4ea2afcbfb81ae9139fb3199652fcac1724bfb6c \ + --hash=sha256:5b52774ea7a829a8cdaa8bd2d4c3d4bc660c91b30857ab2668d0eb830f4ea8c5 + # via google-cloud-storage +googleapis-common-protos==1.56.4 \ + --hash=sha256:8eb2cbc91b69feaf23e32452a7ae60e791e09967d81d4fcc7fc388182d1bd394 \ + --hash=sha256:c25873c47279387cfdcbdafa36149887901d36202cb645a0e4f29686bf6e4417 + # via google-api-core +idna==3.3 \ + --hash=sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff \ + --hash=sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d + # via requests +importlib-metadata==4.12.0 \ + --hash=sha256:637245b8bab2b6502fcbc752cc4b7a6f6243bb02b31c5c26156ad103d3d45670 \ + --hash=sha256:7401a975809ea1fdc658c3aa4f78cc2195a0e019c5cbc4c06122884e9ae80c23 + # via + # -r requirements.in + # twine +jeepney==0.8.0 \ + --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ + --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 + # via + # keyring + # secretstorage +jinja2==3.1.2 \ + --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ + --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 + # via gcp-releasetool +keyring==23.8.2 \ + --hash=sha256:0d9973f8891850f1ade5f26aafd06bb16865fbbae3fc56b0defb6a14a2624003 \ + --hash=sha256:10d2a8639663fe2090705a00b8c47c687cacdf97598ea9c11456679fa974473a + # via + # gcp-releasetool + # twine +markupsafe==2.1.1 \ + --hash=sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003 \ + --hash=sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88 \ + --hash=sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5 \ + --hash=sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7 \ + --hash=sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a \ + --hash=sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603 \ + --hash=sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1 \ + --hash=sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135 \ + --hash=sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247 \ + --hash=sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6 \ + --hash=sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601 \ + --hash=sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77 \ + --hash=sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02 \ + --hash=sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e \ + --hash=sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63 \ + --hash=sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f \ + --hash=sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980 \ + --hash=sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b \ + --hash=sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812 \ + --hash=sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff \ + --hash=sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96 \ + --hash=sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1 \ + --hash=sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925 \ + --hash=sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a \ + --hash=sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6 \ + --hash=sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e \ + --hash=sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f \ + --hash=sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4 \ + --hash=sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f \ + --hash=sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3 \ + --hash=sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c \ + --hash=sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a \ + --hash=sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417 \ + --hash=sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a \ + --hash=sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a \ + --hash=sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37 \ + --hash=sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452 \ + --hash=sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933 \ + --hash=sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a \ + --hash=sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7 + # via jinja2 +nox==2022.8.7 \ + --hash=sha256:1b894940551dc5c389f9271d197ca5d655d40bdc6ccf93ed6880e4042760a34b \ + --hash=sha256:96cca88779e08282a699d672258ec01eb7c792d35bbbf538c723172bce23212c + # via -r requirements.in +packaging==21.3 \ + --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ + --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 + # via + # gcp-releasetool + # nox +pkginfo==1.8.3 \ + --hash=sha256:848865108ec99d4901b2f7e84058b6e7660aae8ae10164e015a6dcf5b242a594 \ + --hash=sha256:a84da4318dd86f870a9447a8c98340aa06216bfc6f2b7bdc4b8766984ae1867c + # via twine +platformdirs==2.5.2 \ + --hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 \ + --hash=sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19 + # via virtualenv +protobuf==3.20.1 \ + --hash=sha256:06059eb6953ff01e56a25cd02cca1a9649a75a7e65397b5b9b4e929ed71d10cf \ + --hash=sha256:097c5d8a9808302fb0da7e20edf0b8d4703274d140fd25c5edabddcde43e081f \ + --hash=sha256:284f86a6207c897542d7e956eb243a36bb8f9564c1742b253462386e96c6b78f \ + --hash=sha256:32ca378605b41fd180dfe4e14d3226386d8d1b002ab31c969c366549e66a2bb7 \ + --hash=sha256:3cc797c9d15d7689ed507b165cd05913acb992d78b379f6014e013f9ecb20996 \ + --hash=sha256:62f1b5c4cd6c5402b4e2d63804ba49a327e0c386c99b1675c8a0fefda23b2067 \ + --hash=sha256:69ccfdf3657ba59569c64295b7d51325f91af586f8d5793b734260dfe2e94e2c \ + --hash=sha256:6f50601512a3d23625d8a85b1638d914a0970f17920ff39cec63aaef80a93fb7 \ + --hash=sha256:7403941f6d0992d40161aa8bb23e12575637008a5a02283a930addc0508982f9 \ + --hash=sha256:755f3aee41354ae395e104d62119cb223339a8f3276a0cd009ffabfcdd46bb0c \ + --hash=sha256:77053d28427a29987ca9caf7b72ccafee011257561259faba8dd308fda9a8739 \ + --hash=sha256:7e371f10abe57cee5021797126c93479f59fccc9693dafd6bd5633ab67808a91 \ + --hash=sha256:9016d01c91e8e625141d24ec1b20fed584703e527d28512aa8c8707f105a683c \ + --hash=sha256:9be73ad47579abc26c12024239d3540e6b765182a91dbc88e23658ab71767153 \ + --hash=sha256:adc31566d027f45efe3f44eeb5b1f329da43891634d61c75a5944e9be6dd42c9 \ + --hash=sha256:adfc6cf69c7f8c50fd24c793964eef18f0ac321315439d94945820612849c388 \ + --hash=sha256:af0ebadc74e281a517141daad9d0f2c5d93ab78e9d455113719a45a49da9db4e \ + --hash=sha256:cb29edb9eab15742d791e1025dd7b6a8f6fcb53802ad2f6e3adcb102051063ab \ + --hash=sha256:cd68be2559e2a3b84f517fb029ee611546f7812b1fdd0aa2ecc9bc6ec0e4fdde \ + --hash=sha256:cdee09140e1cd184ba9324ec1df410e7147242b94b5f8b0c64fc89e38a8ba531 \ + --hash=sha256:db977c4ca738dd9ce508557d4fce0f5aebd105e158c725beec86feb1f6bc20d8 \ + --hash=sha256:dd5789b2948ca702c17027c84c2accb552fc30f4622a98ab5c51fcfe8c50d3e7 \ + --hash=sha256:e250a42f15bf9d5b09fe1b293bdba2801cd520a9f5ea2d7fb7536d4441811d20 \ + --hash=sha256:ff8d8fa42675249bb456f5db06c00de6c2f4c27a065955917b28c4f15978b9c3 + # via + # gcp-docuploader + # gcp-releasetool + # google-api-core +py==1.11.0 \ + --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ + --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 + # via nox +pyasn1==0.4.8 \ + --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ + --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba + # via + # pyasn1-modules + # rsa +pyasn1-modules==0.2.8 \ + --hash=sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e \ + --hash=sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74 + # via google-auth +pycparser==2.21 \ + --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \ + --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206 + # via cffi +pygments==2.13.0 \ + --hash=sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1 \ + --hash=sha256:f643f331ab57ba3c9d89212ee4a2dabc6e94f117cf4eefde99a0574720d14c42 + # via + # readme-renderer + # rich +pyjwt==2.4.0 \ + --hash=sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf \ + --hash=sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba + # via gcp-releasetool +pyparsing==3.0.9 \ + --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ + --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc + # via packaging +pyperclip==1.8.2 \ + --hash=sha256:105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57 + # via gcp-releasetool +python-dateutil==2.8.2 \ + --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ + --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 + # via gcp-releasetool +readme-renderer==37.0 \ + --hash=sha256:07b7ea234e03e58f77cc222e206e6abb8f4c0435becce5104794ee591f9301c5 \ + --hash=sha256:9fa416704703e509eeb900696751c908ddeb2011319d93700d8f18baff887a69 + # via twine +requests==2.28.1 \ + --hash=sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983 \ + --hash=sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349 + # via + # gcp-releasetool + # google-api-core + # google-cloud-storage + # requests-toolbelt + # twine +requests-toolbelt==0.9.1 \ + --hash=sha256:380606e1d10dc85c3bd47bf5a6095f815ec007be7a8b69c878507068df059e6f \ + --hash=sha256:968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0 + # via twine +rfc3986==2.0.0 \ + --hash=sha256:50b1502b60e289cb37883f3dfd34532b8873c7de9f49bb546641ce9cbd256ebd \ + --hash=sha256:97aacf9dbd4bfd829baad6e6309fa6573aaf1be3f6fa735c8ab05e46cecb261c + # via twine +rich==12.5.1 \ + --hash=sha256:2eb4e6894cde1e017976d2975ac210ef515d7548bc595ba20e195fb9628acdeb \ + --hash=sha256:63a5c5ce3673d3d5fbbf23cd87e11ab84b6b451436f1b7f19ec54b6bc36ed7ca + # via twine +rsa==4.9 \ + --hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \ + --hash=sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21 + # via google-auth +secretstorage==3.3.3 \ + --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ + --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 + # via keyring +six==1.16.0 \ + --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ + --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 + # via + # bleach + # gcp-docuploader + # google-auth + # python-dateutil +twine==4.0.1 \ + --hash=sha256:42026c18e394eac3e06693ee52010baa5313e4811d5a11050e7d48436cf41b9e \ + --hash=sha256:96b1cf12f7ae611a4a40b6ae8e9570215daff0611828f5fe1f37a16255ab24a0 + # via -r requirements.in +typing-extensions==4.3.0 \ + --hash=sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02 \ + --hash=sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6 + # via -r requirements.in +urllib3==1.26.12 \ + --hash=sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e \ + --hash=sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997 + # via + # requests + # twine +virtualenv==20.16.3 \ + --hash=sha256:4193b7bc8a6cd23e4eb251ac64f29b4398ab2c233531e66e40b19a6b7b0d30c1 \ + --hash=sha256:d86ea0bb50e06252d79e6c241507cb904fcd66090c3271381372d6221a3970f9 + # via nox +webencodings==0.5.1 \ + --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ + --hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923 + # via bleach +wheel==0.37.1 \ + --hash=sha256:4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a \ + --hash=sha256:e9a504e793efbca1b8e0e9cb979a249cf4a0a7b5b8c9e8b65a5e39d49529c1c4 + # via -r requirements.in +zipp==3.8.1 \ + --hash=sha256:05b45f1ee8f807d0cc928485ca40a07cb491cf092ff587c0df9cb1fd154848d2 \ + --hash=sha256:47c40d7fe183a6f21403a199b3e4192cca5774656965b0a4988ad2f8feb5f009 + # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +setuptools==65.2.0 \ + --hash=sha256:7f4bc85450898a09f76ebf28b72fa25bc7111f6c7d665d514a60bba9c75ef2a9 \ + --hash=sha256:a3ca5857c89f82f5c9410e8508cb32f4872a3bafd4aa7ae122a24ca33bccc750 + # via -r requirements.in From d53690d0f1516a02107cf8353cf4db9a11a42373 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 24 Aug 2022 17:16:26 +0000 Subject: [PATCH 11/73] chore(python): exclude path in renovate.json [autoapprove] (#190) Source-Link: https://github.com/googleapis/synthtool/commit/69fabaee9eca28af7ecaa02c86895e606fbbebd6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:562802bfac02e012a6ac34eda282f81d06e77326b82a32d7bbb1369ff552b387 --- .github/.OwlBot.lock.yaml | 4 ++-- renovate.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 1c14d7f..c6acdf3 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8e84e0e0d71a0d681668461bba02c9e1394c785f31a10ae3470660235b673086 -# created: 2022-08-24T15:24:05.205983455Z + digest: sha256:562802bfac02e012a6ac34eda282f81d06e77326b82a32d7bbb1369ff552b387 +# created: 2022-08-24T17:07:22.006876712Z diff --git a/renovate.json b/renovate.json index c21036d..566a70f 100644 --- a/renovate.json +++ b/renovate.json @@ -5,7 +5,7 @@ ":preserveSemverRanges", ":disableDependencyDashboard" ], - "ignorePaths": [".pre-commit-config.yaml"], + "ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt"], "pip_requirements": { "fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"] } From 19fb3dab09868a5da5f9196350142ad511bbcb3f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:04:22 +0000 Subject: [PATCH 12/73] chore(python): exclude grpcio==1.49.0rc1 in tests [autoapprove] (#191) Source-Link: https://github.com/googleapis/synthtool/commit/c4dd5953003d13b239f872d329c3146586bb417e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ce3c1686bc81145c81dd269bd12c4025c6b275b22d14641358827334fddb1d72 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 6 +++--- noxfile.py | 7 +++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index c6acdf3..23e106b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:562802bfac02e012a6ac34eda282f81d06e77326b82a32d7bbb1369ff552b387 -# created: 2022-08-24T17:07:22.006876712Z + digest: sha256:ce3c1686bc81145c81dd269bd12c4025c6b275b22d14641358827334fddb1d72 +# created: 2022-08-29T17:28:30.441852797Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index c4b824f..4b29ef2 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -136,9 +136,9 @@ cryptography==37.0.4 \ # via # gcp-releasetool # secretstorage -distlib==0.3.5 \ - --hash=sha256:a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe \ - --hash=sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c +distlib==0.3.6 \ + --hash=sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46 \ + --hash=sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e # via virtualenv docutils==0.19 \ --hash=sha256:33995a6753c30b7f577febfc2c50411fec6aac7f7ffeb7c4cfe5991072dcf9e6 \ diff --git a/noxfile.py b/noxfile.py index 70739b1..5f898a7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -188,7 +188,9 @@ def unit(session): def install_systemtest_dependencies(session, *constraints): # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") + # Exclude version 1.49.0rc1 which has a known issue. + # See https://github.com/grpc/grpc/pull/30642 + session.install("--pre", "grpcio!=1.49.0rc1") session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) @@ -368,7 +370,8 @@ def prerelease_deps(session): # dependency of grpc "six", "googleapis-common-protos", - "grpcio", + # Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642 + "grpcio!=1.49.0rc1", "grpcio-status", "google-api-core", "proto-plus", From fb58f0915a1c1c62a3313ccbb616c60f2524cfdb Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 18:40:29 +0000 Subject: [PATCH 13/73] chore: fix path to requirements.txt in release script [autoapprove] (#192) Source-Link: https://github.com/googleapis/synthtool/commit/fdba3ed145bdb2f4f3eff434d4284b1d03b80d34 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1f0dbd02745fb7cf255563dab5968345989308544e52b7f460deadd5e78e63b0 --- .github/.OwlBot.lock.yaml | 3 +-- .kokoro/release.sh | 2 +- .kokoro/requirements.txt | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 23e106b..0d9eb2a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ce3c1686bc81145c81dd269bd12c4025c6b275b22d14641358827334fddb1d72 -# created: 2022-08-29T17:28:30.441852797Z + digest: sha256:1f0dbd02745fb7cf255563dab5968345989308544e52b7f460deadd5e78e63b0 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index f777b02..b1bdba1 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -16,7 +16,7 @@ set -eo pipefail # Start the releasetool reporter -python3 -m pip install --require-hashes -r .kokoro/requirements.txt +python3 -m pip install --require-hashes -r github/python-appengine-admin/.kokoro/requirements.txt python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script # Disable buffering, so that the logs stream through. diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 4b29ef2..92b2f72 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -100,9 +100,9 @@ click==8.0.4 \ # via # gcp-docuploader # gcp-releasetool -colorlog==6.6.0 \ - --hash=sha256:344f73204009e4c83c5b6beb00b3c45dc70fcdae3c80db919e0a4171d006fde8 \ - --hash=sha256:351c51e866c86c3217f08e4b067a7974a678be78f07f85fc2d55b8babde6d94e +colorlog==6.7.0 \ + --hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \ + --hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5 # via # gcp-docuploader # nox @@ -152,9 +152,9 @@ gcp-docuploader==0.6.3 \ --hash=sha256:ba8c9d76b3bbac54b0311c503a373b00edc2dc02d6d54ea9507045adb8e870f7 \ --hash=sha256:c0f5aaa82ce1854a386197e4e359b120ad6d4e57ae2c812fce42219a3288026b # via -r requirements.in -gcp-releasetool==1.8.6 \ - --hash=sha256:42e51ab8e2e789bc8e22a03c09352962cd3452951c801a2230d564816630304a \ - --hash=sha256:a3518b79d1b243c494eac392a01c7fd65187fd6d52602dcab9b529bc934d4da1 +gcp-releasetool==1.8.7 \ + --hash=sha256:3d2a67c9db39322194afb3b427e9cb0476ce8f2a04033695f0aeb63979fc2b37 \ + --hash=sha256:5e4d28f66e90780d77f3ecf1e9155852b0c3b13cbccb08ab07e66b2357c8da8d # via -r requirements.in google-api-core==2.8.2 \ --hash=sha256:06f7244c640322b508b125903bb5701bebabce8832f85aba9335ec00b3d02edc \ @@ -251,9 +251,9 @@ jinja2==3.1.2 \ --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 # via gcp-releasetool -keyring==23.8.2 \ - --hash=sha256:0d9973f8891850f1ade5f26aafd06bb16865fbbae3fc56b0defb6a14a2624003 \ - --hash=sha256:10d2a8639663fe2090705a00b8c47c687cacdf97598ea9c11456679fa974473a +keyring==23.9.0 \ + --hash=sha256:4c32a31174faaee48f43a7e2c7e9c3216ec5e95acf22a2bebfb4a1d05056ee44 \ + --hash=sha256:98f060ec95ada2ab910c195a2d4317be6ef87936a766b239c46aa3c7aac4f0db # via # gcp-releasetool # twine @@ -440,9 +440,9 @@ urllib3==1.26.12 \ # via # requests # twine -virtualenv==20.16.3 \ - --hash=sha256:4193b7bc8a6cd23e4eb251ac64f29b4398ab2c233531e66e40b19a6b7b0d30c1 \ - --hash=sha256:d86ea0bb50e06252d79e6c241507cb904fcd66090c3271381372d6221a3970f9 +virtualenv==20.16.4 \ + --hash=sha256:014f766e4134d0008dcaa1f95bafa0fb0f575795d07cae50b1bee514185d6782 \ + --hash=sha256:035ed57acce4ac35c82c9d8802202b0e71adac011a511ff650cbcf9635006a22 # via nox webencodings==0.5.1 \ --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ From abafb43f54781d510eecc8800d5f74d33d81094a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 2 Sep 2022 00:54:23 +0000 Subject: [PATCH 14/73] chore(python): update .kokoro/requirements.txt (#193) Source-Link: https://github.com/googleapis/synthtool/commit/703554a14c7479542335b62fa69279f93a9e38ec Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:94961fdc5c9ca6d13530a6a414a49d2f607203168215d074cdb0a1df9ec31c0b --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.txt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0d9eb2a..2fa0f7c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:1f0dbd02745fb7cf255563dab5968345989308544e52b7f460deadd5e78e63b0 + digest: sha256:94961fdc5c9ca6d13530a6a414a49d2f607203168215d074cdb0a1df9ec31c0b diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 92b2f72..385f2d4 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -241,6 +241,10 @@ importlib-metadata==4.12.0 \ # via # -r requirements.in # twine +jaraco-classes==3.2.2 \ + --hash=sha256:6745f113b0b588239ceb49532aa09c3ebb947433ce311ef2f8e3ad64ebb74594 \ + --hash=sha256:e6ef6fd3fcf4579a7a019d87d1e56a883f4e4c35cfe925f86731abc58804e647 + # via keyring jeepney==0.8.0 \ --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 @@ -299,6 +303,10 @@ markupsafe==2.1.1 \ --hash=sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a \ --hash=sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7 # via jinja2 +more-itertools==8.14.0 \ + --hash=sha256:1bc4f91ee5b1b31ac7ceacc17c09befe6a40a503907baf9c839c229b5095cfd2 \ + --hash=sha256:c09443cd3d5438b8dafccd867a6bc1cb0894389e90cb53d227456b0b0bccb750 + # via jaraco-classes nox==2022.8.7 \ --hash=sha256:1b894940551dc5c389f9271d197ca5d655d40bdc6ccf93ed6880e4042760a34b \ --hash=sha256:96cca88779e08282a699d672258ec01eb7c792d35bbbf538c723172bce23212c From 2f1a7f18e4fbf9e180d23a41082544b6dea6a60f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 2 Sep 2022 19:18:16 +0000 Subject: [PATCH 15/73] chore(python): exclude setup.py in renovate config (#195) Source-Link: https://github.com/googleapis/synthtool/commit/56da63e80c384a871356d1ea6640802017f213b4 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:993a058718e84a82fda04c3177e58f0a43281a996c7c395e0a56ccc4d6d210d7 --- .github/.OwlBot.lock.yaml | 2 +- renovate.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 2fa0f7c..b8dcb4a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:94961fdc5c9ca6d13530a6a414a49d2f607203168215d074cdb0a1df9ec31c0b + digest: sha256:993a058718e84a82fda04c3177e58f0a43281a996c7c395e0a56ccc4d6d210d7 diff --git a/renovate.json b/renovate.json index 566a70f..39b2a0e 100644 --- a/renovate.json +++ b/renovate.json @@ -5,7 +5,7 @@ ":preserveSemverRanges", ":disableDependencyDashboard" ], - "ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt"], + "ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt", "setup.py"], "pip_requirements": { "fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"] } From 8c8db1d47f5dc1d7c78fb8d31817cfe934d3c2be Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 14:46:19 +0000 Subject: [PATCH 16/73] chore: Bump gapic-generator-python version to 1.3.0 (#196) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 472561635 Source-Link: https://github.com/googleapis/googleapis/commit/332ecf599f8e747d8d1213b77ae7db26eff12814 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4313d682880fd9d7247291164d4e9d3d5bd9f177 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9 --- .../services/applications/async_client.py | 28 + .../services/applications/client.py | 28 + .../authorized_certificates/async_client.py | 35 + .../authorized_certificates/client.py | 35 + .../authorized_domains/async_client.py | 7 + .../services/authorized_domains/client.py | 7 + .../services/domain_mappings/async_client.py | 35 + .../services/domain_mappings/client.py | 35 + .../services/firewall/async_client.py | 42 + .../services/firewall/client.py | 42 + .../services/instances/async_client.py | 28 + .../services/instances/client.py | 28 + .../services/services/async_client.py | 28 + .../services/services/client.py | 28 + .../services/versions/async_client.py | 35 + .../services/versions/client.py | 35 + mypy.ini | 2 +- ...d_applications_create_application_async.py | 7 + ...ed_applications_create_application_sync.py | 7 + ...ated_applications_get_application_async.py | 7 + ...rated_applications_get_application_sync.py | 7 + ...d_applications_repair_application_async.py | 7 + ...ed_applications_repair_application_sync.py | 7 + ...d_applications_update_application_async.py | 7 + ...ed_applications_update_application_sync.py | 7 + ...tes_create_authorized_certificate_async.py | 7 + ...ates_create_authorized_certificate_sync.py | 7 + ...tes_delete_authorized_certificate_async.py | 7 + ...ates_delete_authorized_certificate_sync.py | 7 + ...icates_get_authorized_certificate_async.py | 7 + ...ficates_get_authorized_certificate_sync.py | 7 + ...ates_list_authorized_certificates_async.py | 7 + ...cates_list_authorized_certificates_sync.py | 7 + ...tes_update_authorized_certificate_async.py | 7 + ...ates_update_authorized_certificate_sync.py | 7 + ...d_domains_list_authorized_domains_async.py | 7 + ...ed_domains_list_authorized_domains_sync.py | 7 + ...in_mappings_create_domain_mapping_async.py | 7 + ...ain_mappings_create_domain_mapping_sync.py | 7 + ...in_mappings_delete_domain_mapping_async.py | 7 + ...ain_mappings_delete_domain_mapping_sync.py | 7 + ...omain_mappings_get_domain_mapping_async.py | 7 + ...domain_mappings_get_domain_mapping_sync.py | 7 + ...ain_mappings_list_domain_mappings_async.py | 7 + ...main_mappings_list_domain_mappings_sync.py | 7 + ...in_mappings_update_domain_mapping_async.py | 7 + ...ain_mappings_update_domain_mapping_sync.py | 7 + ...rewall_batch_update_ingress_rules_async.py | 7 + ...irewall_batch_update_ingress_rules_sync.py | 7 + ...ated_firewall_create_ingress_rule_async.py | 7 + ...rated_firewall_create_ingress_rule_sync.py | 7 + ...ated_firewall_delete_ingress_rule_async.py | 7 + ...rated_firewall_delete_ingress_rule_sync.py | 7 + ...nerated_firewall_get_ingress_rule_async.py | 7 + ...enerated_firewall_get_ingress_rule_sync.py | 7 + ...rated_firewall_list_ingress_rules_async.py | 7 + ...erated_firewall_list_ingress_rules_sync.py | 7 + ...ated_firewall_update_ingress_rule_async.py | 7 + ...rated_firewall_update_ingress_rule_sync.py | 7 + ...enerated_instances_debug_instance_async.py | 7 + ...generated_instances_debug_instance_sync.py | 7 + ...nerated_instances_delete_instance_async.py | 7 + ...enerated_instances_delete_instance_sync.py | 7 + ..._generated_instances_get_instance_async.py | 7 + ...1_generated_instances_get_instance_sync.py | 7 + ...enerated_instances_list_instances_async.py | 7 + ...generated_instances_list_instances_sync.py | 7 + ...generated_services_delete_service_async.py | 7 + ..._generated_services_delete_service_sync.py | 7 + ...v1_generated_services_get_service_async.py | 7 + ..._v1_generated_services_get_service_sync.py | 7 + ..._generated_services_list_services_async.py | 7 + ...1_generated_services_list_services_sync.py | 7 + ...generated_services_update_service_async.py | 7 + ..._generated_services_update_service_sync.py | 7 + ...generated_versions_create_version_async.py | 7 + ..._generated_versions_create_version_sync.py | 7 + ...generated_versions_delete_version_async.py | 7 + ..._generated_versions_delete_version_sync.py | 7 + ...v1_generated_versions_get_version_async.py | 7 + ..._v1_generated_versions_get_version_sync.py | 7 + ..._generated_versions_list_versions_async.py | 7 + ...1_generated_versions_list_versions_sync.py | 7 + ...generated_versions_update_version_async.py | 7 + ..._generated_versions_update_version_sync.py | 7 + .../snippet_metadata_appengine admin_v1.json | 1344 ++++++++--------- 86 files changed, 1625 insertions(+), 673 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index 5bf8dd9..1c88e92 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -213,6 +213,13 @@ async def get_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_get_application(): @@ -317,6 +324,13 @@ async def create_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_create_application(): @@ -405,6 +419,13 @@ async def update_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_update_application(): @@ -501,6 +522,13 @@ async def repair_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_repair_application(): diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 0790314..eb68fa6 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -420,6 +420,13 @@ def get_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_get_application(): @@ -524,6 +531,13 @@ def create_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_create_application(): @@ -613,6 +627,13 @@ def update_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_update_application(): @@ -710,6 +731,13 @@ def repair_application( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_repair_application(): diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index 4a3c010..d4972c5 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -221,6 +221,13 @@ async def list_authorized_certificates( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_list_authorized_certificates(): @@ -306,6 +313,13 @@ async def get_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_get_authorized_certificate(): @@ -381,6 +395,13 @@ async def create_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_create_authorized_certificate(): @@ -461,6 +482,13 @@ async def update_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_update_authorized_certificate(): @@ -536,6 +564,13 @@ async def delete_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_delete_authorized_certificate(): diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index 02c3597..547b6e0 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -423,6 +423,13 @@ def list_authorized_certificates( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_list_authorized_certificates(): @@ -511,6 +518,13 @@ def get_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_get_authorized_certificate(): @@ -589,6 +603,13 @@ def create_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_create_authorized_certificate(): @@ -672,6 +693,13 @@ def update_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_update_authorized_certificate(): @@ -750,6 +778,13 @@ def delete_authorized_certificate( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_delete_authorized_certificate(): diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 5b79bb6..7d0e420 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -217,6 +217,13 @@ async def list_authorized_domains( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_list_authorized_domains(): diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index 5478ac4..3c048c8 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -422,6 +422,13 @@ def list_authorized_domains( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_list_authorized_domains(): diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index f0eae80..66fa3b1 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -217,6 +217,13 @@ async def list_domain_mappings( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_list_domain_mappings(): @@ -301,6 +308,13 @@ async def get_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_get_domain_mapping(): @@ -376,6 +390,13 @@ async def create_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_create_domain_mapping(): @@ -467,6 +488,13 @@ async def update_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_update_domain_mapping(): @@ -556,6 +584,13 @@ async def delete_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_delete_domain_mapping(): diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index 5eb702a..ea01f3f 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -422,6 +422,13 @@ def list_domain_mappings( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_list_domain_mappings(): @@ -507,6 +514,13 @@ def get_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_get_domain_mapping(): @@ -583,6 +597,13 @@ def create_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_create_domain_mapping(): @@ -675,6 +696,13 @@ def update_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_update_domain_mapping(): @@ -765,6 +793,13 @@ def delete_domain_mapping( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_delete_domain_mapping(): diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index eb65073..6b03245 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -216,6 +216,13 @@ async def list_ingress_rules( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_list_ingress_rules(): @@ -306,6 +313,13 @@ async def batch_update_ingress_rules( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_batch_update_ingress_rules(): @@ -376,6 +390,13 @@ async def create_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_create_ingress_rule(): @@ -450,6 +471,13 @@ async def get_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_get_ingress_rule(): @@ -524,6 +552,13 @@ async def update_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_update_ingress_rule(): @@ -598,6 +633,13 @@ async def delete_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_delete_ingress_rule(): diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index d241d18..0e8b5c1 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -427,6 +427,13 @@ def list_ingress_rules( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_list_ingress_rules(): @@ -518,6 +525,13 @@ def batch_update_ingress_rules( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_batch_update_ingress_rules(): @@ -591,6 +605,13 @@ def create_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_create_ingress_rule(): @@ -666,6 +687,13 @@ def get_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_get_ingress_rule(): @@ -741,6 +769,13 @@ def update_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_update_ingress_rule(): @@ -816,6 +851,13 @@ def delete_ingress_rule( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_delete_ingress_rule(): diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 960a309..0e999ae 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -218,6 +218,13 @@ async def list_instances( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_list_instances(): @@ -302,6 +309,13 @@ async def get_instance( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_get_instance(): @@ -389,6 +403,13 @@ async def delete_instance( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_delete_instance(): @@ -492,6 +513,13 @@ async def debug_instance( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_debug_instance(): diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 5cd1b2b..90e97b6 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -449,6 +449,13 @@ def list_instances( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_list_instances(): @@ -534,6 +541,13 @@ def get_instance( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_get_instance(): @@ -622,6 +636,13 @@ def delete_instance( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_delete_instance(): @@ -726,6 +747,13 @@ def debug_instance( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_debug_instance(): diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index fdc288c..3fd6da3 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -210,6 +210,13 @@ async def list_services( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_list_services(): @@ -295,6 +302,13 @@ async def get_service( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_get_service(): @@ -377,6 +391,13 @@ async def update_service( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_update_service(): @@ -471,6 +492,13 @@ async def delete_service( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_delete_service(): diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 09508c4..2eb5429 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -421,6 +421,13 @@ def list_services( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_list_services(): @@ -507,6 +514,13 @@ def get_service( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_get_service(): @@ -590,6 +604,13 @@ def update_service( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_update_service(): @@ -685,6 +706,13 @@ def delete_service( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_delete_service(): diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index 6a60290..ecc29d5 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -213,6 +213,13 @@ async def list_versions( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_list_versions(): @@ -299,6 +306,13 @@ async def get_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_get_version(): @@ -372,6 +386,13 @@ async def create_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_create_version(): @@ -493,6 +514,13 @@ async def update_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_update_version(): @@ -579,6 +607,13 @@ async def delete_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 async def sample_delete_version(): diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index da022f2..8334f50 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -424,6 +424,13 @@ def list_versions( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_list_versions(): @@ -511,6 +518,13 @@ def get_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_get_version(): @@ -585,6 +599,13 @@ def create_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_create_version(): @@ -707,6 +728,13 @@ def update_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_update_version(): @@ -794,6 +822,13 @@ def delete_version( .. code-block:: python + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 def sample_delete_version(): diff --git a/mypy.ini b/mypy.ini index 4505b48..574c5ae 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,3 +1,3 @@ [mypy] -python_version = 3.6 +python_version = 3.7 namespace_packages = True diff --git a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py index c7bcd43..da93f20 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_CreateApplication_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py index a34076e..eef941d 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_CreateApplication_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py index 75bf03a..48b21b1 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_GetApplication_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py index 091e29c..0818eb1 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_GetApplication_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py index b8b2e88..c849447 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_RepairApplication_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py index 84f89dc..d63ad80 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_RepairApplication_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py index 8581b19..e5d3402 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_UpdateApplication_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py index d313fbd..e2f1418 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Applications_UpdateApplication_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py index d2f8dd1..65c734f 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py index c685f50..1486259 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py index a368196..ec479e8 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py index 4b09487..0a7afaf 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py index fca440b..c6cf45b 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py index eb6ff84..bd754c5 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py index 78a7e96..dc5e905 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py index 36050f0..824e864 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py index 7628188..f28e68f 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py index 73070a4..2574ea5 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py index c553401..4669118 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py index a5d8ca2..8fd97e1 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py index 9112c71..b117722 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_CreateDomainMapping_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py index edb7470..5e114ea 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_CreateDomainMapping_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py index 5ecc6b2..79ff3a1 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_DeleteDomainMapping_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py index 2509620..3eb305c 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py index f41b68c..83086de 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_GetDomainMapping_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py index c6db15d..8f946e0 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_GetDomainMapping_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py index f3f8548..cc9b583 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_ListDomainMappings_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py index 3deec84..abeae74 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_ListDomainMappings_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py index f27e7a3..fbc8087 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_UpdateDomainMapping_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py index e5afe73..3a38f47 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py index ee660d9..b07befd 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_BatchUpdateIngressRules_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py index ecca58f..7d3e5cb 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py index 85922e4..500dbe7 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_CreateIngressRule_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py index e88bdbe..0c1c0d6 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_CreateIngressRule_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py index d6153f6..6a29e91 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_DeleteIngressRule_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py index 5684297..b9431cd 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_DeleteIngressRule_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py index d2434d8..6114f52 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_GetIngressRule_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py index 846afa6..43aa8df 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_GetIngressRule_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py index 7e29704..4995911 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_ListIngressRules_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py index c4496e5..1cf2c4d 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_ListIngressRules_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py index 90475f3..4f67c75 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_UpdateIngressRule_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py index b091b83..ba09c2c 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Firewall_UpdateIngressRule_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py index 6872a7b..7834ab3 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_DebugInstance_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py index 5c4aab3..5388e72 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_DebugInstance_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py index 44cd5ea..a1d9063 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_DeleteInstance_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py index e7f554e..e8176ea 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_DeleteInstance_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py index 68d2cc7..2b8c9fe 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_GetInstance_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py index 624a6c2..0b8cc9a 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_GetInstance_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py index e783112..7317d3e 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_ListInstances_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py index 5db0e21..f0cfba8 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Instances_ListInstances_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py index a820bd0..6b125aa 100644 --- a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_DeleteService_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py index 412d12d..9264b35 100644 --- a/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_DeleteService_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_get_service_async.py b/samples/generated_samples/appengine_v1_generated_services_get_service_async.py index 86e01db..978f014 100644 --- a/samples/generated_samples/appengine_v1_generated_services_get_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_get_service_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_GetService_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py index 11461b8..5fb5629 100644 --- a/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_GetService_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_list_services_async.py b/samples/generated_samples/appengine_v1_generated_services_list_services_async.py index b34dce6..ebef32d 100644 --- a/samples/generated_samples/appengine_v1_generated_services_list_services_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_list_services_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_ListServices_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py b/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py index f845c93..9267f12 100644 --- a/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_ListServices_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py index 159082c..3a1d440 100644 --- a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_UpdateService_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py index 2f98cd1..72bc871 100644 --- a/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Services_UpdateService_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py index 0b7167b..29ce9fe 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_CreateVersion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py index 3fe3b85..f4a2526 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_CreateVersion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py index d62e1cf..2f5dff4 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_DeleteVersion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py index 33ee0b5..d560849 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_DeleteVersion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py index af77bf5..5fbf327 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_GetVersion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py index 50614fc..634cb66 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_GetVersion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py index 2af4092..5c0a6ab 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_ListVersions_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py index e70220c..204daa9 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_ListVersions_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py index 7a9546d..7c915fe 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_UpdateVersion_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py index 08eb2f8..30fdc26 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py @@ -24,6 +24,13 @@ # [START appengine_v1_generated_Versions_UpdateVersion_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/snippet_metadata_appengine admin_v1.json b/samples/generated_samples/snippet_metadata_appengine admin_v1.json index a3212d2..91148e6 100644 --- a/samples/generated_samples/snippet_metadata_appengine admin_v1.json +++ b/samples/generated_samples/snippet_metadata_appengine admin_v1.json @@ -55,33 +55,33 @@ "regionTag": "appengine_v1_generated_Applications_CreateApplication_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -131,33 +131,33 @@ "regionTag": "appengine_v1_generated_Applications_CreateApplication_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -212,33 +212,33 @@ "regionTag": "appengine_v1_generated_Applications_GetApplication_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -292,33 +292,33 @@ "regionTag": "appengine_v1_generated_Applications_GetApplication_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -369,33 +369,33 @@ "regionTag": "appengine_v1_generated_Applications_RepairApplication_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -445,33 +445,33 @@ "regionTag": "appengine_v1_generated_Applications_RepairApplication_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -522,33 +522,33 @@ "regionTag": "appengine_v1_generated_Applications_UpdateApplication_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -598,33 +598,33 @@ "regionTag": "appengine_v1_generated_Applications_UpdateApplication_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -675,33 +675,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -751,33 +751,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -827,31 +827,31 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async", "segments": [ { - "end": 41, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 41, + "end": 48, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "start": 38, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 42, + "end": 49, "type": "RESPONSE_HANDLING" } ], @@ -900,31 +900,31 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync", "segments": [ { - "end": 41, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 41, + "end": 48, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "start": 38, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 42, + "end": 49, "type": "RESPONSE_HANDLING" } ], @@ -975,33 +975,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1051,33 +1051,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1128,33 +1128,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1204,33 +1204,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1281,33 +1281,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1357,33 +1357,33 @@ "regionTag": "appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1434,33 +1434,33 @@ "regionTag": "appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1510,33 +1510,33 @@ "regionTag": "appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1587,33 +1587,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_CreateDomainMapping_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -1663,33 +1663,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_CreateDomainMapping_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -1740,33 +1740,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_DeleteDomainMapping_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -1816,33 +1816,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -1893,33 +1893,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_GetDomainMapping_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -1969,33 +1969,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_GetDomainMapping_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2046,33 +2046,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_ListDomainMappings_async", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2122,33 +2122,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_ListDomainMappings_sync", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2199,33 +2199,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_UpdateDomainMapping_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -2275,33 +2275,33 @@ "regionTag": "appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -2352,33 +2352,33 @@ "regionTag": "appengine_v1_generated_Firewall_BatchUpdateIngressRules_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2428,33 +2428,33 @@ "regionTag": "appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2505,33 +2505,33 @@ "regionTag": "appengine_v1_generated_Firewall_CreateIngressRule_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2581,33 +2581,33 @@ "regionTag": "appengine_v1_generated_Firewall_CreateIngressRule_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2657,31 +2657,31 @@ "regionTag": "appengine_v1_generated_Firewall_DeleteIngressRule_async", "segments": [ { - "end": 41, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 41, + "end": 48, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "start": 38, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 42, + "end": 49, "type": "RESPONSE_HANDLING" } ], @@ -2730,31 +2730,31 @@ "regionTag": "appengine_v1_generated_Firewall_DeleteIngressRule_sync", "segments": [ { - "end": 41, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 41, + "end": 48, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "start": 38, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 42, + "end": 49, "type": "RESPONSE_HANDLING" } ], @@ -2805,33 +2805,33 @@ "regionTag": "appengine_v1_generated_Firewall_GetIngressRule_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2881,33 +2881,33 @@ "regionTag": "appengine_v1_generated_Firewall_GetIngressRule_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -2958,33 +2958,33 @@ "regionTag": "appengine_v1_generated_Firewall_ListIngressRules_async", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3034,33 +3034,33 @@ "regionTag": "appengine_v1_generated_Firewall_ListIngressRules_sync", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3111,33 +3111,33 @@ "regionTag": "appengine_v1_generated_Firewall_UpdateIngressRule_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3187,33 +3187,33 @@ "regionTag": "appengine_v1_generated_Firewall_UpdateIngressRule_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3264,33 +3264,33 @@ "regionTag": "appengine_v1_generated_Instances_DebugInstance_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -3340,33 +3340,33 @@ "regionTag": "appengine_v1_generated_Instances_DebugInstance_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -3417,33 +3417,33 @@ "regionTag": "appengine_v1_generated_Instances_DeleteInstance_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -3493,33 +3493,33 @@ "regionTag": "appengine_v1_generated_Instances_DeleteInstance_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -3570,33 +3570,33 @@ "regionTag": "appengine_v1_generated_Instances_GetInstance_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3646,33 +3646,33 @@ "regionTag": "appengine_v1_generated_Instances_GetInstance_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3723,33 +3723,33 @@ "regionTag": "appengine_v1_generated_Instances_ListInstances_async", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3799,33 +3799,33 @@ "regionTag": "appengine_v1_generated_Instances_ListInstances_sync", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -3876,33 +3876,33 @@ "regionTag": "appengine_v1_generated_Services_DeleteService_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -3952,33 +3952,33 @@ "regionTag": "appengine_v1_generated_Services_DeleteService_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -4029,33 +4029,33 @@ "regionTag": "appengine_v1_generated_Services_GetService_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -4105,33 +4105,33 @@ "regionTag": "appengine_v1_generated_Services_GetService_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -4182,33 +4182,33 @@ "regionTag": "appengine_v1_generated_Services_ListServices_async", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -4258,33 +4258,33 @@ "regionTag": "appengine_v1_generated_Services_ListServices_sync", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -4335,33 +4335,33 @@ "regionTag": "appengine_v1_generated_Services_UpdateService_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -4411,33 +4411,33 @@ "regionTag": "appengine_v1_generated_Services_UpdateService_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -4488,33 +4488,33 @@ "regionTag": "appengine_v1_generated_Versions_CreateVersion_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -4564,33 +4564,33 @@ "regionTag": "appengine_v1_generated_Versions_CreateVersion_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -4641,33 +4641,33 @@ "regionTag": "appengine_v1_generated_Versions_DeleteVersion_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -4717,33 +4717,33 @@ "regionTag": "appengine_v1_generated_Versions_DeleteVersion_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -4794,33 +4794,33 @@ "regionTag": "appengine_v1_generated_Versions_GetVersion_async", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -4870,33 +4870,33 @@ "regionTag": "appengine_v1_generated_Versions_GetVersion_sync", "segments": [ { - "end": 43, + "end": 50, "start": 27, "type": "FULL" }, { - "end": 43, + "end": 50, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 44, - "start": 41, + "end": 51, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -4947,33 +4947,33 @@ "regionTag": "appengine_v1_generated_Versions_ListVersions_async", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -5023,33 +5023,33 @@ "regionTag": "appengine_v1_generated_Versions_ListVersions_sync", "segments": [ { - "end": 44, + "end": 51, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 51, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 40, - "start": 38, + "end": 47, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 41, + "end": 52, + "start": 48, "type": "RESPONSE_HANDLING" } ], @@ -5100,33 +5100,33 @@ "regionTag": "appengine_v1_generated_Versions_UpdateVersion_async", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], @@ -5176,33 +5176,33 @@ "regionTag": "appengine_v1_generated_Versions_UpdateVersion_sync", "segments": [ { - "end": 47, + "end": 54, "start": 27, "type": "FULL" }, { - "end": 47, + "end": 54, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 40, + "start": 38, "type": "CLIENT_INITIALIZATION" }, { - "end": 37, - "start": 34, + "end": 44, + "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 44, - "start": 38, + "end": 51, + "start": 45, "type": "REQUEST_EXECUTION" }, { - "end": 48, - "start": 45, + "end": 55, + "start": 52, "type": "RESPONSE_HANDLING" } ], From 23e2c6dc94ab4574c840cbd49a8fe88bf15ba106 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 8 Sep 2022 15:54:17 +0000 Subject: [PATCH 17/73] chore: use gapic-generator-python 1.3.1 (#197) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 472772457 Source-Link: https://github.com/googleapis/googleapis/commit/855b74d203deeb0f7a0215f9454cdde62a1f9b86 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b64b1e7da3e138f15ca361552ef0545e54891b4f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjY0YjFlN2RhM2UxMzhmMTVjYTM2MTU1MmVmMDU0NWU1NDg5MWI0ZiJ9 --- tests/unit/gapic/appengine_admin_v1/test_applications.py | 4 ++-- .../gapic/appengine_admin_v1/test_authorized_certificates.py | 4 ++-- .../unit/gapic/appengine_admin_v1/test_authorized_domains.py | 4 ++-- tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py | 4 ++-- tests/unit/gapic/appengine_admin_v1/test_firewall.py | 4 ++-- tests/unit/gapic/appengine_admin_v1/test_instances.py | 4 ++-- tests/unit/gapic/appengine_admin_v1/test_services.py | 4 ++-- tests/unit/gapic/appengine_admin_v1/test_versions.py | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index a6dcefe..ab9e465 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index 907de24..52146ca 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index 45354e1..671f0c3 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index d5a8e70..7f57e90 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 68ddac8..7291c0a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 1a5b12b..55cbeb0 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 47a9710..beb1c24 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index b594ffa..09236c4 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -18,8 +18,8 @@ # try/except added for compatibility with python < 3.8 try: from unittest import mock - from unittest.mock import AsyncMock -except ImportError: + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER import mock import grpc From 6bdef87e6300cdf037664b1e96328c7f6e7899e4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 15:00:26 +0000 Subject: [PATCH 18/73] chore: use gapic generator python 1.4.1 (#198) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 473833416 Source-Link: https://github.com/googleapis/googleapis/commit/565a5508869557a3228b871101e4e4ebd8f93d11 Source-Link: https://github.com/googleapis/googleapis-gen/commit/1ee1a06c6de3ca8b843572c1fde0548f84236989 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMWVlMWEwNmM2ZGUzY2E4Yjg0MzU3MmMxZmRlMDU0OGY4NDIzNjk4OSJ9 --- tests/unit/gapic/appengine_admin_v1/test_applications.py | 2 +- .../gapic/appengine_admin_v1/test_authorized_certificates.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_firewall.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_instances.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_services.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_versions.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index ab9e465..4760c52 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index 52146ca..e11ac46 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index 671f0c3..71acc23 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index 7f57e90..e902ca3 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 7291c0a..e71fa0e 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 55cbeb0..b1fa2a9 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index beb1c24..289b785 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 09236c4..e1d0d3d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -27,7 +27,7 @@ import math import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule - +from proto.marshal.rules import wrappers from google.api_core import client_options from google.api_core import exceptions as core_exceptions From dcadfa97388ec350a026436e644bf7d4024549a3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 29 Sep 2022 15:30:08 -0400 Subject: [PATCH 19/73] fix(deps): require protobuf >= 3.20.2 (#199) * chore: exclude requirements.txt file from renovate-bot Source-Link: https://github.com/googleapis/synthtool/commit/f58d3135a2fab20e225d98741dbc06d57459b816 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7a40313731a7cb1454eef6b33d3446ebb121836738dc3ab3d2d3ded5268c35b6 * update constraints files * fix(deps): require protobuf 3.20.2 Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.txt | 49 ++++++++++++++++++------------------- setup.py | 2 +- testing/constraints-3.7.txt | 2 +- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b8dcb4a..3815c98 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:993a058718e84a82fda04c3177e58f0a43281a996c7c395e0a56ccc4d6d210d7 + digest: sha256:7a40313731a7cb1454eef6b33d3446ebb121836738dc3ab3d2d3ded5268c35b6 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 385f2d4..d15994b 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -325,31 +325,30 @@ platformdirs==2.5.2 \ --hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 \ --hash=sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19 # via virtualenv -protobuf==3.20.1 \ - --hash=sha256:06059eb6953ff01e56a25cd02cca1a9649a75a7e65397b5b9b4e929ed71d10cf \ - --hash=sha256:097c5d8a9808302fb0da7e20edf0b8d4703274d140fd25c5edabddcde43e081f \ - --hash=sha256:284f86a6207c897542d7e956eb243a36bb8f9564c1742b253462386e96c6b78f \ - --hash=sha256:32ca378605b41fd180dfe4e14d3226386d8d1b002ab31c969c366549e66a2bb7 \ - --hash=sha256:3cc797c9d15d7689ed507b165cd05913acb992d78b379f6014e013f9ecb20996 \ - --hash=sha256:62f1b5c4cd6c5402b4e2d63804ba49a327e0c386c99b1675c8a0fefda23b2067 \ - --hash=sha256:69ccfdf3657ba59569c64295b7d51325f91af586f8d5793b734260dfe2e94e2c \ - --hash=sha256:6f50601512a3d23625d8a85b1638d914a0970f17920ff39cec63aaef80a93fb7 \ - --hash=sha256:7403941f6d0992d40161aa8bb23e12575637008a5a02283a930addc0508982f9 \ - --hash=sha256:755f3aee41354ae395e104d62119cb223339a8f3276a0cd009ffabfcdd46bb0c \ - --hash=sha256:77053d28427a29987ca9caf7b72ccafee011257561259faba8dd308fda9a8739 \ - --hash=sha256:7e371f10abe57cee5021797126c93479f59fccc9693dafd6bd5633ab67808a91 \ - --hash=sha256:9016d01c91e8e625141d24ec1b20fed584703e527d28512aa8c8707f105a683c \ - --hash=sha256:9be73ad47579abc26c12024239d3540e6b765182a91dbc88e23658ab71767153 \ - --hash=sha256:adc31566d027f45efe3f44eeb5b1f329da43891634d61c75a5944e9be6dd42c9 \ - --hash=sha256:adfc6cf69c7f8c50fd24c793964eef18f0ac321315439d94945820612849c388 \ - --hash=sha256:af0ebadc74e281a517141daad9d0f2c5d93ab78e9d455113719a45a49da9db4e \ - --hash=sha256:cb29edb9eab15742d791e1025dd7b6a8f6fcb53802ad2f6e3adcb102051063ab \ - --hash=sha256:cd68be2559e2a3b84f517fb029ee611546f7812b1fdd0aa2ecc9bc6ec0e4fdde \ - --hash=sha256:cdee09140e1cd184ba9324ec1df410e7147242b94b5f8b0c64fc89e38a8ba531 \ - --hash=sha256:db977c4ca738dd9ce508557d4fce0f5aebd105e158c725beec86feb1f6bc20d8 \ - --hash=sha256:dd5789b2948ca702c17027c84c2accb552fc30f4622a98ab5c51fcfe8c50d3e7 \ - --hash=sha256:e250a42f15bf9d5b09fe1b293bdba2801cd520a9f5ea2d7fb7536d4441811d20 \ - --hash=sha256:ff8d8fa42675249bb456f5db06c00de6c2f4c27a065955917b28c4f15978b9c3 +protobuf==3.20.2 \ + --hash=sha256:03d76b7bd42ac4a6e109742a4edf81ffe26ffd87c5993126d894fe48a120396a \ + --hash=sha256:09e25909c4297d71d97612f04f41cea8fa8510096864f2835ad2f3b3df5a5559 \ + --hash=sha256:18e34a10ae10d458b027d7638a599c964b030c1739ebd035a1dfc0e22baa3bfe \ + --hash=sha256:291fb4307094bf5ccc29f424b42268640e00d5240bf0d9b86bf3079f7576474d \ + --hash=sha256:2c0b040d0b5d5d207936ca2d02f00f765906622c07d3fa19c23a16a8ca71873f \ + --hash=sha256:384164994727f274cc34b8abd41a9e7e0562801361ee77437099ff6dfedd024b \ + --hash=sha256:3cb608e5a0eb61b8e00fe641d9f0282cd0eedb603be372f91f163cbfbca0ded0 \ + --hash=sha256:5d9402bf27d11e37801d1743eada54372f986a372ec9679673bfcc5c60441151 \ + --hash=sha256:712dca319eee507a1e7df3591e639a2b112a2f4a62d40fe7832a16fd19151750 \ + --hash=sha256:7a5037af4e76c975b88c3becdf53922b5ffa3f2cddf657574a4920a3b33b80f3 \ + --hash=sha256:8228e56a865c27163d5d1d1771d94b98194aa6917bcfb6ce139cbfa8e3c27334 \ + --hash=sha256:84a1544252a933ef07bb0b5ef13afe7c36232a774affa673fc3636f7cee1db6c \ + --hash=sha256:84fe5953b18a383fd4495d375fe16e1e55e0a3afe7b4f7b4d01a3a0649fcda9d \ + --hash=sha256:9c673c8bfdf52f903081816b9e0e612186684f4eb4c17eeb729133022d6032e3 \ + --hash=sha256:9f876a69ca55aed879b43c295a328970306e8e80a263ec91cf6e9189243c613b \ + --hash=sha256:a9e5ae5a8e8985c67e8944c23035a0dff2c26b0f5070b2f55b217a1c33bbe8b1 \ + --hash=sha256:b4fdb29c5a7406e3f7ef176b2a7079baa68b5b854f364c21abe327bbeec01cdb \ + --hash=sha256:c184485e0dfba4dfd451c3bd348c2e685d6523543a0f91b9fd4ae90eb09e8422 \ + --hash=sha256:c9cdf251c582c16fd6a9f5e95836c90828d51b0069ad22f463761d27c6c19019 \ + --hash=sha256:e39cf61bb8582bda88cdfebc0db163b774e7e03364bbf9ce1ead13863e81e359 \ + --hash=sha256:e8fbc522303e09036c752a0afcc5c0603e917222d8bedc02813fd73b4b4ed804 \ + --hash=sha256:f34464ab1207114e73bba0794d1257c150a2b89b7a9faf504e00af7c9fd58978 \ + --hash=sha256:f52dabc96ca99ebd2169dadbe018824ebda08a795c7684a0b7d203a290f3adb0 # via # gcp-docuploader # gcp-releasetool diff --git a/setup.py b/setup.py index eccde45..cf8050d 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ dependencies = [ "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", - "protobuf >= 3.19.0, <5.0.0dev", + "protobuf >= 3.20.2, <5.0.0dev", "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", ] diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 75306b3..c52b1ed 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -8,4 +8,4 @@ google-api-core==1.32.0 proto-plus==1.22.0 grpc-google-iam-v1==0.12.4 -protobuf==3.19.0 +protobuf==3.20.2 From 9be7e91c400f6dc2f39cf19628a46166bd0c1015 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 20:49:51 -0400 Subject: [PATCH 20/73] chore(main): release 1.5.2 (#200) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c90ceec..8d67e58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.5.2](https://github.com/googleapis/python-appengine-admin/compare/v1.5.1...v1.5.2) (2022-09-29) + + +### Bug Fixes + +* **deps:** Require protobuf >= 3.20.2 ([#199](https://github.com/googleapis/python-appengine-admin/issues/199)) ([dcadfa9](https://github.com/googleapis/python-appengine-admin/commit/dcadfa97388ec350a026436e644bf7d4024549a3)) + ## [1.5.1](https://github.com/googleapis/python-appengine-admin/compare/v1.5.0...v1.5.1) (2022-08-11) diff --git a/setup.py b/setup.py index cf8050d..a283491 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.5.1" +version = "1.5.2" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From be0879490e5bc6a61756e17d71d7c51f4742a19f Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 7 Oct 2022 17:57:14 -0400 Subject: [PATCH 21/73] fix(deps): allow protobuf 3.19.5 (#201) * fix(deps): allow protobuf 3.19.5 * explicitly exclude protobuf 4.21.0 --- setup.py | 2 +- testing/constraints-3.7.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a283491..a19d38c 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ dependencies = [ "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", - "protobuf >= 3.20.2, <5.0.0dev", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", ] diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index c52b1ed..fb33557 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -8,4 +8,4 @@ google-api-core==1.32.0 proto-plus==1.22.0 grpc-google-iam-v1==0.12.4 -protobuf==3.20.2 +protobuf==3.19.5 From a85ebaa24fd7d4b7921c1a600ccad262e919777b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 10 Oct 2022 12:03:59 -0400 Subject: [PATCH 22/73] chore(main): release 1.5.3 (#202) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d67e58..a7f0611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.5.3](https://github.com/googleapis/python-appengine-admin/compare/v1.5.2...v1.5.3) (2022-10-07) + + +### Bug Fixes + +* **deps:** Allow protobuf 3.19.5 ([#201](https://github.com/googleapis/python-appengine-admin/issues/201)) ([be08794](https://github.com/googleapis/python-appengine-admin/commit/be0879490e5bc6a61756e17d71d7c51f4742a19f)) + ## [1.5.2](https://github.com/googleapis/python-appengine-admin/compare/v1.5.1...v1.5.2) (2022-09-29) diff --git a/setup.py b/setup.py index a19d38c..753c20e 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.5.2" +version = "1.5.3" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 06b776cfca555ab3e71c506b4e420bc30428260c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 02:04:12 +0000 Subject: [PATCH 23/73] chore(python): update dependencies in .kokoro/requirements.txt [autoapprove] (#204) Source-Link: https://togithub.com/googleapis/synthtool/commit/e3a1277ac35fc88c09db1930533e24292b132ced Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:452901c74a22f9b9a3bd02bce780b8e8805c97270d424684bff809ce5be8c2a2 --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.txt | 325 +++++++++++++++++++++----------------- noxfile.py | 11 +- 3 files changed, 187 insertions(+), 151 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 3815c98..12edee7 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:7a40313731a7cb1454eef6b33d3446ebb121836738dc3ab3d2d3ded5268c35b6 + digest: sha256:452901c74a22f9b9a3bd02bce780b8e8805c97270d424684bff809ce5be8c2a2 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index d15994b..31425f1 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -20,9 +20,9 @@ cachetools==5.2.0 \ --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db # via google-auth -certifi==2022.6.15 \ - --hash=sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d \ - --hash=sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412 +certifi==2022.9.24 \ + --hash=sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14 \ + --hash=sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382 # via requests cffi==1.15.1 \ --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ @@ -110,29 +110,33 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==37.0.4 \ - --hash=sha256:190f82f3e87033821828f60787cfa42bff98404483577b591429ed99bed39d59 \ - --hash=sha256:2be53f9f5505673eeda5f2736bea736c40f051a739bfae2f92d18aed1eb54596 \ - --hash=sha256:30788e070800fec9bbcf9faa71ea6d8068f5136f60029759fd8c3efec3c9dcb3 \ - --hash=sha256:3d41b965b3380f10e4611dbae366f6dc3cefc7c9ac4e8842a806b9672ae9add5 \ - --hash=sha256:4c590ec31550a724ef893c50f9a97a0c14e9c851c85621c5650d699a7b88f7ab \ - --hash=sha256:549153378611c0cca1042f20fd9c5030d37a72f634c9326e225c9f666d472884 \ - --hash=sha256:63f9c17c0e2474ccbebc9302ce2f07b55b3b3fcb211ded18a42d5764f5c10a82 \ - --hash=sha256:6bc95ed67b6741b2607298f9ea4932ff157e570ef456ef7ff0ef4884a134cc4b \ - --hash=sha256:7099a8d55cd49b737ffc99c17de504f2257e3787e02abe6d1a6d136574873441 \ - --hash=sha256:75976c217f10d48a8b5a8de3d70c454c249e4b91851f6838a4e48b8f41eb71aa \ - --hash=sha256:7bc997818309f56c0038a33b8da5c0bfbb3f1f067f315f9abd6fc07ad359398d \ - --hash=sha256:80f49023dd13ba35f7c34072fa17f604d2f19bf0989f292cedf7ab5770b87a0b \ - --hash=sha256:91ce48d35f4e3d3f1d83e29ef4a9267246e6a3be51864a5b7d2247d5086fa99a \ - --hash=sha256:a958c52505c8adf0d3822703078580d2c0456dd1d27fabfb6f76fe63d2971cd6 \ - --hash=sha256:b62439d7cd1222f3da897e9a9fe53bbf5c104fff4d60893ad1355d4c14a24157 \ - --hash=sha256:b7f8dd0d4c1f21759695c05a5ec8536c12f31611541f8904083f3dc582604280 \ - --hash=sha256:d204833f3c8a33bbe11eda63a54b1aad7aa7456ed769a982f21ec599ba5fa282 \ - --hash=sha256:e007f052ed10cc316df59bc90fbb7ff7950d7e2919c9757fd42a2b8ecf8a5f67 \ - --hash=sha256:f2dcb0b3b63afb6df7fd94ec6fbddac81b5492513f7b0436210d390c14d46ee8 \ - --hash=sha256:f721d1885ecae9078c3f6bbe8a88bc0786b6e749bf32ccec1ef2b18929a05046 \ - --hash=sha256:f7a6de3e98771e183645181b3627e2563dcde3ce94a9e42a3f427d2255190327 \ - --hash=sha256:f8c0a6e9e1dd3eb0414ba320f85da6b0dcbd543126e30fcc546e7372a7fbf3b9 +cryptography==38.0.3 \ + --hash=sha256:068147f32fa662c81aebab95c74679b401b12b57494872886eb5c1139250ec5d \ + --hash=sha256:06fc3cc7b6f6cca87bd56ec80a580c88f1da5306f505876a71c8cfa7050257dd \ + --hash=sha256:25c1d1f19729fb09d42e06b4bf9895212292cb27bb50229f5aa64d039ab29146 \ + --hash=sha256:402852a0aea73833d982cabb6d0c3bb582c15483d29fb7085ef2c42bfa7e38d7 \ + --hash=sha256:4e269dcd9b102c5a3d72be3c45d8ce20377b8076a43cbed6f660a1afe365e436 \ + --hash=sha256:5419a127426084933076132d317911e3c6eb77568a1ce23c3ac1e12d111e61e0 \ + --hash=sha256:554bec92ee7d1e9d10ded2f7e92a5d70c1f74ba9524947c0ba0c850c7b011828 \ + --hash=sha256:5e89468fbd2fcd733b5899333bc54d0d06c80e04cd23d8c6f3e0542358c6060b \ + --hash=sha256:65535bc550b70bd6271984d9863a37741352b4aad6fb1b3344a54e6950249b55 \ + --hash=sha256:6ab9516b85bebe7aa83f309bacc5f44a61eeb90d0b4ec125d2d003ce41932d36 \ + --hash=sha256:6addc3b6d593cd980989261dc1cce38263c76954d758c3c94de51f1e010c9a50 \ + --hash=sha256:728f2694fa743a996d7784a6194da430f197d5c58e2f4e278612b359f455e4a2 \ + --hash=sha256:785e4056b5a8b28f05a533fab69febf5004458e20dad7e2e13a3120d8ecec75a \ + --hash=sha256:78cf5eefac2b52c10398a42765bfa981ce2372cbc0457e6bf9658f41ec3c41d8 \ + --hash=sha256:7f836217000342d448e1c9a342e9163149e45d5b5eca76a30e84503a5a96cab0 \ + --hash=sha256:8d41a46251bf0634e21fac50ffd643216ccecfaf3701a063257fe0b2be1b6548 \ + --hash=sha256:984fe150f350a3c91e84de405fe49e688aa6092b3525f407a18b9646f6612320 \ + --hash=sha256:9b24bcff7853ed18a63cfb0c2b008936a9554af24af2fb146e16d8e1aed75748 \ + --hash=sha256:b1b35d9d3a65542ed2e9d90115dfd16bbc027b3f07ee3304fc83580f26e43249 \ + --hash=sha256:b1b52c9e5f8aa2b802d48bd693190341fae201ea51c7a167d69fc48b60e8a959 \ + --hash=sha256:bbf203f1a814007ce24bd4d51362991d5cb90ba0c177a9c08825f2cc304d871f \ + --hash=sha256:be243c7e2bfcf6cc4cb350c0d5cdf15ca6383bbcb2a8ef51d3c9411a9d4386f0 \ + --hash=sha256:bfbe6ee19615b07a98b1d2287d6a6073f734735b49ee45b11324d85efc4d5cbd \ + --hash=sha256:c46837ea467ed1efea562bbeb543994c2d1f6e800785bd5a2c98bc096f5cb220 \ + --hash=sha256:dfb4f4dd568de1b6af9f4cda334adf7d72cf5bc052516e1b2608b683375dd95c \ + --hash=sha256:ed7b00096790213e09eb11c97cc6e2b757f15f3d2f85833cd2d3ec3fe37c1722 # via # gcp-releasetool # secretstorage @@ -148,23 +152,23 @@ filelock==3.8.0 \ --hash=sha256:55447caa666f2198c5b6b13a26d2084d26fa5b115c00d065664b2124680c4edc \ --hash=sha256:617eb4e5eedc82fc5f47b6d61e4d11cb837c56cb4544e39081099fa17ad109d4 # via virtualenv -gcp-docuploader==0.6.3 \ - --hash=sha256:ba8c9d76b3bbac54b0311c503a373b00edc2dc02d6d54ea9507045adb8e870f7 \ - --hash=sha256:c0f5aaa82ce1854a386197e4e359b120ad6d4e57ae2c812fce42219a3288026b +gcp-docuploader==0.6.4 \ + --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ + --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf # via -r requirements.in -gcp-releasetool==1.8.7 \ - --hash=sha256:3d2a67c9db39322194afb3b427e9cb0476ce8f2a04033695f0aeb63979fc2b37 \ - --hash=sha256:5e4d28f66e90780d77f3ecf1e9155852b0c3b13cbccb08ab07e66b2357c8da8d +gcp-releasetool==1.9.1 \ + --hash=sha256:952f4055d5d986b070ae2a71c4410b250000f9cc5a1e26398fcd55a5bbc5a15f \ + --hash=sha256:d0d3c814a97c1a237517e837d8cfa668ced8df4b882452578ecef4a4e79c583b # via -r requirements.in -google-api-core==2.8.2 \ - --hash=sha256:06f7244c640322b508b125903bb5701bebabce8832f85aba9335ec00b3d02edc \ - --hash=sha256:93c6a91ccac79079ac6bbf8b74ee75db970cc899278b97d53bc012f35908cf50 +google-api-core==2.10.2 \ + --hash=sha256:10c06f7739fe57781f87523375e8e1a3a4674bf6392cd6131a3222182b971320 \ + --hash=sha256:34f24bd1d5f72a8c4519773d99ca6bf080a6c4e041b4e9f024fe230191dda62e # via # google-cloud-core # google-cloud-storage -google-auth==2.11.0 \ - --hash=sha256:be62acaae38d0049c21ca90f27a23847245c9f161ff54ede13af2cb6afecbac9 \ - --hash=sha256:ed65ecf9f681832298e29328e1ef0a3676e3732b2e56f41532d45f70a22de0fb +google-auth==2.14.0 \ + --hash=sha256:1ad5b0e6eba5f69645971abb3d2c197537d5914070a8c6d30299dfdb07c5c700 \ + --hash=sha256:cf24817855d874ede2efd071aa22125445f555de1685b739a9782fcf408c2a3d # via # gcp-releasetool # google-api-core @@ -178,72 +182,97 @@ google-cloud-storage==2.5.0 \ --hash=sha256:19a26c66c317ce542cea0830b7e787e8dac2588b6bfa4d3fd3b871ba16305ab0 \ --hash=sha256:382f34b91de2212e3c2e7b40ec079d27ee2e3dbbae99b75b1bcd8c63063ce235 # via gcp-docuploader -google-crc32c==1.3.0 \ - --hash=sha256:04e7c220798a72fd0f08242bc8d7a05986b2a08a0573396187fd32c1dcdd58b3 \ - --hash=sha256:05340b60bf05b574159e9bd940152a47d38af3fb43803ffe71f11d704b7696a6 \ - --hash=sha256:12674a4c3b56b706153a358eaa1018c4137a5a04635b92b4652440d3d7386206 \ - --hash=sha256:127f9cc3ac41b6a859bd9dc4321097b1a4f6aa7fdf71b4f9227b9e3ebffb4422 \ - --hash=sha256:13af315c3a0eec8bb8b8d80b8b128cb3fcd17d7e4edafc39647846345a3f003a \ - --hash=sha256:1926fd8de0acb9d15ee757175ce7242e235482a783cd4ec711cc999fc103c24e \ - --hash=sha256:226f2f9b8e128a6ca6a9af9b9e8384f7b53a801907425c9a292553a3a7218ce0 \ - --hash=sha256:276de6273eb074a35bc598f8efbc00c7869c5cf2e29c90748fccc8c898c244df \ - --hash=sha256:318f73f5484b5671f0c7f5f63741ab020a599504ed81d209b5c7129ee4667407 \ - --hash=sha256:3bbce1be3687bbfebe29abdb7631b83e6b25da3f4e1856a1611eb21854b689ea \ - --hash=sha256:42ae4781333e331a1743445931b08ebdad73e188fd554259e772556fc4937c48 \ - --hash=sha256:58be56ae0529c664cc04a9c76e68bb92b091e0194d6e3c50bea7e0f266f73713 \ - --hash=sha256:5da2c81575cc3ccf05d9830f9e8d3c70954819ca9a63828210498c0774fda1a3 \ - --hash=sha256:6311853aa2bba4064d0c28ca54e7b50c4d48e3de04f6770f6c60ebda1e975267 \ - --hash=sha256:650e2917660e696041ab3dcd7abac160b4121cd9a484c08406f24c5964099829 \ - --hash=sha256:6a4db36f9721fdf391646685ecffa404eb986cbe007a3289499020daf72e88a2 \ - --hash=sha256:779cbf1ce375b96111db98fca913c1f5ec11b1d870e529b1dc7354b2681a8c3a \ - --hash=sha256:7f6fe42536d9dcd3e2ffb9d3053f5d05221ae3bbcefbe472bdf2c71c793e3183 \ - --hash=sha256:891f712ce54e0d631370e1f4997b3f182f3368179198efc30d477c75d1f44942 \ - --hash=sha256:95c68a4b9b7828ba0428f8f7e3109c5d476ca44996ed9a5f8aac6269296e2d59 \ - --hash=sha256:96a8918a78d5d64e07c8ea4ed2bc44354e3f93f46a4866a40e8db934e4c0d74b \ - --hash=sha256:9c3cf890c3c0ecfe1510a452a165431b5831e24160c5fcf2071f0f85ca5a47cd \ - --hash=sha256:9f58099ad7affc0754ae42e6d87443299f15d739b0ce03c76f515153a5cda06c \ - --hash=sha256:a0b9e622c3b2b8d0ce32f77eba617ab0d6768b82836391e4f8f9e2074582bf02 \ - --hash=sha256:a7f9cbea4245ee36190f85fe1814e2d7b1e5f2186381b082f5d59f99b7f11328 \ - --hash=sha256:bab4aebd525218bab4ee615786c4581952eadc16b1ff031813a2fd51f0cc7b08 \ - --hash=sha256:c124b8c8779bf2d35d9b721e52d4adb41c9bfbde45e6a3f25f0820caa9aba73f \ - --hash=sha256:c9da0a39b53d2fab3e5467329ed50e951eb91386e9d0d5b12daf593973c3b168 \ - --hash=sha256:ca60076c388728d3b6ac3846842474f4250c91efbfe5afa872d3ffd69dd4b318 \ - --hash=sha256:cb6994fff247987c66a8a4e550ef374671c2b82e3c0d2115e689d21e511a652d \ - --hash=sha256:d1c1d6236feab51200272d79b3d3e0f12cf2cbb12b208c835b175a21efdb0a73 \ - --hash=sha256:dd7760a88a8d3d705ff562aa93f8445ead54f58fd482e4f9e2bafb7e177375d4 \ - --hash=sha256:dda4d8a3bb0b50f540f6ff4b6033f3a74e8bf0bd5320b70fab2c03e512a62812 \ - --hash=sha256:e0f1ff55dde0ebcfbef027edc21f71c205845585fffe30d4ec4979416613e9b3 \ - --hash=sha256:e7a539b9be7b9c00f11ef16b55486141bc2cdb0c54762f84e3c6fc091917436d \ - --hash=sha256:eb0b14523758e37802f27b7f8cd973f5f3d33be7613952c0df904b68c4842f0e \ - --hash=sha256:ed447680ff21c14aaceb6a9f99a5f639f583ccfe4ce1a5e1d48eb41c3d6b3217 \ - --hash=sha256:f52a4ad2568314ee713715b1e2d79ab55fab11e8b304fd1462ff5cccf4264b3e \ - --hash=sha256:fbd60c6aaa07c31d7754edbc2334aef50601b7f1ada67a96eb1eb57c7c72378f \ - --hash=sha256:fc28e0db232c62ca0c3600884933178f0825c99be4474cdd645e378a10588125 \ - --hash=sha256:fe31de3002e7b08eb20823b3735b97c86c5926dd0581c7710a680b418a8709d4 \ - --hash=sha256:fec221a051150eeddfdfcff162e6db92c65ecf46cb0f7bb1bf812a1520ec026b \ - --hash=sha256:ff71073ebf0e42258a42a0b34f2c09ec384977e7f6808999102eedd5b49920e3 +google-crc32c==1.5.0 \ + --hash=sha256:024894d9d3cfbc5943f8f230e23950cd4906b2fe004c72e29b209420a1e6b05a \ + --hash=sha256:02c65b9817512edc6a4ae7c7e987fea799d2e0ee40c53ec573a692bee24de876 \ + --hash=sha256:02ebb8bf46c13e36998aeaad1de9b48f4caf545e91d14041270d9dca767b780c \ + --hash=sha256:07eb3c611ce363c51a933bf6bd7f8e3878a51d124acfc89452a75120bc436289 \ + --hash=sha256:1034d91442ead5a95b5aaef90dbfaca8633b0247d1e41621d1e9f9db88c36298 \ + --hash=sha256:116a7c3c616dd14a3de8c64a965828b197e5f2d121fedd2f8c5585c547e87b02 \ + --hash=sha256:19e0a019d2c4dcc5e598cd4a4bc7b008546b0358bd322537c74ad47a5386884f \ + --hash=sha256:1c7abdac90433b09bad6c43a43af253e688c9cfc1c86d332aed13f9a7c7f65e2 \ + --hash=sha256:1e986b206dae4476f41bcec1faa057851f3889503a70e1bdb2378d406223994a \ + --hash=sha256:272d3892a1e1a2dbc39cc5cde96834c236d5327e2122d3aaa19f6614531bb6eb \ + --hash=sha256:278d2ed7c16cfc075c91378c4f47924c0625f5fc84b2d50d921b18b7975bd210 \ + --hash=sha256:2ad40e31093a4af319dadf503b2467ccdc8f67c72e4bcba97f8c10cb078207b5 \ + --hash=sha256:2e920d506ec85eb4ba50cd4228c2bec05642894d4c73c59b3a2fe20346bd00ee \ + --hash=sha256:3359fc442a743e870f4588fcf5dcbc1bf929df1fad8fb9905cd94e5edb02e84c \ + --hash=sha256:37933ec6e693e51a5b07505bd05de57eee12f3e8c32b07da7e73669398e6630a \ + --hash=sha256:398af5e3ba9cf768787eef45c803ff9614cc3e22a5b2f7d7ae116df8b11e3314 \ + --hash=sha256:3b747a674c20a67343cb61d43fdd9207ce5da6a99f629c6e2541aa0e89215bcd \ + --hash=sha256:461665ff58895f508e2866824a47bdee72497b091c730071f2b7575d5762ab65 \ + --hash=sha256:4c6fdd4fccbec90cc8a01fc00773fcd5fa28db683c116ee3cb35cd5da9ef6c37 \ + --hash=sha256:5829b792bf5822fd0a6f6eb34c5f81dd074f01d570ed7f36aa101d6fc7a0a6e4 \ + --hash=sha256:596d1f98fc70232fcb6590c439f43b350cb762fb5d61ce7b0e9db4539654cc13 \ + --hash=sha256:5ae44e10a8e3407dbe138984f21e536583f2bba1be9491239f942c2464ac0894 \ + --hash=sha256:635f5d4dd18758a1fbd1049a8e8d2fee4ffed124462d837d1a02a0e009c3ab31 \ + --hash=sha256:64e52e2b3970bd891309c113b54cf0e4384762c934d5ae56e283f9a0afcd953e \ + --hash=sha256:66741ef4ee08ea0b2cc3c86916ab66b6aef03768525627fd6a1b34968b4e3709 \ + --hash=sha256:67b741654b851abafb7bc625b6d1cdd520a379074e64b6a128e3b688c3c04740 \ + --hash=sha256:6ac08d24c1f16bd2bf5eca8eaf8304812f44af5cfe5062006ec676e7e1d50afc \ + --hash=sha256:6f998db4e71b645350b9ac28a2167e6632c239963ca9da411523bb439c5c514d \ + --hash=sha256:72218785ce41b9cfd2fc1d6a017dc1ff7acfc4c17d01053265c41a2c0cc39b8c \ + --hash=sha256:74dea7751d98034887dbd821b7aae3e1d36eda111d6ca36c206c44478035709c \ + --hash=sha256:759ce4851a4bb15ecabae28f4d2e18983c244eddd767f560165563bf9aefbc8d \ + --hash=sha256:77e2fd3057c9d78e225fa0a2160f96b64a824de17840351b26825b0848022906 \ + --hash=sha256:7c074fece789b5034b9b1404a1f8208fc2d4c6ce9decdd16e8220c5a793e6f61 \ + --hash=sha256:7c42c70cd1d362284289c6273adda4c6af8039a8ae12dc451dcd61cdabb8ab57 \ + --hash=sha256:7f57f14606cd1dd0f0de396e1e53824c371e9544a822648cd76c034d209b559c \ + --hash=sha256:83c681c526a3439b5cf94f7420471705bbf96262f49a6fe546a6db5f687a3d4a \ + --hash=sha256:8485b340a6a9e76c62a7dce3c98e5f102c9219f4cfbf896a00cf48caf078d438 \ + --hash=sha256:84e6e8cd997930fc66d5bb4fde61e2b62ba19d62b7abd7a69920406f9ecca946 \ + --hash=sha256:89284716bc6a5a415d4eaa11b1726d2d60a0cd12aadf5439828353662ede9dd7 \ + --hash=sha256:8b87e1a59c38f275c0e3676fc2ab6d59eccecfd460be267ac360cc31f7bcde96 \ + --hash=sha256:8f24ed114432de109aa9fd317278518a5af2d31ac2ea6b952b2f7782b43da091 \ + --hash=sha256:98cb4d057f285bd80d8778ebc4fde6b4d509ac3f331758fb1528b733215443ae \ + --hash=sha256:998679bf62b7fb599d2878aa3ed06b9ce688b8974893e7223c60db155f26bd8d \ + --hash=sha256:9ba053c5f50430a3fcfd36f75aff9caeba0440b2d076afdb79a318d6ca245f88 \ + --hash=sha256:9c99616c853bb585301df6de07ca2cadad344fd1ada6d62bb30aec05219c45d2 \ + --hash=sha256:a1fd716e7a01f8e717490fbe2e431d2905ab8aa598b9b12f8d10abebb36b04dd \ + --hash=sha256:a2355cba1f4ad8b6988a4ca3feed5bff33f6af2d7f134852cf279c2aebfde541 \ + --hash=sha256:b1f8133c9a275df5613a451e73f36c2aea4fe13c5c8997e22cf355ebd7bd0728 \ + --hash=sha256:b8667b48e7a7ef66afba2c81e1094ef526388d35b873966d8a9a447974ed9178 \ + --hash=sha256:ba1eb1843304b1e5537e1fca632fa894d6f6deca8d6389636ee5b4797affb968 \ + --hash=sha256:be82c3c8cfb15b30f36768797a640e800513793d6ae1724aaaafe5bf86f8f346 \ + --hash=sha256:c02ec1c5856179f171e032a31d6f8bf84e5a75c45c33b2e20a3de353b266ebd8 \ + --hash=sha256:c672d99a345849301784604bfeaeba4db0c7aae50b95be04dd651fd2a7310b93 \ + --hash=sha256:c6c777a480337ac14f38564ac88ae82d4cd238bf293f0a22295b66eb89ffced7 \ + --hash=sha256:cae0274952c079886567f3f4f685bcaf5708f0a23a5f5216fdab71f81a6c0273 \ + --hash=sha256:cd67cf24a553339d5062eff51013780a00d6f97a39ca062781d06b3a73b15462 \ + --hash=sha256:d3515f198eaa2f0ed49f8819d5732d70698c3fa37384146079b3799b97667a94 \ + --hash=sha256:d5280312b9af0976231f9e317c20e4a61cd2f9629b7bfea6a693d1878a264ebd \ + --hash=sha256:de06adc872bcd8c2a4e0dc51250e9e65ef2ca91be023b9d13ebd67c2ba552e1e \ + --hash=sha256:e1674e4307fa3024fc897ca774e9c7562c957af85df55efe2988ed9056dc4e57 \ + --hash=sha256:e2096eddb4e7c7bdae4bd69ad364e55e07b8316653234a56552d9c988bd2d61b \ + --hash=sha256:e560628513ed34759456a416bf86b54b2476c59144a9138165c9a1575801d0d9 \ + --hash=sha256:edfedb64740750e1a3b16152620220f51d58ff1b4abceb339ca92e934775c27a \ + --hash=sha256:f13cae8cc389a440def0c8c52057f37359014ccbc9dc1f0827936bcd367c6100 \ + --hash=sha256:f314013e7dcd5cf45ab1945d92e713eec788166262ae8deb2cfacd53def27325 \ + --hash=sha256:f583edb943cf2e09c60441b910d6a20b4d9d626c75a36c8fcac01a6c96c01183 \ + --hash=sha256:fd8536e902db7e365f49e7d9029283403974ccf29b13fc7028b97e2295b33556 \ + --hash=sha256:fe70e325aa68fa4b5edf7d1a4b6f691eb04bbccac0ace68e34820d283b5f80d4 # via google-resumable-media -google-resumable-media==2.3.3 \ - --hash=sha256:27c52620bd364d1c8116eaac4ea2afcbfb81ae9139fb3199652fcac1724bfb6c \ - --hash=sha256:5b52774ea7a829a8cdaa8bd2d4c3d4bc660c91b30857ab2668d0eb830f4ea8c5 +google-resumable-media==2.4.0 \ + --hash=sha256:2aa004c16d295c8f6c33b2b4788ba59d366677c0a25ae7382436cb30f776deaa \ + --hash=sha256:8d5518502f92b9ecc84ac46779bd4f09694ecb3ba38a3e7ca737a86d15cbca1f # via google-cloud-storage googleapis-common-protos==1.56.4 \ --hash=sha256:8eb2cbc91b69feaf23e32452a7ae60e791e09967d81d4fcc7fc388182d1bd394 \ --hash=sha256:c25873c47279387cfdcbdafa36149887901d36202cb645a0e4f29686bf6e4417 # via google-api-core -idna==3.3 \ - --hash=sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff \ - --hash=sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d +idna==3.4 \ + --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ + --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 # via requests -importlib-metadata==4.12.0 \ - --hash=sha256:637245b8bab2b6502fcbc752cc4b7a6f6243bb02b31c5c26156ad103d3d45670 \ - --hash=sha256:7401a975809ea1fdc658c3aa4f78cc2195a0e019c5cbc4c06122884e9ae80c23 +importlib-metadata==5.0.0 \ + --hash=sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab \ + --hash=sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43 # via # -r requirements.in # twine -jaraco-classes==3.2.2 \ - --hash=sha256:6745f113b0b588239ceb49532aa09c3ebb947433ce311ef2f8e3ad64ebb74594 \ - --hash=sha256:e6ef6fd3fcf4579a7a019d87d1e56a883f4e4c35cfe925f86731abc58804e647 +jaraco-classes==3.2.3 \ + --hash=sha256:2353de3288bc6b82120752201c6b1c1a14b058267fa424ed5ce5984e3b922158 \ + --hash=sha256:89559fa5c1d3c34eff6f631ad80bb21f378dbcbb35dd161fd2c6b93f5be2f98a # via keyring jeepney==0.8.0 \ --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ @@ -255,9 +284,9 @@ jinja2==3.1.2 \ --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 # via gcp-releasetool -keyring==23.9.0 \ - --hash=sha256:4c32a31174faaee48f43a7e2c7e9c3216ec5e95acf22a2bebfb4a1d05056ee44 \ - --hash=sha256:98f060ec95ada2ab910c195a2d4317be6ef87936a766b239c46aa3c7aac4f0db +keyring==23.9.3 \ + --hash=sha256:69732a15cb1433bdfbc3b980a8a36a04878a6cfd7cb99f497b573f31618001c0 \ + --hash=sha256:69b01dd83c42f590250fe7a1f503fc229b14de83857314b1933a3ddbf595c4a5 # via # gcp-releasetool # twine @@ -303,9 +332,9 @@ markupsafe==2.1.1 \ --hash=sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a \ --hash=sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7 # via jinja2 -more-itertools==8.14.0 \ - --hash=sha256:1bc4f91ee5b1b31ac7ceacc17c09befe6a40a503907baf9c839c229b5095cfd2 \ - --hash=sha256:c09443cd3d5438b8dafccd867a6bc1cb0894389e90cb53d227456b0b0bccb750 +more-itertools==9.0.0 \ + --hash=sha256:250e83d7e81d0c87ca6bd942e6aeab8cc9daa6096d12c5308f3f92fa5e5c1f41 \ + --hash=sha256:5a6257e40878ef0520b1803990e3e22303a41b5714006c32a3fd8304b26ea1ab # via jaraco-classes nox==2022.8.7 \ --hash=sha256:1b894940551dc5c389f9271d197ca5d655d40bdc6ccf93ed6880e4042760a34b \ @@ -325,34 +354,34 @@ platformdirs==2.5.2 \ --hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 \ --hash=sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19 # via virtualenv -protobuf==3.20.2 \ - --hash=sha256:03d76b7bd42ac4a6e109742a4edf81ffe26ffd87c5993126d894fe48a120396a \ - --hash=sha256:09e25909c4297d71d97612f04f41cea8fa8510096864f2835ad2f3b3df5a5559 \ - --hash=sha256:18e34a10ae10d458b027d7638a599c964b030c1739ebd035a1dfc0e22baa3bfe \ - --hash=sha256:291fb4307094bf5ccc29f424b42268640e00d5240bf0d9b86bf3079f7576474d \ - --hash=sha256:2c0b040d0b5d5d207936ca2d02f00f765906622c07d3fa19c23a16a8ca71873f \ - --hash=sha256:384164994727f274cc34b8abd41a9e7e0562801361ee77437099ff6dfedd024b \ - --hash=sha256:3cb608e5a0eb61b8e00fe641d9f0282cd0eedb603be372f91f163cbfbca0ded0 \ - --hash=sha256:5d9402bf27d11e37801d1743eada54372f986a372ec9679673bfcc5c60441151 \ - --hash=sha256:712dca319eee507a1e7df3591e639a2b112a2f4a62d40fe7832a16fd19151750 \ - --hash=sha256:7a5037af4e76c975b88c3becdf53922b5ffa3f2cddf657574a4920a3b33b80f3 \ - --hash=sha256:8228e56a865c27163d5d1d1771d94b98194aa6917bcfb6ce139cbfa8e3c27334 \ - --hash=sha256:84a1544252a933ef07bb0b5ef13afe7c36232a774affa673fc3636f7cee1db6c \ - --hash=sha256:84fe5953b18a383fd4495d375fe16e1e55e0a3afe7b4f7b4d01a3a0649fcda9d \ - --hash=sha256:9c673c8bfdf52f903081816b9e0e612186684f4eb4c17eeb729133022d6032e3 \ - --hash=sha256:9f876a69ca55aed879b43c295a328970306e8e80a263ec91cf6e9189243c613b \ - --hash=sha256:a9e5ae5a8e8985c67e8944c23035a0dff2c26b0f5070b2f55b217a1c33bbe8b1 \ - --hash=sha256:b4fdb29c5a7406e3f7ef176b2a7079baa68b5b854f364c21abe327bbeec01cdb \ - --hash=sha256:c184485e0dfba4dfd451c3bd348c2e685d6523543a0f91b9fd4ae90eb09e8422 \ - --hash=sha256:c9cdf251c582c16fd6a9f5e95836c90828d51b0069ad22f463761d27c6c19019 \ - --hash=sha256:e39cf61bb8582bda88cdfebc0db163b774e7e03364bbf9ce1ead13863e81e359 \ - --hash=sha256:e8fbc522303e09036c752a0afcc5c0603e917222d8bedc02813fd73b4b4ed804 \ - --hash=sha256:f34464ab1207114e73bba0794d1257c150a2b89b7a9faf504e00af7c9fd58978 \ - --hash=sha256:f52dabc96ca99ebd2169dadbe018824ebda08a795c7684a0b7d203a290f3adb0 +protobuf==3.20.3 \ + --hash=sha256:03038ac1cfbc41aa21f6afcbcd357281d7521b4157926f30ebecc8d4ea59dcb7 \ + --hash=sha256:28545383d61f55b57cf4df63eebd9827754fd2dc25f80c5253f9184235db242c \ + --hash=sha256:2e3427429c9cffebf259491be0af70189607f365c2f41c7c3764af6f337105f2 \ + --hash=sha256:398a9e0c3eaceb34ec1aee71894ca3299605fa8e761544934378bbc6c97de23b \ + --hash=sha256:44246bab5dd4b7fbd3c0c80b6f16686808fab0e4aca819ade6e8d294a29c7050 \ + --hash=sha256:447d43819997825d4e71bf5769d869b968ce96848b6479397e29fc24c4a5dfe9 \ + --hash=sha256:67a3598f0a2dcbc58d02dd1928544e7d88f764b47d4a286202913f0b2801c2e7 \ + --hash=sha256:74480f79a023f90dc6e18febbf7b8bac7508420f2006fabd512013c0c238f454 \ + --hash=sha256:819559cafa1a373b7096a482b504ae8a857c89593cf3a25af743ac9ecbd23480 \ + --hash=sha256:899dc660cd599d7352d6f10d83c95df430a38b410c1b66b407a6b29265d66469 \ + --hash=sha256:8c0c984a1b8fef4086329ff8dd19ac77576b384079247c770f29cc8ce3afa06c \ + --hash=sha256:9aae4406ea63d825636cc11ffb34ad3379335803216ee3a856787bcf5ccc751e \ + --hash=sha256:a7ca6d488aa8ff7f329d4c545b2dbad8ac31464f1d8b1c87ad1346717731e4db \ + --hash=sha256:b6cc7ba72a8850621bfec987cb72623e703b7fe2b9127a161ce61e61558ad905 \ + --hash=sha256:bf01b5720be110540be4286e791db73f84a2b721072a3711efff6c324cdf074b \ + --hash=sha256:c02ce36ec760252242a33967d51c289fd0e1c0e6e5cc9397e2279177716add86 \ + --hash=sha256:d9e4432ff660d67d775c66ac42a67cf2453c27cb4d738fc22cb53b5d84c135d4 \ + --hash=sha256:daa564862dd0d39c00f8086f88700fdbe8bc717e993a21e90711acfed02f2402 \ + --hash=sha256:de78575669dddf6099a8a0f46a27e82a1783c557ccc38ee620ed8cc96d3be7d7 \ + --hash=sha256:e64857f395505ebf3d2569935506ae0dfc4a15cb80dc25261176c784662cdcc4 \ + --hash=sha256:f4bd856d702e5b0d96a00ec6b307b0f51c1982c2bf9c0052cf9019e9a544ba99 \ + --hash=sha256:f4c42102bc82a51108e449cbb32b19b180022941c727bac0cfd50170341f16ee # via # gcp-docuploader # gcp-releasetool # google-api-core + # googleapis-common-protos py==1.11.0 \ --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 @@ -377,9 +406,9 @@ pygments==2.13.0 \ # via # readme-renderer # rich -pyjwt==2.4.0 \ - --hash=sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf \ - --hash=sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba +pyjwt==2.6.0 \ + --hash=sha256:69285c7e31fc44f68a1feb309e948e0df53259d579295e6cfe2b1792329f05fd \ + --hash=sha256:d83c3d892a77bbb74d3e1a2cfa90afaadb60945205d1095d9221f04466f64c14 # via gcp-releasetool pyparsing==3.0.9 \ --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ @@ -392,9 +421,9 @@ python-dateutil==2.8.2 \ --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 # via gcp-releasetool -readme-renderer==37.0 \ - --hash=sha256:07b7ea234e03e58f77cc222e206e6abb8f4c0435becce5104794ee591f9301c5 \ - --hash=sha256:9fa416704703e509eeb900696751c908ddeb2011319d93700d8f18baff887a69 +readme-renderer==37.3 \ + --hash=sha256:cd653186dfc73055656f090f227f5cb22a046d7f71a841dfa305f55c9a513273 \ + --hash=sha256:f67a16caedfa71eef48a31b39708637a6f4664c4394801a7b0d6432d13907343 # via twine requests==2.28.1 \ --hash=sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983 \ @@ -405,17 +434,17 @@ requests==2.28.1 \ # google-cloud-storage # requests-toolbelt # twine -requests-toolbelt==0.9.1 \ - --hash=sha256:380606e1d10dc85c3bd47bf5a6095f815ec007be7a8b69c878507068df059e6f \ - --hash=sha256:968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0 +requests-toolbelt==0.10.1 \ + --hash=sha256:18565aa58116d9951ac39baa288d3adb5b3ff975c4f25eee78555d89e8f247f7 \ + --hash=sha256:62e09f7ff5ccbda92772a29f394a49c3ad6cb181d568b1337626b2abb628a63d # via twine rfc3986==2.0.0 \ --hash=sha256:50b1502b60e289cb37883f3dfd34532b8873c7de9f49bb546641ce9cbd256ebd \ --hash=sha256:97aacf9dbd4bfd829baad6e6309fa6573aaf1be3f6fa735c8ab05e46cecb261c # via twine -rich==12.5.1 \ - --hash=sha256:2eb4e6894cde1e017976d2975ac210ef515d7548bc595ba20e195fb9628acdeb \ - --hash=sha256:63a5c5ce3673d3d5fbbf23cd87e11ab84b6b451436f1b7f19ec54b6bc36ed7ca +rich==12.6.0 \ + --hash=sha256:a4eb26484f2c82589bd9a17c73d32a010b1e29d89f1604cd9bf3a2097b81bb5e \ + --hash=sha256:ba3a3775974105c221d31141f2c116f4fd65c5ceb0698657a11e9f295ec93fd0 # via twine rsa==4.9 \ --hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \ @@ -437,9 +466,9 @@ twine==4.0.1 \ --hash=sha256:42026c18e394eac3e06693ee52010baa5313e4811d5a11050e7d48436cf41b9e \ --hash=sha256:96b1cf12f7ae611a4a40b6ae8e9570215daff0611828f5fe1f37a16255ab24a0 # via -r requirements.in -typing-extensions==4.3.0 \ - --hash=sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02 \ - --hash=sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6 +typing-extensions==4.4.0 \ + --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ + --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e # via -r requirements.in urllib3==1.26.12 \ --hash=sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e \ @@ -447,9 +476,9 @@ urllib3==1.26.12 \ # via # requests # twine -virtualenv==20.16.4 \ - --hash=sha256:014f766e4134d0008dcaa1f95bafa0fb0f575795d07cae50b1bee514185d6782 \ - --hash=sha256:035ed57acce4ac35c82c9d8802202b0e71adac011a511ff650cbcf9635006a22 +virtualenv==20.16.6 \ + --hash=sha256:186ca84254abcbde98180fd17092f9628c5fe742273c02724972a1d8a2035108 \ + --hash=sha256:530b850b523c6449406dfba859d6345e48ef19b8439606c5d74d7d3c9e14d76e # via nox webencodings==0.5.1 \ --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ @@ -459,13 +488,13 @@ wheel==0.37.1 \ --hash=sha256:4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a \ --hash=sha256:e9a504e793efbca1b8e0e9cb979a249cf4a0a7b5b8c9e8b65a5e39d49529c1c4 # via -r requirements.in -zipp==3.8.1 \ - --hash=sha256:05b45f1ee8f807d0cc928485ca40a07cb491cf092ff587c0df9cb1fd154848d2 \ - --hash=sha256:47c40d7fe183a6f21403a199b3e4192cca5774656965b0a4988ad2f8feb5f009 +zipp==3.10.0 \ + --hash=sha256:4fcb6f278987a6605757302a6e40e896257570d11c51628968ccb2a47e80c6c1 \ + --hash=sha256:7a7262fd930bd3e36c50b9a64897aec3fafff3dfdeec9623ae22b40e93f99bb8 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -setuptools==65.2.0 \ - --hash=sha256:7f4bc85450898a09f76ebf28b72fa25bc7111f6c7d665d514a60bba9c75ef2a9 \ - --hash=sha256:a3ca5857c89f82f5c9410e8508cb32f4872a3bafd4aa7ae122a24ca33bccc750 +setuptools==65.5.0 \ + --hash=sha256:512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17 \ + --hash=sha256:f62ea9da9ed6289bfe868cd6845968a2c854d1427f8548d52cae02a42b4f0356 # via -r requirements.in diff --git a/noxfile.py b/noxfile.py index 5f898a7..35f3976 100644 --- a/noxfile.py +++ b/noxfile.py @@ -277,7 +277,11 @@ def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx==4.0.1", "alabaster", "recommonmark") + session.install( + "sphinx==4.0.1", + "alabaster", + "recommonmark", + ) shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( @@ -300,7 +304,10 @@ def docfx(session): session.install("-e", ".") session.install( - "sphinx==4.0.1", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml" + "sphinx==4.0.1", + "alabaster", + "recommonmark", + "gcp-sphinx-docfx-yaml", ) shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) From 2126361cafcaed79633e7f403591a53a507972ba Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 14:09:41 -0500 Subject: [PATCH 24/73] feat: add support for `google.cloud.appengine_admin.__version__` (#203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud..__version__` PiperOrigin-RevId: 484665853 Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version in gapic_version.py * add .release-please-manifest.json with correct version * add release-please-config.json * use templated owlbot.py and setup.py * revert changes to docs/index.rst Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/release-please.yml | 1 + .release-please-manifest.json | 3 + docs/conf.py | 2 +- google/cloud/appengine_admin/__init__.py | 236 +++++++++--------- google/cloud/appengine_admin/gapic_version.py | 16 ++ google/cloud/appengine_admin_v1/__init__.py | 228 ++++++++--------- .../services/applications/__init__.py | 2 +- .../services/applications/async_client.py | 15 +- .../services/applications/client.py | 20 +- .../applications/transports/__init__.py | 1 - .../services/applications/transports/base.py | 12 +- .../services/applications/transports/grpc.py | 15 +- .../applications/transports/grpc_asyncio.py | 15 +- .../authorized_certificates/__init__.py | 2 +- .../authorized_certificates/async_client.py | 15 +- .../authorized_certificates/client.py | 20 +- .../authorized_certificates/pagers.py | 7 +- .../transports/__init__.py | 1 - .../transports/base.py | 9 +- .../transports/grpc.py | 14 +- .../transports/grpc_asyncio.py | 14 +- .../services/authorized_domains/__init__.py | 2 +- .../authorized_domains/async_client.py | 12 +- .../services/authorized_domains/client.py | 17 +- .../services/authorized_domains/pagers.py | 7 +- .../authorized_domains/transports/__init__.py | 1 - .../authorized_domains/transports/base.py | 4 +- .../authorized_domains/transports/grpc.py | 9 +- .../transports/grpc_asyncio.py | 9 +- .../services/domain_mappings/__init__.py | 2 +- .../services/domain_mappings/async_client.py | 15 +- .../services/domain_mappings/client.py | 20 +- .../services/domain_mappings/pagers.py | 7 +- .../domain_mappings/transports/__init__.py | 1 - .../domain_mappings/transports/base.py | 12 +- .../domain_mappings/transports/grpc.py | 15 +- .../transports/grpc_asyncio.py | 15 +- .../services/firewall/__init__.py | 2 +- .../services/firewall/async_client.py | 12 +- .../services/firewall/client.py | 17 +- .../services/firewall/pagers.py | 7 +- .../services/firewall/transports/__init__.py | 1 - .../services/firewall/transports/base.py | 9 +- .../services/firewall/transports/grpc.py | 14 +- .../firewall/transports/grpc_asyncio.py | 14 +- .../services/instances/__init__.py | 2 +- .../services/instances/async_client.py | 17 +- .../services/instances/client.py | 22 +- .../services/instances/pagers.py | 7 +- .../services/instances/transports/__init__.py | 1 - .../services/instances/transports/base.py | 12 +- .../services/instances/transports/grpc.py | 15 +- .../instances/transports/grpc_asyncio.py | 15 +- .../services/services/__init__.py | 2 +- .../services/services/async_client.py | 15 +- .../services/services/client.py | 20 +- .../services/services/pagers.py | 7 +- .../services/services/transports/__init__.py | 1 - .../services/services/transports/base.py | 12 +- .../services/services/transports/grpc.py | 15 +- .../services/transports/grpc_asyncio.py | 15 +- .../services/versions/__init__.py | 2 +- .../services/versions/async_client.py | 20 +- .../services/versions/client.py | 25 +- .../services/versions/pagers.py | 7 +- .../services/versions/transports/__init__.py | 1 - .../services/versions/transports/base.py | 12 +- .../services/versions/transports/grpc.py | 15 +- .../versions/transports/grpc_asyncio.py | 15 +- .../appengine_admin_v1/types/__init__.py | 69 ++--- .../appengine_admin_v1/types/app_yaml.py | 4 +- .../appengine_admin_v1/types/appengine.py | 8 +- .../appengine_admin_v1/types/application.py | 4 +- .../appengine_admin_v1/types/audit_data.py | 1 - .../appengine_admin_v1/types/certificate.py | 4 +- .../cloud/appengine_admin_v1/types/deploy.py | 4 +- .../cloud/appengine_admin_v1/types/domain.py | 1 - .../types/domain_mapping.py | 1 - .../appengine_admin_v1/types/firewall.py | 1 - .../appengine_admin_v1/types/instance.py | 4 +- .../appengine_admin_v1/types/location.py | 1 - .../types/network_settings.py | 1 - .../appengine_admin_v1/types/operation.py | 4 +- .../cloud/appengine_admin_v1/types/service.py | 1 - .../cloud/appengine_admin_v1/types/version.py | 6 +- noxfile.py | 1 + owlbot.py | 46 ++-- release-please-config.json | 18 ++ setup.py | 63 +++-- testing/constraints-3.10.txt | 6 + testing/constraints-3.11.txt | 6 + testing/constraints-3.7.txt | 12 +- testing/constraints-3.8.txt | 6 + testing/constraints-3.9.txt | 6 + .../appengine_admin_v1/test_applications.py | 44 ++-- .../test_authorized_certificates.py | 33 ++- .../test_authorized_domains.py | 29 +-- .../test_domain_mappings.py | 45 ++-- .../gapic/appengine_admin_v1/test_firewall.py | 31 ++- .../appengine_admin_v1/test_instances.py | 45 ++-- .../gapic/appengine_admin_v1/test_services.py | 47 ++-- .../gapic/appengine_admin_v1/test_versions.py | 48 ++-- 102 files changed, 874 insertions(+), 873 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 google/cloud/appengine_admin/gapic_version.py create mode 100644 release-please-config.json diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..9c4ba94 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,3 @@ releaseType: python +manifest: true handleGHRelease: true diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..1adaf63 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.5.3" +} diff --git a/docs/conf.py b/docs/conf.py index 0d9d28a..5f040ab 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/google/cloud/appengine_admin/__init__.py b/google/cloud/appengine_admin/__init__.py index 0dc3839..5f52a1f 100644 --- a/google/cloud/appengine_admin/__init__.py +++ b/google/cloud/appengine_admin/__init__.py @@ -13,167 +13,169 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.appengine_admin import gapic_version as package_version + +__version__ = package_version.__version__ + -from google.cloud.appengine_admin_v1.services.applications.client import ( - ApplicationsClient, -) from google.cloud.appengine_admin_v1.services.applications.async_client import ( ApplicationsAsyncClient, ) -from google.cloud.appengine_admin_v1.services.authorized_certificates.client import ( - AuthorizedCertificatesClient, +from google.cloud.appengine_admin_v1.services.applications.client import ( + ApplicationsClient, ) from google.cloud.appengine_admin_v1.services.authorized_certificates.async_client import ( AuthorizedCertificatesAsyncClient, ) -from google.cloud.appengine_admin_v1.services.authorized_domains.client import ( - AuthorizedDomainsClient, +from google.cloud.appengine_admin_v1.services.authorized_certificates.client import ( + AuthorizedCertificatesClient, ) from google.cloud.appengine_admin_v1.services.authorized_domains.async_client import ( AuthorizedDomainsAsyncClient, ) -from google.cloud.appengine_admin_v1.services.domain_mappings.client import ( - DomainMappingsClient, +from google.cloud.appengine_admin_v1.services.authorized_domains.client import ( + AuthorizedDomainsClient, ) from google.cloud.appengine_admin_v1.services.domain_mappings.async_client import ( DomainMappingsAsyncClient, ) -from google.cloud.appengine_admin_v1.services.firewall.client import FirewallClient +from google.cloud.appengine_admin_v1.services.domain_mappings.client import ( + DomainMappingsClient, +) from google.cloud.appengine_admin_v1.services.firewall.async_client import ( FirewallAsyncClient, ) -from google.cloud.appengine_admin_v1.services.instances.client import InstancesClient +from google.cloud.appengine_admin_v1.services.firewall.client import FirewallClient from google.cloud.appengine_admin_v1.services.instances.async_client import ( InstancesAsyncClient, ) -from google.cloud.appengine_admin_v1.services.services.client import ServicesClient +from google.cloud.appengine_admin_v1.services.instances.client import InstancesClient from google.cloud.appengine_admin_v1.services.services.async_client import ( ServicesAsyncClient, ) -from google.cloud.appengine_admin_v1.services.versions.client import VersionsClient +from google.cloud.appengine_admin_v1.services.services.client import ServicesClient from google.cloud.appengine_admin_v1.services.versions.async_client import ( VersionsAsyncClient, ) - -from google.cloud.appengine_admin_v1.types.app_yaml import ApiConfigHandler -from google.cloud.appengine_admin_v1.types.app_yaml import ApiEndpointHandler -from google.cloud.appengine_admin_v1.types.app_yaml import ErrorHandler -from google.cloud.appengine_admin_v1.types.app_yaml import HealthCheck -from google.cloud.appengine_admin_v1.types.app_yaml import Library -from google.cloud.appengine_admin_v1.types.app_yaml import LivenessCheck -from google.cloud.appengine_admin_v1.types.app_yaml import ReadinessCheck -from google.cloud.appengine_admin_v1.types.app_yaml import ScriptHandler -from google.cloud.appengine_admin_v1.types.app_yaml import StaticFilesHandler -from google.cloud.appengine_admin_v1.types.app_yaml import UrlMap -from google.cloud.appengine_admin_v1.types.app_yaml import AuthFailAction -from google.cloud.appengine_admin_v1.types.app_yaml import LoginRequirement -from google.cloud.appengine_admin_v1.types.app_yaml import SecurityLevel -from google.cloud.appengine_admin_v1.types.appengine import ( - BatchUpdateIngressRulesRequest, +from google.cloud.appengine_admin_v1.services.versions.client import VersionsClient +from google.cloud.appengine_admin_v1.types.app_yaml import ( + ApiConfigHandler, + ApiEndpointHandler, + AuthFailAction, + ErrorHandler, + HealthCheck, + Library, + LivenessCheck, + LoginRequirement, + ReadinessCheck, + ScriptHandler, + SecurityLevel, + StaticFilesHandler, + UrlMap, ) from google.cloud.appengine_admin_v1.types.appengine import ( + AuthorizedCertificateView, + BatchUpdateIngressRulesRequest, BatchUpdateIngressRulesResponse, -) -from google.cloud.appengine_admin_v1.types.appengine import CreateApplicationRequest -from google.cloud.appengine_admin_v1.types.appengine import ( + CreateApplicationRequest, CreateAuthorizedCertificateRequest, -) -from google.cloud.appengine_admin_v1.types.appengine import CreateDomainMappingRequest -from google.cloud.appengine_admin_v1.types.appengine import CreateIngressRuleRequest -from google.cloud.appengine_admin_v1.types.appengine import CreateVersionRequest -from google.cloud.appengine_admin_v1.types.appengine import DebugInstanceRequest -from google.cloud.appengine_admin_v1.types.appengine import ( + CreateDomainMappingRequest, + CreateIngressRuleRequest, + CreateVersionRequest, + DebugInstanceRequest, DeleteAuthorizedCertificateRequest, -) -from google.cloud.appengine_admin_v1.types.appengine import DeleteDomainMappingRequest -from google.cloud.appengine_admin_v1.types.appengine import DeleteIngressRuleRequest -from google.cloud.appengine_admin_v1.types.appengine import DeleteInstanceRequest -from google.cloud.appengine_admin_v1.types.appengine import DeleteServiceRequest -from google.cloud.appengine_admin_v1.types.appengine import DeleteVersionRequest -from google.cloud.appengine_admin_v1.types.appengine import GetApplicationRequest -from google.cloud.appengine_admin_v1.types.appengine import ( + DeleteDomainMappingRequest, + DeleteIngressRuleRequest, + DeleteInstanceRequest, + DeleteServiceRequest, + DeleteVersionRequest, + DomainOverrideStrategy, + GetApplicationRequest, GetAuthorizedCertificateRequest, -) -from google.cloud.appengine_admin_v1.types.appengine import GetDomainMappingRequest -from google.cloud.appengine_admin_v1.types.appengine import GetIngressRuleRequest -from google.cloud.appengine_admin_v1.types.appengine import GetInstanceRequest -from google.cloud.appengine_admin_v1.types.appengine import GetServiceRequest -from google.cloud.appengine_admin_v1.types.appengine import GetVersionRequest -from google.cloud.appengine_admin_v1.types.appengine import ( + GetDomainMappingRequest, + GetIngressRuleRequest, + GetInstanceRequest, + GetServiceRequest, + GetVersionRequest, ListAuthorizedCertificatesRequest, -) -from google.cloud.appengine_admin_v1.types.appengine import ( ListAuthorizedCertificatesResponse, -) -from google.cloud.appengine_admin_v1.types.appengine import ListAuthorizedDomainsRequest -from google.cloud.appengine_admin_v1.types.appengine import ( + ListAuthorizedDomainsRequest, ListAuthorizedDomainsResponse, -) -from google.cloud.appengine_admin_v1.types.appengine import ListDomainMappingsRequest -from google.cloud.appengine_admin_v1.types.appengine import ListDomainMappingsResponse -from google.cloud.appengine_admin_v1.types.appengine import ListIngressRulesRequest -from google.cloud.appengine_admin_v1.types.appengine import ListIngressRulesResponse -from google.cloud.appengine_admin_v1.types.appengine import ListInstancesRequest -from google.cloud.appengine_admin_v1.types.appengine import ListInstancesResponse -from google.cloud.appengine_admin_v1.types.appengine import ListServicesRequest -from google.cloud.appengine_admin_v1.types.appengine import ListServicesResponse -from google.cloud.appengine_admin_v1.types.appengine import ListVersionsRequest -from google.cloud.appengine_admin_v1.types.appengine import ListVersionsResponse -from google.cloud.appengine_admin_v1.types.appengine import RepairApplicationRequest -from google.cloud.appengine_admin_v1.types.appengine import UpdateApplicationRequest -from google.cloud.appengine_admin_v1.types.appengine import ( + ListDomainMappingsRequest, + ListDomainMappingsResponse, + ListIngressRulesRequest, + ListIngressRulesResponse, + ListInstancesRequest, + ListInstancesResponse, + ListServicesRequest, + ListServicesResponse, + ListVersionsRequest, + ListVersionsResponse, + RepairApplicationRequest, + UpdateApplicationRequest, UpdateAuthorizedCertificateRequest, + UpdateDomainMappingRequest, + UpdateIngressRuleRequest, + UpdateServiceRequest, + UpdateVersionRequest, + VersionView, +) +from google.cloud.appengine_admin_v1.types.application import ( + Application, + UrlDispatchRule, +) +from google.cloud.appengine_admin_v1.types.audit_data import ( + AuditData, + CreateVersionMethod, + UpdateServiceMethod, +) +from google.cloud.appengine_admin_v1.types.certificate import ( + AuthorizedCertificate, + CertificateRawData, + ManagedCertificate, + ManagementStatus, +) +from google.cloud.appengine_admin_v1.types.deploy import ( + CloudBuildOptions, + ContainerInfo, + Deployment, + FileInfo, + ZipInfo, ) -from google.cloud.appengine_admin_v1.types.appengine import UpdateDomainMappingRequest -from google.cloud.appengine_admin_v1.types.appengine import UpdateIngressRuleRequest -from google.cloud.appengine_admin_v1.types.appengine import UpdateServiceRequest -from google.cloud.appengine_admin_v1.types.appengine import UpdateVersionRequest -from google.cloud.appengine_admin_v1.types.appengine import AuthorizedCertificateView -from google.cloud.appengine_admin_v1.types.appengine import DomainOverrideStrategy -from google.cloud.appengine_admin_v1.types.appengine import VersionView -from google.cloud.appengine_admin_v1.types.application import Application -from google.cloud.appengine_admin_v1.types.application import UrlDispatchRule -from google.cloud.appengine_admin_v1.types.audit_data import AuditData -from google.cloud.appengine_admin_v1.types.audit_data import CreateVersionMethod -from google.cloud.appengine_admin_v1.types.audit_data import UpdateServiceMethod -from google.cloud.appengine_admin_v1.types.certificate import AuthorizedCertificate -from google.cloud.appengine_admin_v1.types.certificate import CertificateRawData -from google.cloud.appengine_admin_v1.types.certificate import ManagedCertificate -from google.cloud.appengine_admin_v1.types.certificate import ManagementStatus -from google.cloud.appengine_admin_v1.types.deploy import CloudBuildOptions -from google.cloud.appengine_admin_v1.types.deploy import ContainerInfo -from google.cloud.appengine_admin_v1.types.deploy import Deployment -from google.cloud.appengine_admin_v1.types.deploy import FileInfo -from google.cloud.appengine_admin_v1.types.deploy import ZipInfo from google.cloud.appengine_admin_v1.types.domain import AuthorizedDomain -from google.cloud.appengine_admin_v1.types.domain_mapping import DomainMapping -from google.cloud.appengine_admin_v1.types.domain_mapping import ResourceRecord -from google.cloud.appengine_admin_v1.types.domain_mapping import SslSettings +from google.cloud.appengine_admin_v1.types.domain_mapping import ( + DomainMapping, + ResourceRecord, + SslSettings, +) from google.cloud.appengine_admin_v1.types.firewall import FirewallRule from google.cloud.appengine_admin_v1.types.instance import Instance from google.cloud.appengine_admin_v1.types.location import LocationMetadata from google.cloud.appengine_admin_v1.types.network_settings import NetworkSettings -from google.cloud.appengine_admin_v1.types.operation import CreateVersionMetadataV1 -from google.cloud.appengine_admin_v1.types.operation import OperationMetadataV1 -from google.cloud.appengine_admin_v1.types.service import Service -from google.cloud.appengine_admin_v1.types.service import TrafficSplit -from google.cloud.appengine_admin_v1.types.version import AutomaticScaling -from google.cloud.appengine_admin_v1.types.version import BasicScaling -from google.cloud.appengine_admin_v1.types.version import CpuUtilization -from google.cloud.appengine_admin_v1.types.version import DiskUtilization -from google.cloud.appengine_admin_v1.types.version import EndpointsApiService -from google.cloud.appengine_admin_v1.types.version import Entrypoint -from google.cloud.appengine_admin_v1.types.version import ManualScaling -from google.cloud.appengine_admin_v1.types.version import Network -from google.cloud.appengine_admin_v1.types.version import NetworkUtilization -from google.cloud.appengine_admin_v1.types.version import RequestUtilization -from google.cloud.appengine_admin_v1.types.version import Resources -from google.cloud.appengine_admin_v1.types.version import StandardSchedulerSettings -from google.cloud.appengine_admin_v1.types.version import Version -from google.cloud.appengine_admin_v1.types.version import Volume -from google.cloud.appengine_admin_v1.types.version import VpcAccessConnector -from google.cloud.appengine_admin_v1.types.version import InboundServiceType -from google.cloud.appengine_admin_v1.types.version import ServingStatus +from google.cloud.appengine_admin_v1.types.operation import ( + CreateVersionMetadataV1, + OperationMetadataV1, +) +from google.cloud.appengine_admin_v1.types.service import Service, TrafficSplit +from google.cloud.appengine_admin_v1.types.version import ( + AutomaticScaling, + BasicScaling, + CpuUtilization, + DiskUtilization, + EndpointsApiService, + Entrypoint, + InboundServiceType, + ManualScaling, + Network, + NetworkUtilization, + RequestUtilization, + Resources, + ServingStatus, + StandardSchedulerSettings, + Version, + Volume, + VpcAccessConnector, +) __all__ = ( "ApplicationsClient", diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py new file mode 100644 index 0000000..9437340 --- /dev/null +++ b/google/cloud/appengine_admin/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +__version__ = "1.5.3" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index d67f02d..38164c2 100644 --- a/google/cloud/appengine_admin_v1/__init__.py +++ b/google/cloud/appengine_admin_v1/__init__.py @@ -13,125 +13,129 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.appengine_admin import gapic_version as package_version -from .services.applications import ApplicationsClient -from .services.applications import ApplicationsAsyncClient -from .services.authorized_certificates import AuthorizedCertificatesClient -from .services.authorized_certificates import AuthorizedCertificatesAsyncClient -from .services.authorized_domains import AuthorizedDomainsClient -from .services.authorized_domains import AuthorizedDomainsAsyncClient -from .services.domain_mappings import DomainMappingsClient -from .services.domain_mappings import DomainMappingsAsyncClient -from .services.firewall import FirewallClient -from .services.firewall import FirewallAsyncClient -from .services.instances import InstancesClient -from .services.instances import InstancesAsyncClient -from .services.services import ServicesClient -from .services.services import ServicesAsyncClient -from .services.versions import VersionsClient -from .services.versions import VersionsAsyncClient +__version__ = package_version.__version__ -from .types.app_yaml import ApiConfigHandler -from .types.app_yaml import ApiEndpointHandler -from .types.app_yaml import ErrorHandler -from .types.app_yaml import HealthCheck -from .types.app_yaml import Library -from .types.app_yaml import LivenessCheck -from .types.app_yaml import ReadinessCheck -from .types.app_yaml import ScriptHandler -from .types.app_yaml import StaticFilesHandler -from .types.app_yaml import UrlMap -from .types.app_yaml import AuthFailAction -from .types.app_yaml import LoginRequirement -from .types.app_yaml import SecurityLevel -from .types.appengine import BatchUpdateIngressRulesRequest -from .types.appengine import BatchUpdateIngressRulesResponse -from .types.appengine import CreateApplicationRequest -from .types.appengine import CreateAuthorizedCertificateRequest -from .types.appengine import CreateDomainMappingRequest -from .types.appengine import CreateIngressRuleRequest -from .types.appengine import CreateVersionRequest -from .types.appengine import DebugInstanceRequest -from .types.appengine import DeleteAuthorizedCertificateRequest -from .types.appengine import DeleteDomainMappingRequest -from .types.appengine import DeleteIngressRuleRequest -from .types.appengine import DeleteInstanceRequest -from .types.appengine import DeleteServiceRequest -from .types.appengine import DeleteVersionRequest -from .types.appengine import GetApplicationRequest -from .types.appengine import GetAuthorizedCertificateRequest -from .types.appengine import GetDomainMappingRequest -from .types.appengine import GetIngressRuleRequest -from .types.appengine import GetInstanceRequest -from .types.appengine import GetServiceRequest -from .types.appengine import GetVersionRequest -from .types.appengine import ListAuthorizedCertificatesRequest -from .types.appengine import ListAuthorizedCertificatesResponse -from .types.appengine import ListAuthorizedDomainsRequest -from .types.appengine import ListAuthorizedDomainsResponse -from .types.appengine import ListDomainMappingsRequest -from .types.appengine import ListDomainMappingsResponse -from .types.appengine import ListIngressRulesRequest -from .types.appengine import ListIngressRulesResponse -from .types.appengine import ListInstancesRequest -from .types.appengine import ListInstancesResponse -from .types.appengine import ListServicesRequest -from .types.appengine import ListServicesResponse -from .types.appengine import ListVersionsRequest -from .types.appengine import ListVersionsResponse -from .types.appengine import RepairApplicationRequest -from .types.appengine import UpdateApplicationRequest -from .types.appengine import UpdateAuthorizedCertificateRequest -from .types.appengine import UpdateDomainMappingRequest -from .types.appengine import UpdateIngressRuleRequest -from .types.appengine import UpdateServiceRequest -from .types.appengine import UpdateVersionRequest -from .types.appengine import AuthorizedCertificateView -from .types.appengine import DomainOverrideStrategy -from .types.appengine import VersionView -from .types.application import Application -from .types.application import UrlDispatchRule -from .types.audit_data import AuditData -from .types.audit_data import CreateVersionMethod -from .types.audit_data import UpdateServiceMethod -from .types.certificate import AuthorizedCertificate -from .types.certificate import CertificateRawData -from .types.certificate import ManagedCertificate -from .types.certificate import ManagementStatus -from .types.deploy import CloudBuildOptions -from .types.deploy import ContainerInfo -from .types.deploy import Deployment -from .types.deploy import FileInfo -from .types.deploy import ZipInfo + +from .services.applications import ApplicationsAsyncClient, ApplicationsClient +from .services.authorized_certificates import ( + AuthorizedCertificatesAsyncClient, + AuthorizedCertificatesClient, +) +from .services.authorized_domains import ( + AuthorizedDomainsAsyncClient, + AuthorizedDomainsClient, +) +from .services.domain_mappings import DomainMappingsAsyncClient, DomainMappingsClient +from .services.firewall import FirewallAsyncClient, FirewallClient +from .services.instances import InstancesAsyncClient, InstancesClient +from .services.services import ServicesAsyncClient, ServicesClient +from .services.versions import VersionsAsyncClient, VersionsClient +from .types.app_yaml import ( + ApiConfigHandler, + ApiEndpointHandler, + AuthFailAction, + ErrorHandler, + HealthCheck, + Library, + LivenessCheck, + LoginRequirement, + ReadinessCheck, + ScriptHandler, + SecurityLevel, + StaticFilesHandler, + UrlMap, +) +from .types.appengine import ( + AuthorizedCertificateView, + BatchUpdateIngressRulesRequest, + BatchUpdateIngressRulesResponse, + CreateApplicationRequest, + CreateAuthorizedCertificateRequest, + CreateDomainMappingRequest, + CreateIngressRuleRequest, + CreateVersionRequest, + DebugInstanceRequest, + DeleteAuthorizedCertificateRequest, + DeleteDomainMappingRequest, + DeleteIngressRuleRequest, + DeleteInstanceRequest, + DeleteServiceRequest, + DeleteVersionRequest, + DomainOverrideStrategy, + GetApplicationRequest, + GetAuthorizedCertificateRequest, + GetDomainMappingRequest, + GetIngressRuleRequest, + GetInstanceRequest, + GetServiceRequest, + GetVersionRequest, + ListAuthorizedCertificatesRequest, + ListAuthorizedCertificatesResponse, + ListAuthorizedDomainsRequest, + ListAuthorizedDomainsResponse, + ListDomainMappingsRequest, + ListDomainMappingsResponse, + ListIngressRulesRequest, + ListIngressRulesResponse, + ListInstancesRequest, + ListInstancesResponse, + ListServicesRequest, + ListServicesResponse, + ListVersionsRequest, + ListVersionsResponse, + RepairApplicationRequest, + UpdateApplicationRequest, + UpdateAuthorizedCertificateRequest, + UpdateDomainMappingRequest, + UpdateIngressRuleRequest, + UpdateServiceRequest, + UpdateVersionRequest, + VersionView, +) +from .types.application import Application, UrlDispatchRule +from .types.audit_data import AuditData, CreateVersionMethod, UpdateServiceMethod +from .types.certificate import ( + AuthorizedCertificate, + CertificateRawData, + ManagedCertificate, + ManagementStatus, +) +from .types.deploy import ( + CloudBuildOptions, + ContainerInfo, + Deployment, + FileInfo, + ZipInfo, +) from .types.domain import AuthorizedDomain -from .types.domain_mapping import DomainMapping -from .types.domain_mapping import ResourceRecord -from .types.domain_mapping import SslSettings +from .types.domain_mapping import DomainMapping, ResourceRecord, SslSettings from .types.firewall import FirewallRule from .types.instance import Instance from .types.location import LocationMetadata from .types.network_settings import NetworkSettings -from .types.operation import CreateVersionMetadataV1 -from .types.operation import OperationMetadataV1 -from .types.service import Service -from .types.service import TrafficSplit -from .types.version import AutomaticScaling -from .types.version import BasicScaling -from .types.version import CpuUtilization -from .types.version import DiskUtilization -from .types.version import EndpointsApiService -from .types.version import Entrypoint -from .types.version import ManualScaling -from .types.version import Network -from .types.version import NetworkUtilization -from .types.version import RequestUtilization -from .types.version import Resources -from .types.version import StandardSchedulerSettings -from .types.version import Version -from .types.version import Volume -from .types.version import VpcAccessConnector -from .types.version import InboundServiceType -from .types.version import ServingStatus +from .types.operation import CreateVersionMetadataV1, OperationMetadataV1 +from .types.service import Service, TrafficSplit +from .types.version import ( + AutomaticScaling, + BasicScaling, + CpuUtilization, + DiskUtilization, + EndpointsApiService, + Entrypoint, + InboundServiceType, + ManualScaling, + Network, + NetworkUtilization, + RequestUtilization, + Resources, + ServingStatus, + StandardSchedulerSettings, + Version, + Volume, + VpcAccessConnector, +) __all__ = ( "ApplicationsAsyncClient", diff --git a/google/cloud/appengine_admin_v1/services/applications/__init__.py b/google/cloud/appengine_admin_v1/services/applications/__init__.py index 5a89ba0..e2150ba 100644 --- a/google/cloud/appengine_admin_v1/services/applications/__init__.py +++ b/google/cloud/appengine_admin_v1/services/applications/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ApplicationsClient from .async_client import ApplicationsAsyncClient +from .client import ApplicationsClient __all__ = ( "ApplicationsClient", diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index 1c88e92..a01b26b 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,13 +33,14 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import application -from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.protobuf import duration_pb2 # type: ignore -from .transports.base import ApplicationsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ApplicationsGrpcAsyncIOTransport + +from google.cloud.appengine_admin_v1.types import appengine, application +from google.cloud.appengine_admin_v1.types import operation as ga_operation + from .client import ApplicationsClient +from .transports.base import DEFAULT_CLIENT_INFO, ApplicationsTransport +from .transports.grpc_asyncio import ApplicationsGrpcAsyncIOTransport class ApplicationsAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index eb68fa6..cf1eb83 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,11 +36,12 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import application -from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.protobuf import duration_pb2 # type: ignore -from .transports.base import ApplicationsTransport, DEFAULT_CLIENT_INFO + +from google.cloud.appengine_admin_v1.types import appengine, application +from google.cloud.appengine_admin_v1.types import operation as ga_operation + +from .transports.base import DEFAULT_CLIENT_INFO, ApplicationsTransport from .transports.grpc import ApplicationsGrpcTransport from .transports.grpc_asyncio import ApplicationsGrpcAsyncIOTransport @@ -313,7 +314,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ApplicationsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the applications client. @@ -327,7 +328,7 @@ def __init__( transport (Union[str, ApplicationsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -357,6 +358,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py b/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py index 27d1aad..d911b25 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ApplicationsGrpcTransport from .grpc_asyncio import ApplicationsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ApplicationsTransport]] _transport_registry["grpc"] = ApplicationsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/base.py b/google/cloud/appengine_admin_v1/services/applications/transports/base.py index 099d857..f004538 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -15,20 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import application -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.appengine_admin_v1.types import appengine, application try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py index 29f6f96..e62a9a3 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import application -from google.longrunning import operations_pb2 # type: ignore -from .base import ApplicationsTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, application + +from .base import DEFAULT_CLIENT_INFO, ApplicationsTransport class ApplicationsGrpcTransport(ApplicationsTransport): diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py index 2b3d91f..3e04368 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import application -from google.longrunning import operations_pb2 # type: ignore -from .base import ApplicationsTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, application + +from .base import DEFAULT_CLIENT_INFO, ApplicationsTransport from .grpc import ApplicationsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py index 9f07aa4..957935a 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import AuthorizedCertificatesClient from .async_client import AuthorizedCertificatesAsyncClient +from .client import AuthorizedCertificatesClient __all__ = ( "AuthorizedCertificatesClient", diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index d4972c5..3b13e69 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -17,27 +17,28 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.appengine_admin_v1.services.authorized_certificates import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import certificate from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport + +from google.cloud.appengine_admin_v1.services.authorized_certificates import pagers +from google.cloud.appengine_admin_v1.types import appengine, certificate + from .client import AuthorizedCertificatesClient +from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport +from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport class AuthorizedCertificatesAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index 547b6e0..2a5b15a 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -16,29 +16,30 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.appengine_admin_v1.services.authorized_certificates import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import certificate from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO + +from google.cloud.appengine_admin_v1.services.authorized_certificates import pagers +from google.cloud.appengine_admin_v1.types import appengine, certificate + +from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport from .transports.grpc import AuthorizedCertificatesGrpcTransport from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport @@ -316,7 +317,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AuthorizedCertificatesTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the authorized certificates client. @@ -330,7 +331,7 @@ def __init__( transport (Union[str, AuthorizedCertificatesTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -360,6 +361,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py index 8b6797c..dd6e8bc 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import certificate +from google.cloud.appengine_admin_v1.types import appengine, certificate class ListAuthorizedCertificatesPager: diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py index 8b42e99..659030c 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import AuthorizedCertificatesGrpcTransport from .grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = ( OrderedDict() diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py index efdba67..52c1708 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py @@ -15,19 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import certificate from google.protobuf import empty_pb2 # type: ignore +import pkg_resources + +from google.cloud.appengine_admin_v1.types import appengine, certificate try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py index 4d9d7c8..01b0060 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import certificate -from google.protobuf import empty_pb2 # type: ignore -from .base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, certificate + +from .base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport class AuthorizedCertificatesGrpcTransport(AuthorizedCertificatesTransport): diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py index ddd61b9..0ba8371 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import certificate -from google.protobuf import empty_pb2 # type: ignore -from .base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, certificate + +from .base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport from .grpc import AuthorizedCertificatesGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py index caf4e2e..e73333e 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import AuthorizedDomainsClient from .async_client import AuthorizedDomainsAsyncClient +from .client import AuthorizedDomainsClient __all__ = ( "AuthorizedDomainsClient", diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 7d0e420..4af4c0d 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -32,11 +32,11 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.appengine_admin_v1.services.authorized_domains import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain -from .transports.base import AuthorizedDomainsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport +from google.cloud.appengine_admin_v1.types import appengine, domain + from .client import AuthorizedDomainsClient +from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport +from .transports.grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport class AuthorizedDomainsAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index 3c048c8..aa4cba1 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -35,9 +35,9 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.appengine_admin_v1.services.authorized_domains import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain -from .transports.base import AuthorizedDomainsTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, domain + +from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport from .transports.grpc import AuthorizedDomainsGrpcTransport from .transports.grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport @@ -315,7 +315,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AuthorizedDomainsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the authorized domains client. @@ -329,7 +329,7 @@ def __init__( transport (Union[str, AuthorizedDomainsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -359,6 +359,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py b/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py index f250a7a..d790841 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain +from google.cloud.appengine_admin_v1.types import appengine, domain class ListAuthorizedDomainsPager: diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py index 09deb66..5938ca9 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import AuthorizedDomainsGrpcTransport from .grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[AuthorizedDomainsTransport]] _transport_registry["grpc"] = AuthorizedDomainsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py index db83423..a943bee 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py @@ -15,15 +15,15 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.appengine_admin_v1.types import appengine diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py index c8959d7..69c2624 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from google.cloud.appengine_admin_v1.types import appengine -from .base import AuthorizedDomainsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport class AuthorizedDomainsGrpcTransport(AuthorizedDomainsTransport): diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py index 16207f5..823f236 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.appengine_admin_v1.types import appengine -from .base import AuthorizedDomainsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport from .grpc import AuthorizedDomainsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py b/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py index c900f1f..e019b68 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import DomainMappingsClient from .async_client import DomainMappingsAsyncClient +from .client import DomainMappingsClient __all__ = ( "DomainMappingsClient", diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 66fa3b1..272c227 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,14 +33,15 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore +from google.protobuf import empty_pb2 # type: ignore + from google.cloud.appengine_admin_v1.services.domain_mappings import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain_mapping +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.protobuf import empty_pb2 # type: ignore -from .transports.base import DomainMappingsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import DomainMappingsGrpcAsyncIOTransport + from .client import DomainMappingsClient +from .transports.base import DEFAULT_CLIENT_INFO, DomainMappingsTransport +from .transports.grpc_asyncio import DomainMappingsGrpcAsyncIOTransport class DomainMappingsAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index ea01f3f..e5e7e90 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,12 +36,13 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore +from google.protobuf import empty_pb2 # type: ignore + from google.cloud.appengine_admin_v1.services.domain_mappings import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain_mapping +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.protobuf import empty_pb2 # type: ignore -from .transports.base import DomainMappingsTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, DomainMappingsTransport from .transports.grpc import DomainMappingsGrpcTransport from .transports.grpc_asyncio import DomainMappingsGrpcAsyncIOTransport @@ -316,7 +317,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DomainMappingsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the domain mappings client. @@ -330,7 +331,7 @@ def __init__( transport (Union[str, DomainMappingsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -360,6 +361,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py b/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py index 9eef25f..6a71967 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain_mapping +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping class ListDomainMappingsPager: diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py index f4abef8..1883c69 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import DomainMappingsGrpcTransport from .grpc_asyncio import DomainMappingsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[DomainMappingsTransport]] _transport_registry["grpc"] = DomainMappingsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py index 25d9be8..a38b79c 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py @@ -15,20 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain_mapping -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py index 01492e9..15b61c6 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain_mapping -from google.longrunning import operations_pb2 # type: ignore -from .base import DomainMappingsTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping + +from .base import DEFAULT_CLIENT_INFO, DomainMappingsTransport class DomainMappingsGrpcTransport(DomainMappingsTransport): diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py index ca7c706..80fb4cf 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain_mapping -from google.longrunning import operations_pb2 # type: ignore -from .base import DomainMappingsTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping + +from .base import DEFAULT_CLIENT_INFO, DomainMappingsTransport from .grpc import DomainMappingsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/firewall/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/__init__.py index 2a1dc5a..417aec0 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/__init__.py +++ b/google/cloud/appengine_admin_v1/services/firewall/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import FirewallClient from .async_client import FirewallAsyncClient +from .client import FirewallClient __all__ = ( "FirewallClient", diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index 6b03245..c064b0a 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -32,11 +32,11 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.appengine_admin_v1.services.firewall import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import firewall -from .transports.base import FirewallTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import FirewallGrpcAsyncIOTransport +from google.cloud.appengine_admin_v1.types import appengine, firewall + from .client import FirewallClient +from .transports.base import DEFAULT_CLIENT_INFO, FirewallTransport +from .transports.grpc_asyncio import FirewallGrpcAsyncIOTransport class FirewallAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 0e8b5c1..f0cea22 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -35,9 +35,9 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.appengine_admin_v1.services.firewall import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import firewall -from .transports.base import FirewallTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, firewall + +from .transports.base import DEFAULT_CLIENT_INFO, FirewallTransport from .transports.grpc import FirewallGrpcTransport from .transports.grpc_asyncio import FirewallGrpcAsyncIOTransport @@ -321,7 +321,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, FirewallTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the firewall client. @@ -335,7 +335,7 @@ def __init__( transport (Union[str, FirewallTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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,6 +365,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/firewall/pagers.py b/google/cloud/appengine_admin_v1/services/firewall/pagers.py index 1e3aa6f..2703da0 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/pagers.py +++ b/google/cloud/appengine_admin_v1/services/firewall/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import firewall +from google.cloud.appengine_admin_v1.types import appengine, firewall class ListIngressRulesPager: diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py index 8fe35b5..382119f 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import FirewallGrpcTransport from .grpc_asyncio import FirewallGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[FirewallTransport]] _transport_registry["grpc"] = FirewallGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py index 4e4bbb7..f643e88 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -15,19 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import firewall from google.protobuf import empty_pb2 # type: ignore +import pkg_resources + +from google.cloud.appengine_admin_v1.types import appengine, firewall try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py index cdf8c0c..1d75599 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import firewall -from google.protobuf import empty_pb2 # type: ignore -from .base import FirewallTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, firewall + +from .base import DEFAULT_CLIENT_INFO, FirewallTransport class FirewallGrpcTransport(FirewallTransport): diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py index a49184d..4d1ca72 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import firewall -from google.protobuf import empty_pb2 # type: ignore -from .base import FirewallTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, firewall + +from .base import DEFAULT_CLIENT_INFO, FirewallTransport from .grpc import FirewallGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/instances/__init__.py b/google/cloud/appengine_admin_v1/services/instances/__init__.py index a655183..e1d8945 100644 --- a/google/cloud/appengine_admin_v1/services/instances/__init__.py +++ b/google/cloud/appengine_admin_v1/services/instances/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import InstancesClient from .async_client import InstancesAsyncClient +from .client import InstancesClient __all__ = ( "InstancesClient", diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 0e999ae..eee9e33 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,15 +33,16 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.appengine_admin_v1.services.instances import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import instance -from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.protobuf import empty_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import InstancesTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import InstancesGrpcAsyncIOTransport + +from google.cloud.appengine_admin_v1.services.instances import pagers +from google.cloud.appengine_admin_v1.types import appengine, instance +from google.cloud.appengine_admin_v1.types import operation as ga_operation + from .client import InstancesClient +from .transports.base import DEFAULT_CLIENT_INFO, InstancesTransport +from .transports.grpc_asyncio import InstancesGrpcAsyncIOTransport class InstancesAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 90e97b6..f12dcbb 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,13 +36,14 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.appengine_admin_v1.services.instances import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import instance -from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.protobuf import empty_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import InstancesTransport, DEFAULT_CLIENT_INFO + +from google.cloud.appengine_admin_v1.services.instances import pagers +from google.cloud.appengine_admin_v1.types import appengine, instance +from google.cloud.appengine_admin_v1.types import operation as ga_operation + +from .transports.base import DEFAULT_CLIENT_INFO, InstancesTransport from .transports.grpc import InstancesGrpcTransport from .transports.grpc_asyncio import InstancesGrpcAsyncIOTransport @@ -339,7 +340,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, InstancesTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the instances client. @@ -353,7 +354,7 @@ def __init__( transport (Union[str, InstancesTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -383,6 +384,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/instances/pagers.py b/google/cloud/appengine_admin_v1/services/instances/pagers.py index da63e00..8459277 100644 --- a/google/cloud/appengine_admin_v1/services/instances/pagers.py +++ b/google/cloud/appengine_admin_v1/services/instances/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import instance +from google.cloud.appengine_admin_v1.types import appengine, instance class ListInstancesPager: diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py b/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py index a977af3..5a5096b 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import InstancesGrpcTransport from .grpc_asyncio import InstancesGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[InstancesTransport]] _transport_registry["grpc"] = InstancesGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/base.py b/google/cloud/appengine_admin_v1/services/instances/transports/base.py index 1b81edd..e8492c5 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -15,20 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import instance -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.appengine_admin_v1.types import appengine, instance try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py index ebdf3e0..4cc0dc3 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import instance -from google.longrunning import operations_pb2 # type: ignore -from .base import InstancesTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, instance + +from .base import DEFAULT_CLIENT_INFO, InstancesTransport class InstancesGrpcTransport(InstancesTransport): diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py index 2289fea..01c418a 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import instance -from google.longrunning import operations_pb2 # type: ignore -from .base import InstancesTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, instance + +from .base import DEFAULT_CLIENT_INFO, InstancesTransport from .grpc import InstancesGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/services/__init__.py b/google/cloud/appengine_admin_v1/services/services/__init__.py index f8e9062..3916f58 100644 --- a/google/cloud/appengine_admin_v1/services/services/__init__.py +++ b/google/cloud/appengine_admin_v1/services/services/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ServicesClient from .async_client import ServicesAsyncClient +from .client import ServicesClient __all__ = ( "ServicesClient", diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 3fd6da3..636c963 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,15 +33,16 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore +from google.protobuf import empty_pb2 # type: ignore + from google.cloud.appengine_admin_v1.services.services import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import network_settings +from google.cloud.appengine_admin_v1.types import appengine, network_settings from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.cloud.appengine_admin_v1.types import service -from google.protobuf import empty_pb2 # type: ignore -from .transports.base import ServicesTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport + from .client import ServicesClient +from .transports.base import DEFAULT_CLIENT_INFO, ServicesTransport +from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport class ServicesAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 2eb5429..0c47b3f 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,13 +36,14 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore +from google.protobuf import empty_pb2 # type: ignore + from google.cloud.appengine_admin_v1.services.services import pagers -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import network_settings +from google.cloud.appengine_admin_v1.types import appengine, network_settings from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.cloud.appengine_admin_v1.types import service -from google.protobuf import empty_pb2 # type: ignore -from .transports.base import ServicesTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, ServicesTransport from .transports.grpc import ServicesGrpcTransport from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport @@ -315,7 +316,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ServicesTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the services client. @@ -329,7 +330,7 @@ def __init__( transport (Union[str, ServicesTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -359,6 +360,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/services/pagers.py b/google/cloud/appengine_admin_v1/services/services/pagers.py index fa99c03..798651d 100644 --- a/google/cloud/appengine_admin_v1/services/services/pagers.py +++ b/google/cloud/appengine_admin_v1/services/services/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import service +from google.cloud.appengine_admin_v1.types import appengine, service class ListServicesPager: diff --git a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py b/google/cloud/appengine_admin_v1/services/services/transports/__init__.py index 7597c5d..f362184 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ServicesGrpcTransport from .grpc_asyncio import ServicesGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ServicesTransport]] _transport_registry["grpc"] = ServicesGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/services/transports/base.py b/google/cloud/appengine_admin_v1/services/services/transports/base.py index 872bfb8..3b68e2b 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -15,20 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import service -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.appengine_admin_v1.types import appengine, service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py index 2f3fc04..f35d7c8 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import service -from google.longrunning import operations_pb2 # type: ignore -from .base import ServicesTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, service + +from .base import DEFAULT_CLIENT_INFO, ServicesTransport class ServicesGrpcTransport(ServicesTransport): diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py index 0858cb6..92c4ff3 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import service -from google.longrunning import operations_pb2 # type: ignore -from .base import ServicesTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, service + +from .base import DEFAULT_CLIENT_INFO, ServicesTransport from .grpc import ServicesGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/versions/__init__.py b/google/cloud/appengine_admin_v1/services/versions/__init__.py index 78f73aa..2e962bc 100644 --- a/google/cloud/appengine_admin_v1/services/versions/__init__.py +++ b/google/cloud/appengine_admin_v1/services/versions/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import VersionsClient from .async_client import VersionsAsyncClient +from .client import VersionsClient __all__ = ( "VersionsClient", diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index ecc29d5..fc652e5 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,18 +33,18 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.appengine_admin_v1.services.versions import pagers -from google.cloud.appengine_admin_v1.types import app_yaml -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import deploy -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import version from google.protobuf import duration_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import VersionsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport + +from google.cloud.appengine_admin_v1.services.versions import pagers +from google.cloud.appengine_admin_v1.types import app_yaml, appengine, deploy +from google.cloud.appengine_admin_v1.types import operation as ga_operation +from google.cloud.appengine_admin_v1.types import version + from .client import VersionsClient +from .transports.base import DEFAULT_CLIENT_INFO, VersionsTransport +from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport class VersionsAsyncClient: diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 8334f50..e765f75 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,16 +36,16 @@ from google.api_core import operation as gac_operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.appengine_admin_v1.services.versions import pagers -from google.cloud.appengine_admin_v1.types import app_yaml -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import deploy -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import version from google.protobuf import duration_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import VersionsTransport, DEFAULT_CLIENT_INFO + +from google.cloud.appengine_admin_v1.services.versions import pagers +from google.cloud.appengine_admin_v1.types import app_yaml, appengine, deploy +from google.cloud.appengine_admin_v1.types import operation as ga_operation +from google.cloud.appengine_admin_v1.types import version + +from .transports.base import DEFAULT_CLIENT_INFO, VersionsTransport from .transports.grpc import VersionsGrpcTransport from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport @@ -318,7 +318,7 @@ def __init__( *, credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, VersionsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the versions client. @@ -332,7 +332,7 @@ def __init__( transport (Union[str, VersionsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -362,6 +362,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options diff --git a/google/cloud/appengine_admin_v1/services/versions/pagers.py b/google/cloud/appengine_admin_v1/services/versions/pagers.py index 35654e9..df6f2e5 100644 --- a/google/cloud/appengine_admin_v1/services/versions/pagers.py +++ b/google/cloud/appengine_admin_v1/services/versions/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import version +from google.cloud.appengine_admin_v1.types import appengine, version class ListVersionsPager: diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py b/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py index ab80b3b..e31c216 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import VersionsGrpcTransport from .grpc_asyncio import VersionsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[VersionsTransport]] _transport_registry["grpc"] = VersionsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/base.py b/google/cloud/appengine_admin_v1/services/versions/transports/base.py index f8ddd2c..d9ae526 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -15,20 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import version -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.appengine_admin_v1.types import appengine, version try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py index 8d3657e..c31a651 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import version -from google.longrunning import operations_pb2 # type: ignore -from .base import VersionsTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, version + +from .base import DEFAULT_CLIENT_INFO, VersionsTransport class VersionsGrpcTransport(VersionsTransport): diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py index d91e4a7..b33f64f 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import version -from google.longrunning import operations_pb2 # type: ignore -from .base import VersionsTransport, DEFAULT_CLIENT_INFO +from google.cloud.appengine_admin_v1.types import appengine, version + +from .base import DEFAULT_CLIENT_INFO, VersionsTransport from .grpc import VersionsGrpcTransport diff --git a/google/cloud/appengine_admin_v1/types/__init__.py b/google/cloud/appengine_admin_v1/types/__init__.py index 92e52a7..aa1134f 100644 --- a/google/cloud/appengine_admin_v1/types/__init__.py +++ b/google/cloud/appengine_admin_v1/types/__init__.py @@ -16,19 +16,20 @@ from .app_yaml import ( ApiConfigHandler, ApiEndpointHandler, + AuthFailAction, ErrorHandler, HealthCheck, Library, LivenessCheck, + LoginRequirement, ReadinessCheck, ScriptHandler, + SecurityLevel, StaticFilesHandler, UrlMap, - AuthFailAction, - LoginRequirement, - SecurityLevel, ) from .appengine import ( + AuthorizedCertificateView, BatchUpdateIngressRulesRequest, BatchUpdateIngressRulesResponse, CreateApplicationRequest, @@ -43,6 +44,7 @@ DeleteInstanceRequest, DeleteServiceRequest, DeleteVersionRequest, + DomainOverrideStrategy, GetApplicationRequest, GetAuthorizedCertificateRequest, GetDomainMappingRequest, @@ -71,60 +73,25 @@ UpdateIngressRuleRequest, UpdateServiceRequest, UpdateVersionRequest, - AuthorizedCertificateView, - DomainOverrideStrategy, VersionView, ) -from .application import ( - Application, - UrlDispatchRule, -) -from .audit_data import ( - AuditData, - CreateVersionMethod, - UpdateServiceMethod, -) +from .application import Application, UrlDispatchRule +from .audit_data import AuditData, CreateVersionMethod, UpdateServiceMethod from .certificate import ( AuthorizedCertificate, CertificateRawData, ManagedCertificate, ManagementStatus, ) -from .deploy import ( - CloudBuildOptions, - ContainerInfo, - Deployment, - FileInfo, - ZipInfo, -) -from .domain import ( - AuthorizedDomain, -) -from .domain_mapping import ( - DomainMapping, - ResourceRecord, - SslSettings, -) -from .firewall import ( - FirewallRule, -) -from .instance import ( - Instance, -) -from .location import ( - LocationMetadata, -) -from .network_settings import ( - NetworkSettings, -) -from .operation import ( - CreateVersionMetadataV1, - OperationMetadataV1, -) -from .service import ( - Service, - TrafficSplit, -) +from .deploy import CloudBuildOptions, ContainerInfo, Deployment, FileInfo, ZipInfo +from .domain import AuthorizedDomain +from .domain_mapping import DomainMapping, ResourceRecord, SslSettings +from .firewall import FirewallRule +from .instance import Instance +from .location import LocationMetadata +from .network_settings import NetworkSettings +from .operation import CreateVersionMetadataV1, OperationMetadataV1 +from .service import Service, TrafficSplit from .version import ( AutomaticScaling, BasicScaling, @@ -132,17 +99,17 @@ DiskUtilization, EndpointsApiService, Entrypoint, + InboundServiceType, ManualScaling, Network, NetworkUtilization, RequestUtilization, Resources, + ServingStatus, StandardSchedulerSettings, Version, Volume, VpcAccessConnector, - InboundServiceType, - ServingStatus, ) __all__ = ( diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index e2c84db..7afff2e 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import duration_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index f4427c2..e706bc6 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -13,18 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore +from google.cloud.appengine_admin_v1.types import domain_mapping as ga_domain_mapping from google.cloud.appengine_admin_v1.types import application as ga_application from google.cloud.appengine_admin_v1.types import certificate as ga_certificate from google.cloud.appengine_admin_v1.types import domain -from google.cloud.appengine_admin_v1.types import domain_mapping as ga_domain_mapping -from google.cloud.appengine_admin_v1.types import firewall -from google.cloud.appengine_admin_v1.types import instance +from google.cloud.appengine_admin_v1.types import firewall, instance from google.cloud.appengine_admin_v1.types import service as ga_service from google.cloud.appengine_admin_v1.types import version as ga_version -from google.protobuf import field_mask_pb2 # type: ignore - __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index f7687e5..c51e52e 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import duration_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index 69de0cf..5de1cad 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -17,7 +17,6 @@ from google.cloud.appengine_admin_v1.types import appengine - __protobuf__ = proto.module( package="google.appengine.v1", manifest={ diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index 5288637..8466750 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index 857564e..4f48d4c 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import duration_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py index 92c3b53..5217582 100644 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ b/google/cloud/appengine_admin_v1/types/domain.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.appengine.v1", manifest={ diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index ba055ab..1a0227b 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.appengine.v1", manifest={ diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py index 4c35c94..bfca05e 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.appengine.v1", manifest={ diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index 29ec859..48479fc 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/location.py b/google/cloud/appengine_admin_v1/types/location.py index 2d333a6..d38b301 100644 --- a/google/cloud/appengine_admin_v1/types/location.py +++ b/google/cloud/appengine_admin_v1/types/location.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.appengine.v1", manifest={ diff --git a/google/cloud/appengine_admin_v1/types/network_settings.py b/google/cloud/appengine_admin_v1/types/network_settings.py index f931b83..4a27b4d 100644 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ b/google/cloud/appengine_admin_v1/types/network_settings.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.appengine.v1", manifest={ diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py index 873d2f5..6510e77 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index c42ffec..86d8437 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -19,7 +19,6 @@ network_settings as ga_network_settings, ) - __protobuf__ = proto.module( package="google.appengine.v1", manifest={ diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 0bd5458..fe48d5e 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -13,13 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.appengine_admin_v1.types import app_yaml -from google.cloud.appengine_admin_v1.types import deploy from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore +from google.cloud.appengine_admin_v1.types import app_yaml, deploy __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/noxfile.py b/noxfile.py index 35f3976..29d0200 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,6 +17,7 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import re diff --git a/owlbot.py b/owlbot.py index afb7005..13fffb7 100644 --- a/owlbot.py +++ b/owlbot.py @@ -1,10 +1,10 @@ -# Copyright 2021 Google LLC +# Copyright 2022 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 +# 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, @@ -12,40 +12,50 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This script is used to synthesize generated parts of this library.""" - -import os +import json +from pathlib import Path +import shutil import synthtool as s import synthtool.gcp as gcp from synthtool.languages import python -common = gcp.CommonTemplates() +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- + +clean_up_generated_samples = True -default_version = "v1" +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) for library in s.get_staging_dirs(default_version): - excludes=["setup.py", "README.rst", "docs/index.rst"] + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False - # See https://github.com/googleapis/gapic-generator-python/issues/825 - excludes.extend(["docs/appengine_admin_v1/services.rst"]) + excludes=["**/gapic_version.py"] - s.move(library, excludes=excludes) + # See https://github.com/googleapis/gapic-generator-python/issues/825 + excludes.extend(["docs/appengine_admin_v1/services.rst", "docs/index.rst"]) + s.move([library], excludes=excludes) s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library(cov_level=100, microgenerator=True) - -# the microgenerator has a good coveragerc file -excludes = [".coveragerc"] -s.move( - templated_files, excludes=excludes +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, + microgenerator=True, ) +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) python.py_samples(skip_readmes=True) -s.shell.run(["nox", "-s", "blacken"], hide_output=False) +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..fcf159e --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/appengine_admin/gapic_version.py" + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/setup.py b/setup.py index 753c20e..922a440 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,22 +13,36 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import io import os + import setuptools # type: ignore +package_root = os.path.abspath(os.path.dirname(__file__)) + name = "google-cloud-appengine-admin" -version = "1.5.3" -description = "App Engine Admin API client library" -release_status = "Development Status :: 5 - Production/Stable" -url = "https://github.com/googleapis/python-appengine-admin" + + +description = "Google Cloud Appengine Admin API client library" + +version = {} +with open( + os.path.join(package_root, "google/cloud/appengine_admin/gapic_version.py") +) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", ] +url = "https://github.com/googleapis/python-appengine-admin" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -37,6 +50,16 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") + setuptools.setup( name=name, version=version, @@ -46,26 +69,24 @@ author_email="googleapis-packages@google.com", license="Apache 2.0", url=url, - packages=[ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") - ], - namespace_packages=("google", "google.cloud"), - platforms="Posix; MacOS X; Windows", - include_package_data=True, - install_requires=dependencies, - python_requires=">=3.7", classifiers=[ release_status, "Intended Audience :: Developers", - "Operating System :: OS Independent", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Operating System :: OS Independent", "Topic :: Internet", - "Topic :: Software Development :: Libraries :: Python Modules", ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, zip_safe=False, ) diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.10.txt +++ b/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.11.txt +++ b/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index fb33557..aca9f2d 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -1,11 +1,11 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# 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.32.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +# This file is intentionally left empty to test the +# latest versions of dependencies. +google-api-core==1.33.2 proto-plus==1.22.0 -grpc-google-iam-v1==0.12.4 protobuf==3.19.5 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.8.txt +++ b/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 4760c52..cdb6687 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -22,38 +22,40 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.appengine_admin_v1.services.applications import ( - ApplicationsAsyncClient, -) -from google.cloud.appengine_admin_v1.services.applications import ApplicationsClient -from google.cloud.appengine_admin_v1.services.applications import transports -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import application -from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.longrunning import operations_pb2 from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.appengine_admin_v1.services.applications import ( + ApplicationsAsyncClient, + ApplicationsClient, + transports, +) +from google.cloud.appengine_admin_v1.types import appengine, application +from google.cloud.appengine_admin_v1.types import operation as ga_operation def client_cert_source_callback(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index e11ac46..60d680e 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -22,35 +22,30 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.appengine_admin_v1.services.authorized_certificates import ( AuthorizedCertificatesAsyncClient, -) -from google.cloud.appengine_admin_v1.services.authorized_certificates import ( AuthorizedCertificatesClient, + pagers, + transports, ) -from google.cloud.appengine_admin_v1.services.authorized_certificates import pagers -from google.cloud.appengine_admin_v1.services.authorized_certificates import transports -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import certificate -from google.oauth2 import service_account -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.appengine_admin_v1.types import appengine, certificate def client_cert_source_callback(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index 71acc23..faee289 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -22,33 +22,28 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.appengine_admin_v1.services.authorized_domains import ( AuthorizedDomainsAsyncClient, -) -from google.cloud.appengine_admin_v1.services.authorized_domains import ( AuthorizedDomainsClient, + pagers, + transports, ) -from google.cloud.appengine_admin_v1.services.authorized_domains import pagers -from google.cloud.appengine_admin_v1.services.authorized_domains import transports -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain -from google.oauth2 import service_account -import google.auth +from google.cloud.appengine_admin_v1.types import appengine, domain def client_cert_source_callback(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index e902ca3..e7095b9 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -22,40 +22,41 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.appengine_admin_v1.services.domain_mappings import ( DomainMappingsAsyncClient, -) -from google.cloud.appengine_admin_v1.services.domain_mappings import ( DomainMappingsClient, + pagers, + transports, ) -from google.cloud.appengine_admin_v1.services.domain_mappings import pagers -from google.cloud.appengine_admin_v1.services.domain_mappings import transports -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import domain_mapping +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.longrunning import operations_pb2 -from google.oauth2 import service_account -from google.protobuf import field_mask_pb2 # type: ignore -import google.auth def client_cert_source_callback(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index e71fa0e..b0fef84 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -22,30 +22,29 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.appengine_admin_v1.services.firewall import FirewallAsyncClient -from google.cloud.appengine_admin_v1.services.firewall import FirewallClient -from google.cloud.appengine_admin_v1.services.firewall import pagers -from google.cloud.appengine_admin_v1.services.firewall import transports -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import firewall from google.oauth2 import service_account from google.protobuf import field_mask_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.appengine_admin_v1.services.firewall import ( + FirewallAsyncClient, + FirewallClient, + pagers, + transports, +) +from google.cloud.appengine_admin_v1.types import appengine, firewall def client_cert_source_callback(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index b1fa2a9..9c35b1e 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -22,36 +22,41 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.appengine_admin_v1.services.instances import InstancesAsyncClient -from google.cloud.appengine_admin_v1.services.instances import InstancesClient -from google.cloud.appengine_admin_v1.services.instances import pagers -from google.cloud.appengine_admin_v1.services.instances import transports -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import instance -from google.cloud.appengine_admin_v1.types import operation as ga_operation from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import empty_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.appengine_admin_v1.services.instances import ( + InstancesAsyncClient, + InstancesClient, + pagers, + transports, +) +from google.cloud.appengine_admin_v1.types import appengine, instance +from google.cloud.appengine_admin_v1.types import operation as ga_operation def client_cert_source_callback(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 289b785..fea1894 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -22,37 +22,42 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.appengine_admin_v1.services.services import ServicesAsyncClient -from google.cloud.appengine_admin_v1.services.services import ServicesClient -from google.cloud.appengine_admin_v1.services.services import pagers -from google.cloud.appengine_admin_v1.services.services import transports -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import network_settings -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import service from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.appengine_admin_v1.services.services import ( + ServicesAsyncClient, + ServicesClient, + pagers, + transports, +) +from google.cloud.appengine_admin_v1.types import appengine, network_settings +from google.cloud.appengine_admin_v1.types import operation as ga_operation +from google.cloud.appengine_admin_v1.types import service def client_cert_source_callback(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index e1d0d3d..5cd663b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -22,40 +22,44 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.appengine_admin_v1.services.versions import VersionsAsyncClient -from google.cloud.appengine_admin_v1.services.versions import VersionsClient -from google.cloud.appengine_admin_v1.services.versions import pagers -from google.cloud.appengine_admin_v1.services.versions import transports -from google.cloud.appengine_admin_v1.types import app_yaml -from google.cloud.appengine_admin_v1.types import appengine -from google.cloud.appengine_admin_v1.types import deploy -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import version from google.longrunning import operations_pb2 from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.appengine_admin_v1.services.versions import ( + VersionsAsyncClient, + VersionsClient, + pagers, + transports, +) +from google.cloud.appengine_admin_v1.types import app_yaml, appengine, deploy +from google.cloud.appengine_admin_v1.types import operation as ga_operation +from google.cloud.appengine_admin_v1.types import version def client_cert_source_callback(): From 6dc0ef32331e642b3414ae759c9932def727cf35 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 14:26:27 -0500 Subject: [PATCH 25/73] chore(main): release 1.6.0 (#205) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1adaf63..0d1bebe 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.3" + ".": "1.6.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a7f0611..c3550b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.6.0](https://github.com/googleapis/python-appengine-admin/compare/v1.5.3...v1.6.0) (2022-11-08) + + +### Features + +* add support for `google.cloud.appengine_admin.__version__` ([2126361](https://github.com/googleapis/python-appengine-admin/commit/2126361cafcaed79633e7f403591a53a507972ba)) + + +### Bug Fixes + +* Add dict typing for client_options ([2126361](https://github.com/googleapis/python-appengine-admin/commit/2126361cafcaed79633e7f403591a53a507972ba)) +* **deps:** require google-api-core >=1.33.2 ([2126361](https://github.com/googleapis/python-appengine-admin/commit/2126361cafcaed79633e7f403591a53a507972ba)) + ## [1.5.3](https://github.com/googleapis/python-appengine-admin/compare/v1.5.2...v1.5.3) (2022-10-07) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index 9437340..a016bdf 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.5.3" # {x-release-please-version} +__version__ = "1.6.0" # {x-release-please-version} From 80bd28cf8f56ea3691aa08005445b81d8372e033 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 12 Nov 2022 08:35:26 -0500 Subject: [PATCH 26/73] chore: Update to gapic-generator-python 1.6.0 (#206) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: https://github.com/googleapis/googleapis/commit/da380c77bb87ba0f752baf07605dd1db30e1f7e1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: https://github.com/googleapis/googleapis/commit/5be5981f50322cf0c7388595e0f31ac5d0693469 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update path to snippet metadata json * fix docs build Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- docs/appengine_admin_v1/types.rst | 1 - .../services/applications/async_client.py | 42 ++-- .../services/applications/client.py | 35 ++- .../services/applications/transports/base.py | 2 +- .../services/applications/transports/grpc.py | 20 +- .../applications/transports/grpc_asyncio.py | 16 +- .../authorized_certificates/async_client.py | 56 +++-- .../authorized_certificates/client.py | 47 ++-- .../transports/base.py | 2 +- .../transports/grpc.py | 20 +- .../transports/grpc_asyncio.py | 16 +- .../authorized_domains/async_client.py | 22 +- .../services/authorized_domains/client.py | 21 +- .../authorized_domains/transports/base.py | 2 +- .../authorized_domains/transports/grpc.py | 20 +- .../transports/grpc_asyncio.py | 16 +- .../services/domain_mappings/async_client.py | 46 ++-- .../services/domain_mappings/client.py | 37 ++-- .../domain_mappings/transports/base.py | 2 +- .../domain_mappings/transports/grpc.py | 20 +- .../transports/grpc_asyncio.py | 16 +- .../services/firewall/async_client.py | 52 +++-- .../services/firewall/client.py | 41 ++-- .../services/firewall/transports/base.py | 2 +- .../services/firewall/transports/grpc.py | 20 +- .../firewall/transports/grpc_asyncio.py | 16 +- .../services/instances/async_client.py | 40 ++-- .../services/instances/client.py | 33 ++- .../services/instances/transports/base.py | 2 +- .../services/instances/transports/grpc.py | 20 +- .../instances/transports/grpc_asyncio.py | 16 +- .../services/services/async_client.py | 40 ++-- .../services/services/client.py | 33 ++- .../services/services/transports/base.py | 2 +- .../services/services/transports/grpc.py | 20 +- .../services/transports/grpc_asyncio.py | 16 +- .../services/versions/async_client.py | 46 ++-- .../services/versions/client.py | 37 ++-- .../services/versions/transports/base.py | 2 +- .../services/versions/transports/grpc.py | 20 +- .../versions/transports/grpc_asyncio.py | 16 +- .../appengine_admin_v1/types/app_yaml.py | 100 ++++----- .../appengine_admin_v1/types/appengine.py | 200 ++++++++--------- .../appengine_admin_v1/types/application.py | 52 ++--- .../appengine_admin_v1/types/audit_data.py | 10 +- .../appengine_admin_v1/types/certificate.py | 32 +-- .../cloud/appengine_admin_v1/types/deploy.py | 28 +-- .../cloud/appengine_admin_v1/types/domain.py | 6 +- .../types/domain_mapping.py | 24 +- .../appengine_admin_v1/types/firewall.py | 10 +- .../appengine_admin_v1/types/instance.py | 36 +-- .../appengine_admin_v1/types/location.py | 8 +- .../types/network_settings.py | 4 +- .../appengine_admin_v1/types/operation.py | 22 +- .../cloud/appengine_admin_v1/types/service.py | 20 +- .../cloud/appengine_admin_v1/types/version.py | 206 +++++++++--------- release-please-config.json | 7 +- ...snippet_metadata_google.appengine.v1.json} | 3 +- 58 files changed, 964 insertions(+), 737 deletions(-) rename samples/generated_samples/{snippet_metadata_appengine admin_v1.json => snippet_metadata_google.appengine.v1.json} (99%) diff --git a/docs/appengine_admin_v1/types.rst b/docs/appengine_admin_v1/types.rst index cc6979e..51f718b 100644 --- a/docs/appengine_admin_v1/types.rst +++ b/docs/appengine_admin_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Appengine Admin v1 API .. automodule:: google.cloud.appengine_admin_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index a01b26b..562386f 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -157,9 +167,9 @@ def transport(self) -> ApplicationsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ApplicationsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the applications client. @@ -203,11 +213,11 @@ def __init__( async def get_application( self, - request: Union[appengine.GetApplicationRequest, dict] = None, + request: Optional[Union[appengine.GetApplicationRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> application.Application: r"""Gets information about an application. @@ -238,7 +248,7 @@ async def sample_get_application(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]]): The request object. Request message for `Applications.GetApplication`. name (:class:`str`): @@ -305,10 +315,10 @@ async def sample_get_application(): async def create_application( self, - request: Union[appengine.CreateApplicationRequest, dict] = None, + request: Optional[Union[appengine.CreateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates an App Engine application for a Google Cloud Platform @@ -353,7 +363,7 @@ async def sample_create_application(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]]): The request object. Request message for `Applications.CreateApplication`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -402,10 +412,10 @@ async def sample_create_application(): async def update_application( self, - request: Union[appengine.UpdateApplicationRequest, dict] = None, + request: Optional[Union[appengine.UpdateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified Application resource. You can update the @@ -448,7 +458,7 @@ async def sample_update_application(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]]): The request object. Request message for `Applications.UpdateApplication`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -503,10 +513,10 @@ async def sample_update_application(): async def repair_application( self, - request: Union[appengine.RepairApplicationRequest, dict] = None, + request: Optional[Union[appengine.RepairApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Recreates the required App Engine features for the specified App @@ -551,7 +561,7 @@ async def sample_repair_application(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.RepairApplicationRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.RepairApplicationRequest, dict]]): The request object. Request message for 'Applications.RepairApplication'. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index cf1eb83..52217f8 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -60,7 +71,7 @@ class ApplicationsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ApplicationsTransport]: """Returns an appropriate transport class. @@ -313,7 +324,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ApplicationsTransport, None] = None, + transport: Optional[Union[str, ApplicationsTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -411,11 +422,11 @@ def __init__( def get_application( self, - request: Union[appengine.GetApplicationRequest, dict] = None, + request: Optional[Union[appengine.GetApplicationRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> application.Application: r"""Gets information about an application. @@ -513,10 +524,10 @@ def sample_get_application(): def create_application( self, - request: Union[appengine.CreateApplicationRequest, dict] = None, + request: Optional[Union[appengine.CreateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Creates an App Engine application for a Google Cloud Platform @@ -611,10 +622,10 @@ def sample_create_application(): def update_application( self, - request: Union[appengine.UpdateApplicationRequest, dict] = None, + request: Optional[Union[appengine.UpdateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the specified Application resource. You can update the @@ -713,10 +724,10 @@ def sample_update_application(): def repair_application( self, - request: Union[appengine.RepairApplicationRequest, dict] = None, + request: Optional[Union[appengine.RepairApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Recreates the required App Engine features for the specified App diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/base.py b/google/cloud/appengine_admin_v1/services/applications/transports/base.py index f004538..51740ea 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py index e62a9a3..820cc4d 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -47,14 +47,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py index 3e04368..174802d 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class ApplicationsGrpcAsyncIOTransport(ApplicationsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -92,15 +92,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index 3b13e69..6695956 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -165,9 +175,9 @@ def transport(self) -> AuthorizedCertificatesTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AuthorizedCertificatesTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the authorized certificates client. @@ -211,10 +221,12 @@ def __init__( async def list_authorized_certificates( self, - request: Union[appengine.ListAuthorizedCertificatesRequest, dict] = None, + request: Optional[ + Union[appengine.ListAuthorizedCertificatesRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedCertificatesAsyncPager: r"""Lists all SSL certificates the user is authorized to @@ -247,7 +259,7 @@ async def sample_list_authorized_certificates(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]]): The request object. Request message for `AuthorizedCertificates.ListAuthorizedCertificates`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -304,10 +316,12 @@ async def sample_list_authorized_certificates(): async def get_authorized_certificate( self, - request: Union[appengine.GetAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.GetAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. @@ -338,7 +352,7 @@ async def sample_get_authorized_certificate(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]]): The request object. Request message for `AuthorizedCertificates.GetAuthorizedCertificate`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -386,10 +400,12 @@ async def sample_get_authorized_certificate(): async def create_authorized_certificate( self, - request: Union[appengine.CreateAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.CreateAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. @@ -420,7 +436,7 @@ async def sample_create_authorized_certificate(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]]): The request object. Request message for `AuthorizedCertificates.CreateAuthorizedCertificate`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -468,10 +484,12 @@ async def sample_create_authorized_certificate(): async def update_authorized_certificate( self, - request: Union[appengine.UpdateAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.UpdateAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Updates the specified SSL certificate. To renew a certificate @@ -507,7 +525,7 @@ async def sample_update_authorized_certificate(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]]): The request object. Request message for `AuthorizedCertificates.UpdateAuthorizedCertificate`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -555,10 +573,12 @@ async def sample_update_authorized_certificate(): async def delete_authorized_certificate( self, - request: Union[appengine.DeleteAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.DeleteAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified SSL certificate. @@ -586,7 +606,7 @@ async def sample_delete_authorized_certificate(): await client.delete_authorized_certificate(request=request) Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]]): The request object. Request message for `AuthorizedCertificates.DeleteAuthorizedCertificate`. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index 2a5b15a..815cfc6 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -60,7 +71,7 @@ class AuthorizedCertificatesClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[AuthorizedCertificatesTransport]: """Returns an appropriate transport class. @@ -316,7 +327,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, AuthorizedCertificatesTransport, None] = None, + transport: Optional[Union[str, AuthorizedCertificatesTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -414,10 +425,12 @@ def __init__( def list_authorized_certificates( self, - request: Union[appengine.ListAuthorizedCertificatesRequest, dict] = None, + request: Optional[ + Union[appengine.ListAuthorizedCertificatesRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedCertificatesPager: r"""Lists all SSL certificates the user is authorized to @@ -510,10 +523,12 @@ def sample_list_authorized_certificates(): def get_authorized_certificate( self, - request: Union[appengine.GetAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.GetAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. @@ -595,10 +610,12 @@ def sample_get_authorized_certificate(): def create_authorized_certificate( self, - request: Union[appengine.CreateAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.CreateAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. @@ -680,10 +697,12 @@ def sample_create_authorized_certificate(): def update_authorized_certificate( self, - request: Union[appengine.UpdateAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.UpdateAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Updates the specified SSL certificate. To renew a certificate @@ -770,10 +789,12 @@ def sample_update_authorized_certificate(): def delete_authorized_certificate( self, - request: Union[appengine.DeleteAuthorizedCertificateRequest, dict] = None, + request: Optional[ + Union[appengine.DeleteAuthorizedCertificateRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified SSL certificate. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py index 52c1708..b59421d 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py index 01b0060..f887c33 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py @@ -49,14 +49,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -183,8 +183,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py index 0ba8371..a76db90 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py @@ -51,7 +51,7 @@ class AuthorizedCertificatesGrpcAsyncIOTransport(AuthorizedCertificatesTransport def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -94,15 +94,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 4af4c0d..c021a2e 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -160,9 +170,9 @@ def transport(self) -> AuthorizedDomainsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AuthorizedDomainsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the authorized domains client. @@ -206,10 +216,10 @@ def __init__( async def list_authorized_domains( self, - request: Union[appengine.ListAuthorizedDomainsRequest, dict] = None, + request: Optional[Union[appengine.ListAuthorizedDomainsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedDomainsAsyncPager: r"""Lists all domains the user is authorized to @@ -242,7 +252,7 @@ async def sample_list_authorized_domains(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]]): The request object. Request message for `AuthorizedDomains.ListAuthorizedDomains`. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index aa4cba1..760bf73 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -58,7 +69,7 @@ class AuthorizedDomainsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[AuthorizedDomainsTransport]: """Returns an appropriate transport class. @@ -314,7 +325,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, AuthorizedDomainsTransport, None] = None, + transport: Optional[Union[str, AuthorizedDomainsTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -412,10 +423,10 @@ def __init__( def list_authorized_domains( self, - request: Union[appengine.ListAuthorizedDomainsRequest, dict] = None, + request: Optional[Union[appengine.ListAuthorizedDomainsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedDomainsPager: r"""Lists all domains the user is authorized to diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py index a943bee..f74f018 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py @@ -52,7 +52,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py index 69c2624..264e6ae 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py @@ -48,14 +48,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py index 823f236..ae74509 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py @@ -50,7 +50,7 @@ class AuthorizedDomainsGrpcAsyncIOTransport(AuthorizedDomainsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +93,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 272c227..319e8a8 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -162,9 +172,9 @@ def transport(self) -> DomainMappingsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DomainMappingsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the domain mappings client. @@ -208,10 +218,10 @@ def __init__( async def list_domain_mappings( self, - request: Union[appengine.ListDomainMappingsRequest, dict] = None, + request: Optional[Union[appengine.ListDomainMappingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDomainMappingsAsyncPager: r"""Lists the domain mappings on an application. @@ -243,7 +253,7 @@ async def sample_list_domain_mappings(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]]): The request object. Request message for `DomainMappings.ListDomainMappings`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -299,10 +309,10 @@ async def sample_list_domain_mappings(): async def get_domain_mapping( self, - request: Union[appengine.GetDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.GetDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. @@ -333,7 +343,7 @@ async def sample_get_domain_mapping(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]]): The request object. Request message for `DomainMappings.GetDomainMapping`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -378,10 +388,10 @@ async def sample_get_domain_mapping(): async def create_domain_mapping( self, - request: Union[appengine.CreateDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.CreateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Maps a domain to an application. A user must be authorized to @@ -419,7 +429,7 @@ async def sample_create_domain_mapping(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]]): The request object. Request message for `DomainMappings.CreateDomainMapping`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -475,10 +485,10 @@ async def sample_create_domain_mapping(): async def update_domain_mapping( self, - request: Union[appengine.UpdateDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.UpdateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified domain mapping. To map an SSL certificate @@ -517,7 +527,7 @@ async def sample_update_domain_mapping(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]]): The request object. Request message for `DomainMappings.UpdateDomainMapping`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -573,10 +583,10 @@ async def sample_update_domain_mapping(): async def delete_domain_mapping( self, - request: Union[appengine.DeleteDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.DeleteDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the specified domain mapping. A user must be authorized @@ -613,7 +623,7 @@ async def sample_delete_domain_mapping(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]]): The request object. Request message for `DomainMappings.DeleteDomainMapping`. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index e5e7e90..127254a 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -63,7 +74,7 @@ class DomainMappingsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DomainMappingsTransport]: """Returns an appropriate transport class. @@ -316,7 +327,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DomainMappingsTransport, None] = None, + transport: Optional[Union[str, DomainMappingsTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -414,10 +425,10 @@ def __init__( def list_domain_mappings( self, - request: Union[appengine.ListDomainMappingsRequest, dict] = None, + request: Optional[Union[appengine.ListDomainMappingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDomainMappingsPager: r"""Lists the domain mappings on an application. @@ -506,10 +517,10 @@ def sample_list_domain_mappings(): def get_domain_mapping( self, - request: Union[appengine.GetDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.GetDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. @@ -586,10 +597,10 @@ def sample_get_domain_mapping(): def create_domain_mapping( self, - request: Union[appengine.CreateDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.CreateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Maps a domain to an application. A user must be authorized to @@ -684,10 +695,10 @@ def sample_create_domain_mapping(): def update_domain_mapping( self, - request: Union[appengine.UpdateDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.UpdateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the specified domain mapping. To map an SSL certificate @@ -783,10 +794,10 @@ def sample_update_domain_mapping(): def delete_domain_mapping( self, - request: Union[appengine.DeleteDomainMappingRequest, dict] = None, + request: Optional[Union[appengine.DeleteDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deletes the specified domain mapping. A user must be authorized diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py index a38b79c..9fc3f0c 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py index 15b61c6..1523661 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py @@ -47,14 +47,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py index 80fb4cf..588ef7b 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class DomainMappingsGrpcAsyncIOTransport(DomainMappingsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -92,15 +92,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index c064b0a..140c5c3 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -160,9 +170,9 @@ def transport(self) -> FirewallTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, FirewallTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the firewall client. @@ -206,10 +216,10 @@ def __init__( async def list_ingress_rules( self, - request: Union[appengine.ListIngressRulesRequest, dict] = None, + request: Optional[Union[appengine.ListIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIngressRulesAsyncPager: r"""Lists the firewall rules of an application. @@ -241,7 +251,7 @@ async def sample_list_ingress_rules(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]]): The request object. Request message for `Firewall.ListIngressRules`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -297,10 +307,10 @@ async def sample_list_ingress_rules(): async def batch_update_ingress_rules( self, - request: Union[appengine.BatchUpdateIngressRulesRequest, dict] = None, + request: Optional[Union[appengine.BatchUpdateIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> appengine.BatchUpdateIngressRulesResponse: r"""Replaces the entire firewall ruleset in one bulk operation. This @@ -337,7 +347,7 @@ async def sample_batch_update_ingress_rules(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]]): The request object. Request message for `Firewall.BatchUpdateIngressRules`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -380,10 +390,10 @@ async def sample_batch_update_ingress_rules(): async def create_ingress_rule( self, - request: Union[appengine.CreateIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.CreateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. @@ -414,7 +424,7 @@ async def sample_create_ingress_rule(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]]): The request object. Request message for `Firewall.CreateIngressRule`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -461,10 +471,10 @@ async def sample_create_ingress_rule(): async def get_ingress_rule( self, - request: Union[appengine.GetIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.GetIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. @@ -495,7 +505,7 @@ async def sample_get_ingress_rule(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]]): The request object. Request message for `Firewall.GetIngressRule`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -542,10 +552,10 @@ async def sample_get_ingress_rule(): async def update_ingress_rule( self, - request: Union[appengine.UpdateIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.UpdateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. @@ -576,7 +586,7 @@ async def sample_update_ingress_rule(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]]): The request object. Request message for `Firewall.UpdateIngressRule`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -623,10 +633,10 @@ async def sample_update_ingress_rule(): async def delete_ingress_rule( self, - request: Union[appengine.DeleteIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.DeleteIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified firewall rule. @@ -654,7 +664,7 @@ async def sample_delete_ingress_rule(): await client.delete_ingress_rule(request=request) Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]]): The request object. Request message for `Firewall.DeleteIngressRule`. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index f0cea22..4b1f219 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -56,7 +67,7 @@ class FirewallClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[FirewallTransport]: """Returns an appropriate transport class. @@ -320,7 +331,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, FirewallTransport, None] = None, + transport: Optional[Union[str, FirewallTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -418,10 +429,10 @@ def __init__( def list_ingress_rules( self, - request: Union[appengine.ListIngressRulesRequest, dict] = None, + request: Optional[Union[appengine.ListIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIngressRulesPager: r"""Lists the firewall rules of an application. @@ -510,10 +521,10 @@ def sample_list_ingress_rules(): def batch_update_ingress_rules( self, - request: Union[appengine.BatchUpdateIngressRulesRequest, dict] = None, + request: Optional[Union[appengine.BatchUpdateIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> appengine.BatchUpdateIngressRulesResponse: r"""Replaces the entire firewall ruleset in one bulk operation. This @@ -596,10 +607,10 @@ def sample_batch_update_ingress_rules(): def create_ingress_rule( self, - request: Union[appengine.CreateIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.CreateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. @@ -678,10 +689,10 @@ def sample_create_ingress_rule(): def get_ingress_rule( self, - request: Union[appengine.GetIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.GetIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. @@ -760,10 +771,10 @@ def sample_get_ingress_rule(): def update_ingress_rule( self, - request: Union[appengine.UpdateIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.UpdateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. @@ -842,10 +853,10 @@ def sample_update_ingress_rule(): def delete_ingress_rule( self, - request: Union[appengine.DeleteIngressRuleRequest, dict] = None, + request: Optional[Union[appengine.DeleteIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified firewall rule. diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py index f643e88..252df36 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py index 1d75599..35fe7ce 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -57,14 +57,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -191,8 +191,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py index 4d1ca72..c1cabc8 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py @@ -59,7 +59,7 @@ class FirewallGrpcAsyncIOTransport(FirewallTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -102,15 +102,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index eee9e33..1cafa52 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -159,9 +169,9 @@ def transport(self) -> InstancesTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, InstancesTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the instances client. @@ -205,10 +215,10 @@ def __init__( async def list_instances( self, - request: Union[appengine.ListInstancesRequest, dict] = None, + request: Optional[Union[appengine.ListInstancesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesAsyncPager: r"""Lists the instances of a version. @@ -244,7 +254,7 @@ async def sample_list_instances(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]]): The request object. Request message for `Instances.ListInstances`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -300,10 +310,10 @@ async def sample_list_instances(): async def get_instance( self, - request: Union[appengine.GetInstanceRequest, dict] = None, + request: Optional[Union[appengine.GetInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instance.Instance: r"""Gets instance information. @@ -334,7 +344,7 @@ async def sample_get_instance(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]]): The request object. Request message for `Instances.GetInstance`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -380,10 +390,10 @@ async def sample_get_instance(): async def delete_instance( self, - request: Union[appengine.DeleteInstanceRequest, dict] = None, + request: Optional[Union[appengine.DeleteInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Stops a running instance. @@ -432,7 +442,7 @@ async def sample_delete_instance(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]]): The request object. Request message for `Instances.DeleteInstance`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -495,10 +505,10 @@ async def sample_delete_instance(): async def debug_instance( self, - request: Union[appengine.DebugInstanceRequest, dict] = None, + request: Optional[Union[appengine.DebugInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Enables debugging on a VM instance. This allows you @@ -542,7 +552,7 @@ async def sample_debug_instance(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]]): The request object. Request message for `Instances.DebugInstance`. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index f12dcbb..6e61c63 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -62,7 +73,7 @@ class InstancesClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[InstancesTransport]: """Returns an appropriate transport class. @@ -339,7 +350,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, InstancesTransport, None] = None, + transport: Optional[Union[str, InstancesTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -437,10 +448,10 @@ def __init__( def list_instances( self, - request: Union[appengine.ListInstancesRequest, dict] = None, + request: Optional[Union[appengine.ListInstancesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesPager: r"""Lists the instances of a version. @@ -533,10 +544,10 @@ def sample_list_instances(): def get_instance( self, - request: Union[appengine.GetInstanceRequest, dict] = None, + request: Optional[Union[appengine.GetInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instance.Instance: r"""Gets instance information. @@ -614,10 +625,10 @@ def sample_get_instance(): def delete_instance( self, - request: Union[appengine.DeleteInstanceRequest, dict] = None, + request: Optional[Union[appengine.DeleteInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Stops a running instance. @@ -730,10 +741,10 @@ def sample_delete_instance(): def debug_instance( self, - request: Union[appengine.DebugInstanceRequest, dict] = None, + request: Optional[Union[appengine.DebugInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Enables debugging on a VM instance. This allows you diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/base.py b/google/cloud/appengine_admin_v1/services/instances/transports/base.py index e8492c5..31325b3 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py index 4cc0dc3..029a436 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -47,14 +47,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py index 01c418a..c1bedd2 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class InstancesGrpcAsyncIOTransport(InstancesTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -92,15 +92,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 636c963..242c602 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -155,9 +165,9 @@ def transport(self) -> ServicesTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ServicesTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the services client. @@ -201,10 +211,10 @@ def __init__( async def list_services( self, - request: Union[appengine.ListServicesRequest, dict] = None, + request: Optional[Union[appengine.ListServicesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesAsyncPager: r"""Lists all the services in the application. @@ -236,7 +246,7 @@ async def sample_list_services(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]]): The request object. Request message for `Services.ListServices`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -292,10 +302,10 @@ async def sample_list_services(): async def get_service( self, - request: Union[appengine.GetServiceRequest, dict] = None, + request: Optional[Union[appengine.GetServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.Service: r"""Gets the current configuration of the specified @@ -327,7 +337,7 @@ async def sample_get_service(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]]): The request object. Request message for `Services.GetService`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -382,10 +392,10 @@ async def sample_get_service(): async def update_service( self, - request: Union[appengine.UpdateServiceRequest, dict] = None, + request: Optional[Union[appengine.UpdateServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the configuration of the specified service. @@ -420,7 +430,7 @@ async def sample_update_service(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]]): The request object. Request message for `Services.UpdateService`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -482,10 +492,10 @@ async def sample_update_service(): async def delete_service( self, - request: Union[appengine.DeleteServiceRequest, dict] = None, + request: Optional[Union[appengine.DeleteServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the specified service and all enclosed @@ -521,7 +531,7 @@ async def sample_delete_service(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]]): The request object. Request message for `Services.DeleteService`. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 0c47b3f..b1beb5c 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -62,7 +73,7 @@ class ServicesClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ServicesTransport]: """Returns an appropriate transport class. @@ -315,7 +326,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ServicesTransport, None] = None, + transport: Optional[Union[str, ServicesTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -413,10 +424,10 @@ def __init__( def list_services( self, - request: Union[appengine.ListServicesRequest, dict] = None, + request: Optional[Union[appengine.ListServicesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesPager: r"""Lists all the services in the application. @@ -505,10 +516,10 @@ def sample_list_services(): def get_service( self, - request: Union[appengine.GetServiceRequest, dict] = None, + request: Optional[Union[appengine.GetServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.Service: r"""Gets the current configuration of the specified @@ -596,10 +607,10 @@ def sample_get_service(): def update_service( self, - request: Union[appengine.UpdateServiceRequest, dict] = None, + request: Optional[Union[appengine.UpdateServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the configuration of the specified service. @@ -697,10 +708,10 @@ def sample_update_service(): def delete_service( self, - request: Union[appengine.DeleteServiceRequest, dict] = None, + request: Optional[Union[appengine.DeleteServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deletes the specified service and all enclosed diff --git a/google/cloud/appengine_admin_v1/services/services/transports/base.py b/google/cloud/appengine_admin_v1/services/services/transports/base.py index 3b68e2b..f6eb783 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py index f35d7c8..ae77bde 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -47,14 +47,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py index 92c4ff3..3013788 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class ServicesGrpcAsyncIOTransport(ServicesTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -92,15 +92,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index fc652e5..71f50d0 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -157,9 +167,9 @@ def transport(self) -> VersionsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, VersionsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the versions client. @@ -203,10 +213,10 @@ def __init__( async def list_versions( self, - request: Union[appengine.ListVersionsRequest, dict] = None, + request: Optional[Union[appengine.ListVersionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVersionsAsyncPager: r"""Lists the versions of a service. @@ -238,7 +248,7 @@ async def sample_list_versions(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]]): The request object. Request message for `Versions.ListVersions`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -294,10 +304,10 @@ async def sample_list_versions(): async def get_version( self, - request: Union[appengine.GetVersionRequest, dict] = None, + request: Optional[Union[appengine.GetVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> version.Version: r"""Gets the specified Version resource. By default, only a @@ -330,7 +340,7 @@ async def sample_get_version(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]]): The request object. Request message for `Versions.GetVersion`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -376,10 +386,10 @@ async def sample_get_version(): async def create_version( self, - request: Union[appengine.CreateVersionRequest, dict] = None, + request: Optional[Union[appengine.CreateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deploys code and resource files to a new version. @@ -414,7 +424,7 @@ async def sample_create_version(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]]): The request object. Request message for `Versions.CreateVersion`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -469,10 +479,10 @@ async def sample_create_version(): async def update_version( self, - request: Union[appengine.UpdateVersionRequest, dict] = None, + request: Optional[Union[appengine.UpdateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified Version resource. You can specify the @@ -542,7 +552,7 @@ async def sample_update_version(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]]): The request object. Request message for `Versions.UpdateVersion`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -597,10 +607,10 @@ async def sample_update_version(): async def delete_version( self, - request: Union[appengine.DeleteVersionRequest, dict] = None, + request: Optional[Union[appengine.DeleteVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes an existing Version resource. @@ -635,7 +645,7 @@ async def sample_delete_version(): print(response) Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]): + request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]]): The request object. Request message for `Versions.DeleteVersion`. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index e765f75..0425e51 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -64,7 +75,7 @@ class VersionsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[VersionsTransport]: """Returns an appropriate transport class. @@ -317,7 +328,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, VersionsTransport, None] = None, + transport: Optional[Union[str, VersionsTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -415,10 +426,10 @@ def __init__( def list_versions( self, - request: Union[appengine.ListVersionsRequest, dict] = None, + request: Optional[Union[appengine.ListVersionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVersionsPager: r"""Lists the versions of a service. @@ -507,10 +518,10 @@ def sample_list_versions(): def get_version( self, - request: Union[appengine.GetVersionRequest, dict] = None, + request: Optional[Union[appengine.GetVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> version.Version: r"""Gets the specified Version resource. By default, only a @@ -590,10 +601,10 @@ def sample_get_version(): def create_version( self, - request: Union[appengine.CreateVersionRequest, dict] = None, + request: Optional[Union[appengine.CreateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deploys code and resource files to a new version. @@ -684,10 +695,10 @@ def sample_create_version(): def update_version( self, - request: Union[appengine.UpdateVersionRequest, dict] = None, + request: Optional[Union[appengine.UpdateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the specified Version resource. You can specify the @@ -813,10 +824,10 @@ def sample_update_version(): def delete_version( self, - request: Union[appengine.DeleteVersionRequest, dict] = None, + request: Optional[Union[appengine.DeleteVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deletes an existing Version resource. diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/base.py b/google/cloud/appengine_admin_v1/services/versions/transports/base.py index d9ae526..1addb34 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py index c31a651..95db790 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -47,14 +47,14 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - 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, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py index b33f64f..f0f1e64 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py @@ -49,7 +49,7 @@ class VersionsGrpcAsyncIOTransport(VersionsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -92,15 +92,15 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - 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, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 7afff2e..1f1f30f 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import duration_pb2 # type: ignore import proto # type: ignore @@ -82,26 +84,26 @@ class ApiConfigHandler(proto.Message): URL to serve the endpoint at. """ - auth_fail_action = proto.Field( + auth_fail_action: "AuthFailAction" = proto.Field( proto.ENUM, number=1, enum="AuthFailAction", ) - login = proto.Field( + login: "LoginRequirement" = proto.Field( proto.ENUM, number=2, enum="LoginRequirement", ) - script = proto.Field( + script: str = proto.Field( proto.STRING, number=3, ) - security_level = proto.Field( + security_level: "SecurityLevel" = proto.Field( proto.ENUM, number=4, enum="SecurityLevel", ) - url = proto.Field( + url: str = proto.Field( proto.STRING, number=5, ) @@ -129,16 +131,16 @@ class ErrorCode(proto.Enum): ERROR_CODE_DOS_API_DENIAL = 2 ERROR_CODE_TIMEOUT = 3 - error_code = proto.Field( + error_code: ErrorCode = proto.Field( proto.ENUM, number=1, enum=ErrorCode, ) - static_file = proto.Field( + static_file: str = proto.Field( proto.STRING, number=2, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=3, ) @@ -203,44 +205,44 @@ class RedirectHttpResponseCode(proto.Enum): REDIRECT_HTTP_RESPONSE_CODE_303 = 3 REDIRECT_HTTP_RESPONSE_CODE_307 = 4 - url_regex = proto.Field( + url_regex: str = proto.Field( proto.STRING, number=1, ) - static_files = proto.Field( + static_files: "StaticFilesHandler" = proto.Field( proto.MESSAGE, number=2, oneof="handler_type", message="StaticFilesHandler", ) - script = proto.Field( + script: "ScriptHandler" = proto.Field( proto.MESSAGE, number=3, oneof="handler_type", message="ScriptHandler", ) - api_endpoint = proto.Field( + api_endpoint: "ApiEndpointHandler" = proto.Field( proto.MESSAGE, number=4, oneof="handler_type", message="ApiEndpointHandler", ) - security_level = proto.Field( + security_level: "SecurityLevel" = proto.Field( proto.ENUM, number=5, enum="SecurityLevel", ) - login = proto.Field( + login: "LoginRequirement" = proto.Field( proto.ENUM, number=6, enum="LoginRequirement", ) - auth_fail_action = proto.Field( + auth_fail_action: "AuthFailAction" = proto.Field( proto.ENUM, number=7, enum="AuthFailAction", ) - redirect_http_response_code = proto.Field( + redirect_http_response_code: RedirectHttpResponseCode = proto.Field( proto.ENUM, number=8, enum=RedirectHttpResponseCode, @@ -263,7 +265,7 @@ class StaticFilesHandler(proto.Message): Regular expression that matches the file paths for all files that should be referenced by this handler. - http_headers (Mapping[str, str]): + http_headers (MutableMapping[str, str]): HTTP headers to use for all responses from these URLs. mime_type (str): @@ -288,33 +290,33 @@ class StaticFilesHandler(proto.Message): resource quotas. """ - path = proto.Field( + path: str = proto.Field( proto.STRING, number=1, ) - upload_path_regex = proto.Field( + upload_path_regex: str = proto.Field( proto.STRING, number=2, ) - http_headers = proto.MapField( + http_headers: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=3, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=4, ) - expiration = proto.Field( + expiration: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=5, message=duration_pb2.Duration, ) - require_matching_file = proto.Field( + require_matching_file: bool = proto.Field( proto.BOOL, number=6, ) - application_readable = proto.Field( + application_readable: bool = proto.Field( proto.BOOL, number=7, ) @@ -330,7 +332,7 @@ class ScriptHandler(proto.Message): directory. """ - script_path = proto.Field( + script_path: str = proto.Field( proto.STRING, number=1, ) @@ -345,7 +347,7 @@ class ApiEndpointHandler(proto.Message): directory. """ - script_path = proto.Field( + script_path: str = proto.Field( proto.STRING, number=1, ) @@ -379,32 +381,32 @@ class HealthCheck(proto.Message): failed. """ - disable_health_check = proto.Field( + disable_health_check: bool = proto.Field( proto.BOOL, number=1, ) - host = proto.Field( + host: str = proto.Field( proto.STRING, number=2, ) - healthy_threshold = proto.Field( + healthy_threshold: int = proto.Field( proto.UINT32, number=3, ) - unhealthy_threshold = proto.Field( + unhealthy_threshold: int = proto.Field( proto.UINT32, number=4, ) - restart_threshold = proto.Field( + restart_threshold: int = proto.Field( proto.UINT32, number=5, ) - check_interval = proto.Field( + check_interval: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=6, message=duration_pb2.Duration, ) - timeout = proto.Field( + timeout: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=7, message=duration_pb2.Duration, @@ -438,33 +440,33 @@ class ReadinessCheck(proto.Message): healthcheck until it is ready to serve traffic. """ - path = proto.Field( + path: str = proto.Field( proto.STRING, number=1, ) - host = proto.Field( + host: str = proto.Field( proto.STRING, number=2, ) - failure_threshold = proto.Field( + failure_threshold: int = proto.Field( proto.UINT32, number=3, ) - success_threshold = proto.Field( + success_threshold: int = proto.Field( proto.UINT32, number=4, ) - check_interval = proto.Field( + check_interval: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=5, message=duration_pb2.Duration, ) - timeout = proto.Field( + timeout: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=6, message=duration_pb2.Duration, ) - app_start_timeout = proto.Field( + app_start_timeout: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=7, message=duration_pb2.Duration, @@ -496,33 +498,33 @@ class LivenessCheck(proto.Message): the checks. """ - path = proto.Field( + path: str = proto.Field( proto.STRING, number=1, ) - host = proto.Field( + host: str = proto.Field( proto.STRING, number=2, ) - failure_threshold = proto.Field( + failure_threshold: int = proto.Field( proto.UINT32, number=3, ) - success_threshold = proto.Field( + success_threshold: int = proto.Field( proto.UINT32, number=4, ) - check_interval = proto.Field( + check_interval: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=5, message=duration_pb2.Duration, ) - timeout = proto.Field( + timeout: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=6, message=duration_pb2.Duration, ) - initial_delay = proto.Field( + initial_delay: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=7, message=duration_pb2.Duration, @@ -541,11 +543,11 @@ class Library(proto.Message): "latest". """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - version = proto.Field( + version: str = proto.Field( proto.STRING, number=2, ) diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index e706bc6..3b24d8e 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore @@ -108,7 +110,7 @@ class GetApplicationRequest(proto.Message): ``apps/myapp``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -122,7 +124,7 @@ class CreateApplicationRequest(proto.Message): Application configuration. """ - application = proto.Field( + application: ga_application.Application = proto.Field( proto.MESSAGE, number=2, message=ga_application.Application, @@ -144,16 +146,16 @@ class UpdateApplicationRequest(proto.Message): fields to be updated. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - application = proto.Field( + application: ga_application.Application = proto.Field( proto.MESSAGE, number=2, message=ga_application.Application, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -168,7 +170,7 @@ class RepairApplicationRequest(proto.Message): Name of the application to repair. Example: ``apps/myapp`` """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -188,15 +190,15 @@ class ListServicesRequest(proto.Message): of results. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -206,7 +208,7 @@ class ListServicesResponse(proto.Message): r"""Response message for ``Services.ListServices``. Attributes: - services (Sequence[google.cloud.appengine_admin_v1.types.Service]): + services (MutableSequence[google.cloud.appengine_admin_v1.types.Service]): The services belonging to the requested application. next_page_token (str): @@ -218,12 +220,12 @@ class ListServicesResponse(proto.Message): def raw_page(self): return self - services = proto.RepeatedField( + services: MutableSequence[ga_service.Service] = proto.RepeatedField( proto.MESSAGE, number=1, message=ga_service.Service, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -238,7 +240,7 @@ class GetServiceRequest(proto.Message): ``apps/myapp/services/default``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -275,21 +277,21 @@ class UpdateServiceRequest(proto.Message): Traffic `__. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - service = proto.Field( + service: ga_service.Service = proto.Field( proto.MESSAGE, number=2, message=ga_service.Service, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, ) - migrate_traffic = proto.Field( + migrate_traffic: bool = proto.Field( proto.BOOL, number=4, ) @@ -304,7 +306,7 @@ class DeleteServiceRequest(proto.Message): ``apps/myapp/services/default``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -327,20 +329,20 @@ class ListVersionsRequest(proto.Message): of results. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: "VersionView" = proto.Field( proto.ENUM, number=2, enum="VersionView", ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -350,7 +352,7 @@ class ListVersionsResponse(proto.Message): r"""Response message for ``Versions.ListVersions``. Attributes: - versions (Sequence[google.cloud.appengine_admin_v1.types.Version]): + versions (MutableSequence[google.cloud.appengine_admin_v1.types.Version]): The versions belonging to the requested service. next_page_token (str): @@ -362,12 +364,12 @@ class ListVersionsResponse(proto.Message): def raw_page(self): return self - versions = proto.RepeatedField( + versions: MutableSequence[ga_version.Version] = proto.RepeatedField( proto.MESSAGE, number=1, message=ga_version.Version, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -384,11 +386,11 @@ class GetVersionRequest(proto.Message): Controls the set of fields returned in the ``Get`` response. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: "VersionView" = proto.Field( proto.ENUM, number=2, enum="VersionView", @@ -406,11 +408,11 @@ class CreateVersionRequest(proto.Message): Application deployment configuration. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - version = proto.Field( + version: ga_version.Version = proto.Field( proto.MESSAGE, number=2, message=ga_version.Version, @@ -433,16 +435,16 @@ class UpdateVersionRequest(proto.Message): be updated. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - version = proto.Field( + version: ga_version.Version = proto.Field( proto.MESSAGE, number=2, message=ga_version.Version, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -458,7 +460,7 @@ class DeleteVersionRequest(proto.Message): ``apps/myapp/services/default/versions/v1``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -478,15 +480,15 @@ class ListInstancesRequest(proto.Message): of results. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -496,7 +498,7 @@ class ListInstancesResponse(proto.Message): r"""Response message for ``Instances.ListInstances``. Attributes: - instances (Sequence[google.cloud.appengine_admin_v1.types.Instance]): + instances (MutableSequence[google.cloud.appengine_admin_v1.types.Instance]): The instances belonging to the requested version. next_page_token (str): @@ -508,12 +510,12 @@ class ListInstancesResponse(proto.Message): def raw_page(self): return self - instances = proto.RepeatedField( + instances: MutableSequence[instance.Instance] = proto.RepeatedField( proto.MESSAGE, number=1, message=instance.Instance, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -528,7 +530,7 @@ class GetInstanceRequest(proto.Message): ``apps/myapp/services/default/versions/v1/instances/instance-1``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -543,7 +545,7 @@ class DeleteInstanceRequest(proto.Message): ``apps/myapp/services/default/versions/v1/instances/instance-1``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -566,11 +568,11 @@ class DebugInstanceRequest(proto.Message): Keys `__. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - ssh_key = proto.Field( + ssh_key: str = proto.Field( proto.STRING, number=2, ) @@ -595,19 +597,19 @@ class ListIngressRulesRequest(proto.Message): on requests from this IP. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - matching_address = proto.Field( + matching_address: str = proto.Field( proto.STRING, number=4, ) @@ -617,7 +619,7 @@ class ListIngressRulesResponse(proto.Message): r"""Response message for ``Firewall.ListIngressRules``. Attributes: - ingress_rules (Sequence[google.cloud.appengine_admin_v1.types.FirewallRule]): + ingress_rules (MutableSequence[google.cloud.appengine_admin_v1.types.FirewallRule]): The ingress FirewallRules for this application. next_page_token (str): @@ -629,12 +631,12 @@ class ListIngressRulesResponse(proto.Message): def raw_page(self): return self - ingress_rules = proto.RepeatedField( + ingress_rules: MutableSequence[firewall.FirewallRule] = proto.RepeatedField( proto.MESSAGE, number=1, message=firewall.FirewallRule, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -647,16 +649,16 @@ class BatchUpdateIngressRulesRequest(proto.Message): name (str): Name of the Firewall collection to set. Example: ``apps/myapp/firewall/ingressRules``. - ingress_rules (Sequence[google.cloud.appengine_admin_v1.types.FirewallRule]): + ingress_rules (MutableSequence[google.cloud.appengine_admin_v1.types.FirewallRule]): A list of FirewallRules to replace the existing set. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - ingress_rules = proto.RepeatedField( + ingress_rules: MutableSequence[firewall.FirewallRule] = proto.RepeatedField( proto.MESSAGE, number=2, message=firewall.FirewallRule, @@ -667,12 +669,12 @@ class BatchUpdateIngressRulesResponse(proto.Message): r"""Response message for ``Firewall.UpdateAllIngressRules``. Attributes: - ingress_rules (Sequence[google.cloud.appengine_admin_v1.types.FirewallRule]): + ingress_rules (MutableSequence[google.cloud.appengine_admin_v1.types.FirewallRule]): The full list of ingress FirewallRules for this application. """ - ingress_rules = proto.RepeatedField( + ingress_rules: MutableSequence[firewall.FirewallRule] = proto.RepeatedField( proto.MESSAGE, number=1, message=firewall.FirewallRule, @@ -701,11 +703,11 @@ class CreateIngressRuleRequest(proto.Message): or deny-all rule. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - rule = proto.Field( + rule: firewall.FirewallRule = proto.Field( proto.MESSAGE, number=2, message=firewall.FirewallRule, @@ -721,7 +723,7 @@ class GetIngressRuleRequest(proto.Message): ``apps/myapp/firewall/ingressRules/100``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -742,16 +744,16 @@ class UpdateIngressRuleRequest(proto.Message): be updated. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - rule = proto.Field( + rule: firewall.FirewallRule = proto.Field( proto.MESSAGE, number=2, message=firewall.FirewallRule, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -767,7 +769,7 @@ class DeleteIngressRuleRequest(proto.Message): ``apps/myapp/firewall/ingressRules/100``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -787,15 +789,15 @@ class ListAuthorizedDomainsRequest(proto.Message): of results. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -805,7 +807,7 @@ class ListAuthorizedDomainsResponse(proto.Message): r"""Response message for ``AuthorizedDomains.ListAuthorizedDomains``. Attributes: - domains (Sequence[google.cloud.appengine_admin_v1.types.AuthorizedDomain]): + domains (MutableSequence[google.cloud.appengine_admin_v1.types.AuthorizedDomain]): The authorized domains belonging to the user. next_page_token (str): Continuation token for fetching the next page @@ -816,12 +818,12 @@ class ListAuthorizedDomainsResponse(proto.Message): def raw_page(self): return self - domains = proto.RepeatedField( + domains: MutableSequence[domain.AuthorizedDomain] = proto.RepeatedField( proto.MESSAGE, number=1, message=domain.AuthorizedDomain, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -845,20 +847,20 @@ class ListAuthorizedCertificatesRequest(proto.Message): of results. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: "AuthorizedCertificateView" = proto.Field( proto.ENUM, number=4, enum="AuthorizedCertificateView", ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -869,7 +871,7 @@ class ListAuthorizedCertificatesResponse(proto.Message): ``AuthorizedCertificates.ListAuthorizedCertificates``. Attributes: - certificates (Sequence[google.cloud.appengine_admin_v1.types.AuthorizedCertificate]): + certificates (MutableSequence[google.cloud.appengine_admin_v1.types.AuthorizedCertificate]): The SSL certificates the user is authorized to administer. next_page_token (str): @@ -881,12 +883,14 @@ class ListAuthorizedCertificatesResponse(proto.Message): def raw_page(self): return self - certificates = proto.RepeatedField( + certificates: MutableSequence[ + ga_certificate.AuthorizedCertificate + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=ga_certificate.AuthorizedCertificate, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -904,11 +908,11 @@ class GetAuthorizedCertificateRequest(proto.Message): Controls the set of fields returned in the ``GET`` response. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: "AuthorizedCertificateView" = proto.Field( proto.ENUM, number=2, enum="AuthorizedCertificateView", @@ -927,11 +931,11 @@ class CreateAuthorizedCertificateRequest(proto.Message): SSL certificate data. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - certificate = proto.Field( + certificate: ga_certificate.AuthorizedCertificate = proto.Field( proto.MESSAGE, number=2, message=ga_certificate.AuthorizedCertificate, @@ -955,16 +959,16 @@ class UpdateAuthorizedCertificateRequest(proto.Message): and ``display_name`` fields. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - certificate = proto.Field( + certificate: ga_certificate.AuthorizedCertificate = proto.Field( proto.MESSAGE, number=2, message=ga_certificate.AuthorizedCertificate, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -981,7 +985,7 @@ class DeleteAuthorizedCertificateRequest(proto.Message): ``apps/myapp/authorizedCertificates/12345``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1001,15 +1005,15 @@ class ListDomainMappingsRequest(proto.Message): of results. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -1019,7 +1023,7 @@ class ListDomainMappingsResponse(proto.Message): r"""Response message for ``DomainMappings.ListDomainMappings``. Attributes: - domain_mappings (Sequence[google.cloud.appengine_admin_v1.types.DomainMapping]): + domain_mappings (MutableSequence[google.cloud.appengine_admin_v1.types.DomainMapping]): The domain mappings for the application. next_page_token (str): Continuation token for fetching the next page @@ -1030,12 +1034,14 @@ class ListDomainMappingsResponse(proto.Message): def raw_page(self): return self - domain_mappings = proto.RepeatedField( + domain_mappings: MutableSequence[ + ga_domain_mapping.DomainMapping + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=ga_domain_mapping.DomainMapping, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1050,7 +1056,7 @@ class GetDomainMappingRequest(proto.Message): ``apps/myapp/domainMappings/example.com``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1071,16 +1077,16 @@ class CreateDomainMappingRequest(proto.Message): default, overrides are rejected. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - domain_mapping = proto.Field( + domain_mapping: ga_domain_mapping.DomainMapping = proto.Field( proto.MESSAGE, number=2, message=ga_domain_mapping.DomainMapping, ) - override_strategy = proto.Field( + override_strategy: "DomainOverrideStrategy" = proto.Field( proto.ENUM, number=4, enum="DomainOverrideStrategy", @@ -1103,16 +1109,16 @@ class UpdateDomainMappingRequest(proto.Message): fields to be updated. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - domain_mapping = proto.Field( + domain_mapping: ga_domain_mapping.DomainMapping = proto.Field( proto.MESSAGE, number=2, message=ga_domain_mapping.DomainMapping, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -1128,7 +1134,7 @@ class DeleteDomainMappingRequest(proto.Message): ``apps/myapp/domainMappings/example.com``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index c51e52e..4206407 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import duration_pb2 # type: ignore import proto # type: ignore @@ -40,7 +42,7 @@ class Application(proto.Message): equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: ``myapp``. - dispatch_rules (Sequence[google.cloud.appengine_admin_v1.types.UrlDispatchRule]): + dispatch_rules (MutableSequence[google.cloud.appengine_admin_v1.types.UrlDispatchRule]): HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent. @@ -142,19 +144,19 @@ class IdentityAwareProxy(proto.Message): @OutputOnly """ - enabled = proto.Field( + enabled: bool = proto.Field( proto.BOOL, number=1, ) - oauth2_client_id = proto.Field( + oauth2_client_id: str = proto.Field( proto.STRING, number=2, ) - oauth2_client_secret = proto.Field( + oauth2_client_secret: str = proto.Field( proto.STRING, number=3, ) - oauth2_client_secret_sha256 = proto.Field( + oauth2_client_secret_sha256: str = proto.Field( proto.STRING, number=4, ) @@ -177,77 +179,77 @@ class FeatureSettings(proto.Message): base image for VMs, rather than a base Debian image. """ - split_health_checks = proto.Field( + split_health_checks: bool = proto.Field( proto.BOOL, number=1, ) - use_container_optimized_os = proto.Field( + use_container_optimized_os: bool = proto.Field( proto.BOOL, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - dispatch_rules = proto.RepeatedField( + dispatch_rules: MutableSequence["UrlDispatchRule"] = proto.RepeatedField( proto.MESSAGE, number=3, message="UrlDispatchRule", ) - auth_domain = proto.Field( + auth_domain: str = proto.Field( proto.STRING, number=6, ) - location_id = proto.Field( + location_id: str = proto.Field( proto.STRING, number=7, ) - code_bucket = proto.Field( + code_bucket: str = proto.Field( proto.STRING, number=8, ) - default_cookie_expiration = proto.Field( + default_cookie_expiration: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=9, message=duration_pb2.Duration, ) - serving_status = proto.Field( + serving_status: ServingStatus = proto.Field( proto.ENUM, number=10, enum=ServingStatus, ) - default_hostname = proto.Field( + default_hostname: str = proto.Field( proto.STRING, number=11, ) - default_bucket = proto.Field( + default_bucket: str = proto.Field( proto.STRING, number=12, ) - service_account = proto.Field( + service_account: str = proto.Field( proto.STRING, number=13, ) - iap = proto.Field( + iap: IdentityAwareProxy = proto.Field( proto.MESSAGE, number=14, message=IdentityAwareProxy, ) - gcr_domain = proto.Field( + gcr_domain: str = proto.Field( proto.STRING, number=16, ) - database_type = proto.Field( + database_type: DatabaseType = proto.Field( proto.ENUM, number=17, enum=DatabaseType, ) - feature_settings = proto.Field( + feature_settings: FeatureSettings = proto.Field( proto.MESSAGE, number=18, message=FeatureSettings, @@ -276,15 +278,15 @@ class UrlDispatchRule(proto.Message): Example: ``default``. """ - domain = proto.Field( + domain: str = proto.Field( proto.STRING, number=1, ) - path = proto.Field( + path: str = proto.Field( proto.STRING, number=2, ) - service = proto.Field( + service: str = proto.Field( proto.STRING, number=3, ) diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index 5de1cad..06c4a06 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.appengine_admin_v1.types import appengine @@ -50,13 +52,13 @@ class AuditData(proto.Message): This field is a member of `oneof`_ ``method``. """ - update_service = proto.Field( + update_service: "UpdateServiceMethod" = proto.Field( proto.MESSAGE, number=1, oneof="method", message="UpdateServiceMethod", ) - create_version = proto.Field( + create_version: "CreateVersionMethod" = proto.Field( proto.MESSAGE, number=2, oneof="method", @@ -72,7 +74,7 @@ class UpdateServiceMethod(proto.Message): Update service request. """ - request = proto.Field( + request: appengine.UpdateServiceRequest = proto.Field( proto.MESSAGE, number=1, message=appengine.UpdateServiceRequest, @@ -87,7 +89,7 @@ class CreateVersionMethod(proto.Message): Create version request. """ - request = proto.Field( + request: appengine.CreateVersionRequest = proto.Field( proto.MESSAGE, number=1, message=appengine.CreateVersionRequest, diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index 8466750..0fe3c65 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -60,7 +62,7 @@ class AuthorizedCertificate(proto.Message): display_name (str): The user-specified display name of the certificate. This is not guaranteed to be unique. Example: ``My Certificate``. - domain_names (Sequence[str]): + domain_names (MutableSequence[str]): Topmost applicable domains of this certificate. This certificate applies to these domains and their subdomains. Example: ``example.com``. @@ -85,7 +87,7 @@ class AuthorizedCertificate(proto.Message): manually administered by the user, this field will be empty. @OutputOnly - visible_domain_mappings (Sequence[str]): + visible_domain_mappings (MutableSequence[str]): The full paths to user visible Domain Mapping resources that have this certificate mapped. Example: ``apps/myapp/domainMappings/example.com``. @@ -112,42 +114,42 @@ class AuthorizedCertificate(proto.Message): @OutputOnly """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=3, ) - domain_names = proto.RepeatedField( + domain_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=4, ) - expire_time = proto.Field( + expire_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - certificate_raw_data = proto.Field( + certificate_raw_data: "CertificateRawData" = proto.Field( proto.MESSAGE, number=6, message="CertificateRawData", ) - managed_certificate = proto.Field( + managed_certificate: "ManagedCertificate" = proto.Field( proto.MESSAGE, number=7, message="ManagedCertificate", ) - visible_domain_mappings = proto.RepeatedField( + visible_domain_mappings: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=8, ) - domain_mappings_count = proto.Field( + domain_mappings_count: int = proto.Field( proto.INT32, number=9, ) @@ -186,11 +188,11 @@ class CertificateRawData(proto.Message): @InputOnly """ - public_certificate = proto.Field( + public_certificate: str = proto.Field( proto.STRING, number=1, ) - private_key = proto.Field( + private_key: str = proto.Field( proto.STRING, number=2, ) @@ -214,12 +216,12 @@ class ManagedCertificate(proto.Message): @OutputOnly """ - last_renewal_time = proto.Field( + last_renewal_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - status = proto.Field( + status: "ManagementStatus" = proto.Field( proto.ENUM, number=2, enum="ManagementStatus", diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index 4f48d4c..c17f74c 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import duration_pb2 # type: ignore import proto # type: ignore @@ -33,7 +35,7 @@ class Deployment(proto.Message): App Engine. Attributes: - files (Mapping[str, google.cloud.appengine_admin_v1.types.FileInfo]): + files (MutableMapping[str, google.cloud.appengine_admin_v1.types.FileInfo]): Manifest of the files stored in Google Cloud Storage that are included as part of this version. All files must be readable using the @@ -54,23 +56,23 @@ class Deployment(proto.Message): Engine flexible environment using files or zip. """ - files = proto.MapField( + files: MutableMapping[str, "FileInfo"] = proto.MapField( proto.STRING, proto.MESSAGE, number=1, message="FileInfo", ) - container = proto.Field( + container: "ContainerInfo" = proto.Field( proto.MESSAGE, number=2, message="ContainerInfo", ) - zip_ = proto.Field( + zip_: "ZipInfo" = proto.Field( proto.MESSAGE, number=3, message="ZipInfo", ) - cloud_build_options = proto.Field( + cloud_build_options: "CloudBuildOptions" = proto.Field( proto.MESSAGE, number=6, message="CloudBuildOptions", @@ -95,15 +97,15 @@ class FileInfo(proto.Message): Defaults to the value from Google Cloud Storage. """ - source_url = proto.Field( + source_url: str = proto.Field( proto.STRING, number=1, ) - sha1_sum = proto.Field( + sha1_sum: str = proto.Field( proto.STRING, number=2, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=3, ) @@ -123,7 +125,7 @@ class ContainerInfo(proto.Message): "gcr.io/my-project/image@digest". """ - image = proto.Field( + image: str = proto.Field( proto.STRING, number=1, ) @@ -149,11 +151,11 @@ class CloudBuildOptions(proto.Message): Defaults to 10 minutes. """ - app_yaml_path = proto.Field( + app_yaml_path: str = proto.Field( proto.STRING, number=1, ) - cloud_build_timeout = proto.Field( + cloud_build_timeout: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=2, message=duration_pb2.Duration, @@ -177,11 +179,11 @@ class ZipInfo(proto.Message): provided, deployment may be slow. """ - source_url = proto.Field( + source_url: str = proto.Field( proto.STRING, number=3, ) - files_count = proto.Field( + files_count: int = proto.Field( proto.INT32, number=4, ) diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py index 5217582..668a5dc 100644 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ b/google/cloud/appengine_admin_v1/types/domain.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -39,11 +41,11 @@ class AuthorizedDomain(proto.Message): use. Example: ``example.com``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index 1a0227b..7d75e5b 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -41,7 +43,7 @@ class DomainMapping(proto.Message): SSL configuration for this domain. If unconfigured, this domain will not serve with SSL. - resource_records (Sequence[google.cloud.appengine_admin_v1.types.ResourceRecord]): + resource_records (MutableSequence[google.cloud.appengine_admin_v1.types.ResourceRecord]): The resource records required to configure this domain mapping. These records must be added to the domain's DNS configuration in order to @@ -49,20 +51,20 @@ class DomainMapping(proto.Message): @OutputOnly """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - ssl_settings = proto.Field( + ssl_settings: "SslSettings" = proto.Field( proto.MESSAGE, number=3, message="SslSettings", ) - resource_records = proto.RepeatedField( + resource_records: MutableSequence["ResourceRecord"] = proto.RepeatedField( proto.MESSAGE, number=4, message="ResourceRecord", @@ -110,16 +112,16 @@ class SslManagementType(proto.Enum): AUTOMATIC = 1 MANUAL = 2 - certificate_id = proto.Field( + certificate_id: str = proto.Field( proto.STRING, number=1, ) - ssl_management_type = proto.Field( + ssl_management_type: SslManagementType = proto.Field( proto.ENUM, number=3, enum=SslManagementType, ) - pending_managed_certificate_id = proto.Field( + pending_managed_certificate_id: str = proto.Field( proto.STRING, number=4, ) @@ -147,15 +149,15 @@ class RecordType(proto.Enum): AAAA = 2 CNAME = 3 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - rrdata = proto.Field( + rrdata: str = proto.Field( proto.STRING, number=2, ) - type_ = proto.Field( + type_: RecordType = proto.Field( proto.ENUM, number=3, enum=RecordType, diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py index bfca05e..9062b66 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -64,20 +66,20 @@ class Action(proto.Enum): ALLOW = 1 DENY = 2 - priority = proto.Field( + priority: int = proto.Field( proto.INT32, number=1, ) - action = proto.Field( + action: Action = proto.Field( proto.ENUM, number=2, enum=Action, ) - source_range = proto.Field( + source_range: str = proto.Field( proto.STRING, number=3, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=4, ) diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index 48479fc..a767775 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -107,73 +109,73 @@ class LivenessState(proto.Enum): DRAINING = 4 TIMEOUT = 5 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - app_engine_release = proto.Field( + app_engine_release: str = proto.Field( proto.STRING, number=3, ) - availability = proto.Field( + availability: Availability = proto.Field( proto.ENUM, number=4, enum=Availability, ) - vm_name = proto.Field( + vm_name: str = proto.Field( proto.STRING, number=5, ) - vm_zone_name = proto.Field( + vm_zone_name: str = proto.Field( proto.STRING, number=6, ) - vm_id = proto.Field( + vm_id: str = proto.Field( proto.STRING, number=7, ) - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp, ) - requests = proto.Field( + requests: int = proto.Field( proto.INT32, number=9, ) - errors = proto.Field( + errors: int = proto.Field( proto.INT32, number=10, ) - qps = proto.Field( + qps: float = proto.Field( proto.FLOAT, number=11, ) - average_latency = proto.Field( + average_latency: int = proto.Field( proto.INT32, number=12, ) - memory_usage = proto.Field( + memory_usage: int = proto.Field( proto.INT64, number=13, ) - vm_status = proto.Field( + vm_status: str = proto.Field( proto.STRING, number=14, ) - vm_debug_enabled = proto.Field( + vm_debug_enabled: bool = proto.Field( proto.BOOL, number=15, ) - vm_ip = proto.Field( + vm_ip: str = proto.Field( proto.STRING, number=16, ) - vm_liveness = proto.Field( + vm_liveness: Liveness.LivenessState = proto.Field( proto.ENUM, number=17, enum=Liveness.LivenessState, diff --git a/google/cloud/appengine_admin_v1/types/location.py b/google/cloud/appengine_admin_v1/types/location.py index d38b301..ad3c5e2 100644 --- a/google/cloud/appengine_admin_v1/types/location.py +++ b/google/cloud/appengine_admin_v1/types/location.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -42,15 +44,15 @@ class LocationMetadata(proto.Message): is available in the given location. """ - standard_environment_available = proto.Field( + standard_environment_available: bool = proto.Field( proto.BOOL, number=2, ) - flexible_environment_available = proto.Field( + flexible_environment_available: bool = proto.Field( proto.BOOL, number=4, ) - search_api_available = proto.Field( + search_api_available: bool = proto.Field( proto.BOOL, number=6, ) diff --git a/google/cloud/appengine_admin_v1/types/network_settings.py b/google/cloud/appengine_admin_v1/types/network_settings.py index 4a27b4d..3594eb4 100644 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ b/google/cloud/appengine_admin_v1/types/network_settings.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -39,7 +41,7 @@ class IngressTrafficAllowed(proto.Enum): INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY = 2 INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB = 3 - ingress_traffic_allowed = proto.Field( + ingress_traffic_allowed: IngressTrafficAllowed = proto.Field( proto.ENUM, number=1, enum=IngressTrafficAllowed, diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py index 6510e77..9a9a712 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -55,7 +57,7 @@ class OperationMetadataV1(proto.Message): ephemeral_message (str): Ephemeral message that may change every time the operation is polled. @OutputOnly - warning (Sequence[str]): + warning (MutableSequence[str]): Durable messages that persist on every operation poll. @OutputOnly create_version_metadata (google.cloud.appengine_admin_v1.types.CreateVersionMetadataV1): @@ -63,37 +65,37 @@ class OperationMetadataV1(proto.Message): This field is a member of `oneof`_ ``method_metadata``. """ - method = proto.Field( + method: str = proto.Field( proto.STRING, number=1, ) - insert_time = proto.Field( + insert_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - user = proto.Field( + user: str = proto.Field( proto.STRING, number=4, ) - target = proto.Field( + target: str = proto.Field( proto.STRING, number=5, ) - ephemeral_message = proto.Field( + ephemeral_message: str = proto.Field( proto.STRING, number=6, ) - warning = proto.RepeatedField( + warning: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=7, ) - create_version_metadata = proto.Field( + create_version_metadata: "CreateVersionMetadataV1" = proto.Field( proto.MESSAGE, number=8, oneof="method_metadata", @@ -113,7 +115,7 @@ class CreateVersionMetadataV1(proto.Message): of the version create. @OutputOnly """ - cloud_build_id = proto.Field( + cloud_build_id: str = proto.Field( proto.STRING, number=1, ) diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index 86d8437..e09e628 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.appengine_admin_v1.types import ( @@ -53,7 +55,7 @@ class Service(proto.Message): Mapping that defines fractional HTTP traffic diversion to different versions within the service. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): A set of labels to apply to this service. Labels are key/value pairs that describe the service and all resources that belong to it @@ -76,25 +78,25 @@ class Service(proto.Message): to all versions. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - split = proto.Field( + split: "TrafficSplit" = proto.Field( proto.MESSAGE, number=3, message="TrafficSplit", ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=4, ) - network_settings = proto.Field( + network_settings: ga_network_settings.NetworkSettings = proto.Field( proto.MESSAGE, number=6, message=ga_network_settings.NetworkSettings, @@ -112,7 +114,7 @@ class TrafficSplit(proto.Message): request is sent to. The traffic selection algorithm will be stable for either type until allocations are changed. - allocations (Mapping[str, float]): + allocations (MutableMapping[str, float]): Mapping from version IDs within the service to fractional (0.000, 1] allocations of traffic for that version. Each version can be specified only once, but some versions in the @@ -131,12 +133,12 @@ class ShardBy(proto.Enum): IP = 2 RANDOM = 3 - shard_by = proto.Field( + shard_by: ShardBy = proto.Field( proto.ENUM, number=1, enum=ShardBy, ) - allocations = proto.MapField( + allocations: MutableMapping[str, float] = proto.MapField( proto.STRING, proto.DOUBLE, number=2, diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index fe48d5e..62361bc 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -109,7 +111,7 @@ class Version(proto.Message): sometimes referred to as "backends". This field is a member of `oneof`_ ``scaling``. - inbound_services (Sequence[google.cloud.appengine_admin_v1.types.InboundServiceType]): + inbound_services (MutableSequence[google.cloud.appengine_admin_v1.types.InboundServiceType]): Before an application can receive email or XMPP messages, the application must be configured to enable the service. @@ -127,7 +129,7 @@ class Version(proto.Message): Extra network settings. Only applicable in the App Engine flexible environment. - zones (Sequence[str]): + zones (MutableSequence[str]): The Google Compute Engine zones that are supported by this version in the App Engine flexible environment. Deprecated. @@ -149,7 +151,7 @@ class Version(proto.Message): app_engine_apis (bool): Allows App Engine second generation runtimes to access the legacy bundled services. - beta_settings (Mapping[str, str]): + beta_settings (MutableMapping[str, str]): Metadata settings that are supplied to this version to enable beta runtime features. env (str): @@ -189,17 +191,17 @@ class Version(proto.Message): Appspot service account as default if this field is neither provided in app.yaml file nor through CLI flag. - handlers (Sequence[google.cloud.appengine_admin_v1.types.UrlMap]): + handlers (MutableSequence[google.cloud.appengine_admin_v1.types.UrlMap]): An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Only returned in ``GET`` requests if ``view=FULL`` is set. - error_handlers (Sequence[google.cloud.appengine_admin_v1.types.ErrorHandler]): + error_handlers (MutableSequence[google.cloud.appengine_admin_v1.types.ErrorHandler]): Custom static error pages. Limited to 10KB per page. Only returned in ``GET`` requests if ``view=FULL`` is set. - libraries (Sequence[google.cloud.appengine_admin_v1.types.Library]): + libraries (MutableSequence[google.cloud.appengine_admin_v1.types.Library]): Configuration for third-party Python runtime libraries that are required by the application. @@ -209,11 +211,11 @@ class Version(proto.Message): Endpoints `__. Only returned in ``GET`` requests if ``view=FULL`` is set. - env_variables (Mapping[str, str]): + env_variables (MutableMapping[str, str]): Environment variables available to the application. Only returned in ``GET`` requests if ``view=FULL`` is set. - build_env_variables (Mapping[str, str]): + build_env_variables (MutableMapping[str, str]): Environment variables available to the build environment. Only returned in ``GET`` requests if ``view=FULL`` is set. @@ -266,188 +268,188 @@ class Version(proto.Message): Enables VPC connectivity for standard apps. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - automatic_scaling = proto.Field( + automatic_scaling: "AutomaticScaling" = proto.Field( proto.MESSAGE, number=3, oneof="scaling", message="AutomaticScaling", ) - basic_scaling = proto.Field( + basic_scaling: "BasicScaling" = proto.Field( proto.MESSAGE, number=4, oneof="scaling", message="BasicScaling", ) - manual_scaling = proto.Field( + manual_scaling: "ManualScaling" = proto.Field( proto.MESSAGE, number=5, oneof="scaling", message="ManualScaling", ) - inbound_services = proto.RepeatedField( + inbound_services: MutableSequence["InboundServiceType"] = proto.RepeatedField( proto.ENUM, number=6, enum="InboundServiceType", ) - instance_class = proto.Field( + instance_class: str = proto.Field( proto.STRING, number=7, ) - network = proto.Field( + network: "Network" = proto.Field( proto.MESSAGE, number=8, message="Network", ) - zones = proto.RepeatedField( + zones: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=118, ) - resources = proto.Field( + resources: "Resources" = proto.Field( proto.MESSAGE, number=9, message="Resources", ) - runtime = proto.Field( + runtime: str = proto.Field( proto.STRING, number=10, ) - runtime_channel = proto.Field( + runtime_channel: str = proto.Field( proto.STRING, number=117, ) - threadsafe = proto.Field( + threadsafe: bool = proto.Field( proto.BOOL, number=11, ) - vm = proto.Field( + vm: bool = proto.Field( proto.BOOL, number=12, ) - app_engine_apis = proto.Field( + app_engine_apis: bool = proto.Field( proto.BOOL, number=128, ) - beta_settings = proto.MapField( + beta_settings: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=13, ) - env = proto.Field( + env: str = proto.Field( proto.STRING, number=14, ) - serving_status = proto.Field( + serving_status: "ServingStatus" = proto.Field( proto.ENUM, number=15, enum="ServingStatus", ) - created_by = proto.Field( + created_by: str = proto.Field( proto.STRING, number=16, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=17, message=timestamp_pb2.Timestamp, ) - disk_usage_bytes = proto.Field( + disk_usage_bytes: int = proto.Field( proto.INT64, number=18, ) - runtime_api_version = proto.Field( + runtime_api_version: str = proto.Field( proto.STRING, number=21, ) - runtime_main_executable_path = proto.Field( + runtime_main_executable_path: str = proto.Field( proto.STRING, number=22, ) - service_account = proto.Field( + service_account: str = proto.Field( proto.STRING, number=127, ) - handlers = proto.RepeatedField( + handlers: MutableSequence[app_yaml.UrlMap] = proto.RepeatedField( proto.MESSAGE, number=100, message=app_yaml.UrlMap, ) - error_handlers = proto.RepeatedField( + error_handlers: MutableSequence[app_yaml.ErrorHandler] = proto.RepeatedField( proto.MESSAGE, number=101, message=app_yaml.ErrorHandler, ) - libraries = proto.RepeatedField( + libraries: MutableSequence[app_yaml.Library] = proto.RepeatedField( proto.MESSAGE, number=102, message=app_yaml.Library, ) - api_config = proto.Field( + api_config: app_yaml.ApiConfigHandler = proto.Field( proto.MESSAGE, number=103, message=app_yaml.ApiConfigHandler, ) - env_variables = proto.MapField( + env_variables: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=104, ) - build_env_variables = proto.MapField( + build_env_variables: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=125, ) - default_expiration = proto.Field( + default_expiration: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=105, message=duration_pb2.Duration, ) - health_check = proto.Field( + health_check: app_yaml.HealthCheck = proto.Field( proto.MESSAGE, number=106, message=app_yaml.HealthCheck, ) - readiness_check = proto.Field( + readiness_check: app_yaml.ReadinessCheck = proto.Field( proto.MESSAGE, number=112, message=app_yaml.ReadinessCheck, ) - liveness_check = proto.Field( + liveness_check: app_yaml.LivenessCheck = proto.Field( proto.MESSAGE, number=113, message=app_yaml.LivenessCheck, ) - nobuild_files_regex = proto.Field( + nobuild_files_regex: str = proto.Field( proto.STRING, number=107, ) - deployment = proto.Field( + deployment: deploy.Deployment = proto.Field( proto.MESSAGE, number=108, message=deploy.Deployment, ) - version_url = proto.Field( + version_url: str = proto.Field( proto.STRING, number=109, ) - endpoints_api_service = proto.Field( + endpoints_api_service: "EndpointsApiService" = proto.Field( proto.MESSAGE, number=110, message="EndpointsApiService", ) - entrypoint = proto.Field( + entrypoint: "Entrypoint" = proto.Field( proto.MESSAGE, number=122, message="Entrypoint", ) - vpc_access_connector = proto.Field( + vpc_access_connector: "VpcAccessConnector" = proto.Field( proto.MESSAGE, number=121, message="VpcAccessConnector", @@ -500,20 +502,20 @@ class RolloutStrategy(proto.Enum): FIXED = 1 MANAGED = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - config_id = proto.Field( + config_id: str = proto.Field( proto.STRING, number=2, ) - rollout_strategy = proto.Field( + rollout_strategy: RolloutStrategy = proto.Field( proto.ENUM, number=3, enum=RolloutStrategy, ) - disable_trace_sampling = proto.Field( + disable_trace_sampling: bool = proto.Field( proto.BOOL, number=4, ) @@ -570,62 +572,62 @@ class AutomaticScaling(proto.Message): Scheduler settings for standard environment. """ - cool_down_period = proto.Field( + cool_down_period: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=1, message=duration_pb2.Duration, ) - cpu_utilization = proto.Field( + cpu_utilization: "CpuUtilization" = proto.Field( proto.MESSAGE, number=2, message="CpuUtilization", ) - max_concurrent_requests = proto.Field( + max_concurrent_requests: int = proto.Field( proto.INT32, number=3, ) - max_idle_instances = proto.Field( + max_idle_instances: int = proto.Field( proto.INT32, number=4, ) - max_total_instances = proto.Field( + max_total_instances: int = proto.Field( proto.INT32, number=5, ) - max_pending_latency = proto.Field( + max_pending_latency: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=6, message=duration_pb2.Duration, ) - min_idle_instances = proto.Field( + min_idle_instances: int = proto.Field( proto.INT32, number=7, ) - min_total_instances = proto.Field( + min_total_instances: int = proto.Field( proto.INT32, number=8, ) - min_pending_latency = proto.Field( + min_pending_latency: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=9, message=duration_pb2.Duration, ) - request_utilization = proto.Field( + request_utilization: "RequestUtilization" = proto.Field( proto.MESSAGE, number=10, message="RequestUtilization", ) - disk_utilization = proto.Field( + disk_utilization: "DiskUtilization" = proto.Field( proto.MESSAGE, number=11, message="DiskUtilization", ) - network_utilization = proto.Field( + network_utilization: "NetworkUtilization" = proto.Field( proto.MESSAGE, number=12, message="NetworkUtilization", ) - standard_scheduler_settings = proto.Field( + standard_scheduler_settings: "StandardSchedulerSettings" = proto.Field( proto.MESSAGE, number=20, message="StandardSchedulerSettings", @@ -648,12 +650,12 @@ class BasicScaling(proto.Message): this version. """ - idle_timeout = proto.Field( + idle_timeout: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=1, message=duration_pb2.Duration, ) - max_instances = proto.Field( + max_instances: int = proto.Field( proto.INT32, number=2, ) @@ -672,7 +674,7 @@ class ManualScaling(proto.Message): ``set_num_instances()`` function. """ - instances = proto.Field( + instances: int = proto.Field( proto.INT32, number=1, ) @@ -690,12 +692,12 @@ class CpuUtilization(proto.Message): scaling. Must be between 0 and 1. """ - aggregation_window_length = proto.Field( + aggregation_window_length: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=1, message=duration_pb2.Duration, ) - target_utilization = proto.Field( + target_utilization: float = proto.Field( proto.DOUBLE, number=2, ) @@ -712,11 +714,11 @@ class RequestUtilization(proto.Message): Target number of concurrent requests. """ - target_request_count_per_second = proto.Field( + target_request_count_per_second: int = proto.Field( proto.INT32, number=1, ) - target_concurrent_requests = proto.Field( + target_concurrent_requests: int = proto.Field( proto.INT32, number=2, ) @@ -737,19 +739,19 @@ class DiskUtilization(proto.Message): Target ops read per seconds. """ - target_write_bytes_per_second = proto.Field( + target_write_bytes_per_second: int = proto.Field( proto.INT32, number=14, ) - target_write_ops_per_second = proto.Field( + target_write_ops_per_second: int = proto.Field( proto.INT32, number=15, ) - target_read_bytes_per_second = proto.Field( + target_read_bytes_per_second: int = proto.Field( proto.INT32, number=16, ) - target_read_ops_per_second = proto.Field( + target_read_ops_per_second: int = proto.Field( proto.INT32, number=17, ) @@ -770,19 +772,19 @@ class NetworkUtilization(proto.Message): Target packets received per second. """ - target_sent_bytes_per_second = proto.Field( + target_sent_bytes_per_second: int = proto.Field( proto.INT32, number=1, ) - target_sent_packets_per_second = proto.Field( + target_sent_packets_per_second: int = proto.Field( proto.INT32, number=11, ) - target_received_bytes_per_second = proto.Field( + target_received_bytes_per_second: int = proto.Field( proto.INT32, number=12, ) - target_received_packets_per_second = proto.Field( + target_received_packets_per_second: int = proto.Field( proto.INT32, number=13, ) @@ -806,19 +808,19 @@ class StandardSchedulerSettings(proto.Message): zero to disable ``max_instances`` configuration. """ - target_cpu_utilization = proto.Field( + target_cpu_utilization: float = proto.Field( proto.DOUBLE, number=1, ) - target_throughput_utilization = proto.Field( + target_throughput_utilization: float = proto.Field( proto.DOUBLE, number=2, ) - min_instances = proto.Field( + min_instances: int = proto.Field( proto.INT32, number=3, ) - max_instances = proto.Field( + max_instances: int = proto.Field( proto.INT32, number=4, ) @@ -829,7 +831,7 @@ class Network(proto.Message): Only applicable in the App Engine flexible environment. Attributes: - forwarded_ports (Sequence[str]): + forwarded_ports (MutableSequence[str]): List of ports, or port pairs, to forward from the virtual machine to the application container. Only applicable in the App Engine @@ -871,23 +873,23 @@ class Network(proto.Message): environment. """ - forwarded_ports = proto.RepeatedField( + forwarded_ports: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - instance_tag = proto.Field( + instance_tag: str = proto.Field( proto.STRING, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=3, ) - subnetwork_name = proto.Field( + subnetwork_name: str = proto.Field( proto.STRING, number=4, ) - session_affinity = proto.Field( + session_affinity: bool = proto.Field( proto.BOOL, number=5, ) @@ -906,15 +908,15 @@ class Volume(proto.Message): Volume size in gigabytes. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - volume_type = proto.Field( + volume_type: str = proto.Field( proto.STRING, number=2, ) - size_gb = proto.Field( + size_gb: float = proto.Field( proto.DOUBLE, number=3, ) @@ -930,7 +932,7 @@ class Resources(proto.Message): Disk size (GB) needed. memory_gb (float): Memory (GB) needed. - volumes (Sequence[google.cloud.appengine_admin_v1.types.Volume]): + volumes (MutableSequence[google.cloud.appengine_admin_v1.types.Volume]): User specified volumes. kms_key_reference (str): The name of the encryption key that is stored @@ -938,24 +940,24 @@ class Resources(proto.Message): Cloud Composer to encrypt the vm disk """ - cpu = proto.Field( + cpu: float = proto.Field( proto.DOUBLE, number=1, ) - disk_gb = proto.Field( + disk_gb: float = proto.Field( proto.DOUBLE, number=2, ) - memory_gb = proto.Field( + memory_gb: float = proto.Field( proto.DOUBLE, number=3, ) - volumes = proto.RepeatedField( + volumes: MutableSequence["Volume"] = proto.RepeatedField( proto.MESSAGE, number=4, message="Volume", ) - kms_key_reference = proto.Field( + kms_key_reference: str = proto.Field( proto.STRING, number=5, ) @@ -984,11 +986,11 @@ class EgressSetting(proto.Enum): ALL_TRAFFIC = 1 PRIVATE_IP_RANGES = 2 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - egress_setting = proto.Field( + egress_setting: EgressSetting = proto.Field( proto.ENUM, number=2, enum=EgressSetting, @@ -1008,7 +1010,7 @@ class Entrypoint(proto.Message): This field is a member of `oneof`_ ``command``. """ - shell = proto.Field( + shell: str = proto.Field( proto.STRING, number=1, oneof="command", diff --git a/release-please-config.json b/release-please-config.json index fcf159e..e1ecbdd 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -4,7 +4,12 @@ ".": { "release-type": "python", "extra-files": [ - "google/cloud/appengine_admin/gapic_version.py" + "google/cloud/appengine_admin/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.appengine.v1.json", + "jsonpath": "$.clientLibrary.version" + } ] } }, diff --git a/samples/generated_samples/snippet_metadata_appengine admin_v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_appengine admin_v1.json rename to samples/generated_samples/snippet_metadata_google.appengine.v1.json index 91148e6..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_appengine admin_v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-appengine-admin" + "name": "google-cloud-appengine-admin", + "version": "0.1.0" }, "snippets": [ { From f6c03577c914ed16ef3e1821fec15a137aeefd9f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 08:24:45 -0500 Subject: [PATCH 27/73] chore: use python 3.9 for docs builds Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/workflows/docs.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/unittest.yml | 2 +- .kokoro/docker/docs/Dockerfile | 12 ++++++------ .kokoro/requirements.txt | 6 +++--- noxfile.py | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 12edee7..237a647 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:452901c74a22f9b9a3bd02bce780b8e8805c97270d424684bff809ce5be8c2a2 + digest: sha256:6244cdf9848ec661b48e5b626123ee9f6f8eb80adc9d42d7cd3c243d4ddaea79 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7092a13..e97d89e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.9" - name: Install nox run: | python -m pip install --upgrade setuptools pip wheel @@ -28,7 +28,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.9" - name: Install nox run: | python -m pip install --upgrade setuptools pip wheel diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d2aee5b..16d5a9e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.8" - name: Install nox run: | python -m pip install --upgrade setuptools pip wheel diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 87ade4d..23000c0 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -41,7 +41,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.8" - name: Install coverage run: | python -m pip install --upgrade setuptools pip wheel diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 238b87b..7323c42 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -60,16 +60,16 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb -###################### Install python 3.8.11 +###################### Install python 3.9.13 -# Download python 3.8.11 -RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz +# Download python 3.9.13 +RUN wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz # Extract files -RUN tar -xvf Python-3.8.11.tgz +RUN tar -xvf Python-3.9.13.tgz -# Install python 3.8.11 -RUN ./Python-3.8.11/configure --enable-optimizations +# Install python 3.9.11 +RUN ./Python-3.9.13/configure --enable-optimizations RUN make altinstall ###################### Install pip diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 31425f1..12bfbf4 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -94,9 +94,9 @@ charset-normalizer==2.1.1 \ --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 \ --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f # via requests -click==8.0.4 \ - --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ - --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb +click==8.1.3 \ + --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ + --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 # via # gcp-docuploader # gcp-releasetool diff --git a/noxfile.py b/noxfile.py index 29d0200..d8440c0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -273,7 +273,7 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python=DEFAULT_PYTHON_VERSION) +@nox.session(python="3.9") def docs(session): """Build the docs for this library.""" @@ -299,7 +299,7 @@ def docs(session): ) -@nox.session(python=DEFAULT_PYTHON_VERSION) +@nox.session(python="3.9") def docfx(session): """Build the docfx yaml files for this library.""" From 9bee52ebad235a93609fb5ad8fd113d3d4863cf9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 08:37:02 -0500 Subject: [PATCH 28/73] chore: Update gapic-generator-python to v1.6.1 (#208) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: https://github.com/googleapis/googleapis/commit/08f275f5c1c0d99056e1cb68376323414459ee19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- testing/constraints-3.7.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index aca9f2d..6f3158c 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -4,8 +4,6 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -# This file is intentionally left empty to test the -# latest versions of dependencies. google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 From 4a78f2b4609f0b4d5363a6de15255d5bb88c7fcd Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 08:39:55 -0500 Subject: [PATCH 29/73] chore(main): release 1.7.0 (#207) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- .release-please-manifest.json | 2 +- CHANGELOG.md | 12 ++++++++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0d1bebe..64e0684 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.6.0" + ".": "1.7.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c3550b8..b088303 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.7.0](https://github.com/googleapis/python-appengine-admin/compare/v1.6.0...v1.7.0) (2022-11-16) + + +### Features + +* Add typing to proto.Message based class attributes ([80bd28c](https://github.com/googleapis/python-appengine-admin/commit/80bd28cf8f56ea3691aa08005445b81d8372e033)) + + +### Documentation + +* **samples:** Snippetgen handling of repeated enum field ([80bd28c](https://github.com/googleapis/python-appengine-admin/commit/80bd28cf8f56ea3691aa08005445b81d8372e033)) + ## [1.6.0](https://github.com/googleapis/python-appengine-admin/compare/v1.5.3...v1.6.0) (2022-11-08) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index a016bdf..f033c61 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.6.0" # {x-release-please-version} +__version__ = "1.7.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..5f88fd1 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.7.0" }, "snippets": [ { From 0bd3738411db15f047878011cdfaa2ce5648be02 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 17:06:19 +0000 Subject: [PATCH 30/73] chore(python): update release script dependencies [autoapprove] (#210) Source-Link: https://togithub.com/googleapis/synthtool/commit/25083af347468dd5f90f69627420f7d452b6c50e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e6cbd61f1838d9ff6a31436dfc13717f372a7482a82fc1863ca954ec47bff8c8 --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/docker/docs/Dockerfile | 2 +- .kokoro/requirements.in | 4 +- .kokoro/requirements.txt | 67 ++++++++++++++++++---------------- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 237a647..3f1ccc0 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6244cdf9848ec661b48e5b626123ee9f6f8eb80adc9d42d7cd3c243d4ddaea79 + digest: sha256:e6cbd61f1838d9ff6a31436dfc13717f372a7482a82fc1863ca954ec47bff8c8 diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 7323c42..f8137d0 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -68,7 +68,7 @@ RUN wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz # Extract files RUN tar -xvf Python-3.9.13.tgz -# Install python 3.9.11 +# Install python 3.9.13 RUN ./Python-3.9.13/configure --enable-optimizations RUN make altinstall diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in index 7718391..cbd7e77 100644 --- a/.kokoro/requirements.in +++ b/.kokoro/requirements.in @@ -5,4 +5,6 @@ typing-extensions twine wheel setuptools -nox \ No newline at end of file +nox +charset-normalizer<3 +click<8.1.0 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 12bfbf4..9c1b9be 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -93,11 +93,14 @@ cffi==1.15.1 \ charset-normalizer==2.1.1 \ --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 \ --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f - # via requests -click==8.1.3 \ - --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ - --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 # via + # -r requirements.in + # requests +click==8.0.4 \ + --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ + --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb + # via + # -r requirements.in # gcp-docuploader # gcp-releasetool colorlog==6.7.0 \ @@ -156,9 +159,9 @@ gcp-docuploader==0.6.4 \ --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf # via -r requirements.in -gcp-releasetool==1.9.1 \ - --hash=sha256:952f4055d5d986b070ae2a71c4410b250000f9cc5a1e26398fcd55a5bbc5a15f \ - --hash=sha256:d0d3c814a97c1a237517e837d8cfa668ced8df4b882452578ecef4a4e79c583b +gcp-releasetool==1.10.0 \ + --hash=sha256:72a38ca91b59c24f7e699e9227c90cbe4dd71b789383cb0164b088abae294c83 \ + --hash=sha256:8c7c99320208383d4bb2b808c6880eb7a81424afe7cdba3c8d84b25f4f0e097d # via -r requirements.in google-api-core==2.10.2 \ --hash=sha256:10c06f7739fe57781f87523375e8e1a3a4674bf6392cd6131a3222182b971320 \ @@ -166,9 +169,9 @@ google-api-core==2.10.2 \ # via # google-cloud-core # google-cloud-storage -google-auth==2.14.0 \ - --hash=sha256:1ad5b0e6eba5f69645971abb3d2c197537d5914070a8c6d30299dfdb07c5c700 \ - --hash=sha256:cf24817855d874ede2efd071aa22125445f555de1685b739a9782fcf408c2a3d +google-auth==2.14.1 \ + --hash=sha256:ccaa901f31ad5cbb562615eb8b664b3dd0bf5404a67618e642307f00613eda4d \ + --hash=sha256:f5d8701633bebc12e0deea4df8abd8aff31c28b355360597f7f2ee60f2e4d016 # via # gcp-releasetool # google-api-core @@ -178,9 +181,9 @@ google-cloud-core==2.3.2 \ --hash=sha256:8417acf6466be2fa85123441696c4badda48db314c607cf1e5d543fa8bdc22fe \ --hash=sha256:b9529ee7047fd8d4bf4a2182de619154240df17fbe60ead399078c1ae152af9a # via google-cloud-storage -google-cloud-storage==2.5.0 \ - --hash=sha256:19a26c66c317ce542cea0830b7e787e8dac2588b6bfa4d3fd3b871ba16305ab0 \ - --hash=sha256:382f34b91de2212e3c2e7b40ec079d27ee2e3dbbae99b75b1bcd8c63063ce235 +google-cloud-storage==2.6.0 \ + --hash=sha256:104ca28ae61243b637f2f01455cc8a05e8f15a2a18ced96cb587241cdd3820f5 \ + --hash=sha256:4ad0415ff61abdd8bb2ae81c1f8f7ec7d91a1011613f2db87c614c550f97bfe9 # via gcp-docuploader google-crc32c==1.5.0 \ --hash=sha256:024894d9d3cfbc5943f8f230e23950cd4906b2fe004c72e29b209420a1e6b05a \ @@ -256,9 +259,9 @@ google-resumable-media==2.4.0 \ --hash=sha256:2aa004c16d295c8f6c33b2b4788ba59d366677c0a25ae7382436cb30f776deaa \ --hash=sha256:8d5518502f92b9ecc84ac46779bd4f09694ecb3ba38a3e7ca737a86d15cbca1f # via google-cloud-storage -googleapis-common-protos==1.56.4 \ - --hash=sha256:8eb2cbc91b69feaf23e32452a7ae60e791e09967d81d4fcc7fc388182d1bd394 \ - --hash=sha256:c25873c47279387cfdcbdafa36149887901d36202cb645a0e4f29686bf6e4417 +googleapis-common-protos==1.57.0 \ + --hash=sha256:27a849d6205838fb6cc3c1c21cb9800707a661bb21c6ce7fb13e99eb1f8a0c46 \ + --hash=sha256:a9f4a1d7f6d9809657b7f1316a1aa527f6664891531bcfcc13b6696e685f443c # via google-api-core idna==3.4 \ --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ @@ -269,6 +272,7 @@ importlib-metadata==5.0.0 \ --hash=sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43 # via # -r requirements.in + # keyring # twine jaraco-classes==3.2.3 \ --hash=sha256:2353de3288bc6b82120752201c6b1c1a14b058267fa424ed5ce5984e3b922158 \ @@ -284,9 +288,9 @@ jinja2==3.1.2 \ --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 # via gcp-releasetool -keyring==23.9.3 \ - --hash=sha256:69732a15cb1433bdfbc3b980a8a36a04878a6cfd7cb99f497b573f31618001c0 \ - --hash=sha256:69b01dd83c42f590250fe7a1f503fc229b14de83857314b1933a3ddbf595c4a5 +keyring==23.11.0 \ + --hash=sha256:3dd30011d555f1345dec2c262f0153f2f0ca6bca041fb1dc4588349bb4c0ac1e \ + --hash=sha256:ad192263e2cdd5f12875dedc2da13534359a7e760e77f8d04b50968a821c2361 # via # gcp-releasetool # twine @@ -350,9 +354,9 @@ pkginfo==1.8.3 \ --hash=sha256:848865108ec99d4901b2f7e84058b6e7660aae8ae10164e015a6dcf5b242a594 \ --hash=sha256:a84da4318dd86f870a9447a8c98340aa06216bfc6f2b7bdc4b8766984ae1867c # via twine -platformdirs==2.5.2 \ - --hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 \ - --hash=sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19 +platformdirs==2.5.4 \ + --hash=sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7 \ + --hash=sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10 # via virtualenv protobuf==3.20.3 \ --hash=sha256:03038ac1cfbc41aa21f6afcbcd357281d7521b4157926f30ebecc8d4ea59dcb7 \ @@ -381,7 +385,6 @@ protobuf==3.20.3 \ # gcp-docuploader # gcp-releasetool # google-api-core - # googleapis-common-protos py==1.11.0 \ --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 @@ -476,17 +479,17 @@ urllib3==1.26.12 \ # via # requests # twine -virtualenv==20.16.6 \ - --hash=sha256:186ca84254abcbde98180fd17092f9628c5fe742273c02724972a1d8a2035108 \ - --hash=sha256:530b850b523c6449406dfba859d6345e48ef19b8439606c5d74d7d3c9e14d76e +virtualenv==20.16.7 \ + --hash=sha256:8691e3ff9387f743e00f6bb20f70121f5e4f596cae754531f2b3b3a1b1ac696e \ + --hash=sha256:efd66b00386fdb7dbe4822d172303f40cd05e50e01740b19ea42425cbe653e29 # via nox webencodings==0.5.1 \ --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ --hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923 # via bleach -wheel==0.37.1 \ - --hash=sha256:4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a \ - --hash=sha256:e9a504e793efbca1b8e0e9cb979a249cf4a0a7b5b8c9e8b65a5e39d49529c1c4 +wheel==0.38.4 \ + --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ + --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 # via -r requirements.in zipp==3.10.0 \ --hash=sha256:4fcb6f278987a6605757302a6e40e896257570d11c51628968ccb2a47e80c6c1 \ @@ -494,7 +497,7 @@ zipp==3.10.0 \ # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -setuptools==65.5.0 \ - --hash=sha256:512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17 \ - --hash=sha256:f62ea9da9ed6289bfe868cd6845968a2c854d1427f8548d52cae02a42b4f0356 +setuptools==65.5.1 \ + --hash=sha256:d0b9a8433464d5800cbe05094acf5c6d52a91bfac9b52bcfc4d41382be5d5d31 \ + --hash=sha256:e197a19aa8ec9722928f2206f8de752def0e4c9fc6953527360d1c36d94ddb2f # via -r requirements.in From a086ce0d68a2790bb46390fe5d2c7d9b2db235c0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 14:58:41 -0500 Subject: [PATCH 31/73] fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#212) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: https://github.com/googleapis/googleapis/commit/fea43879f83a8d0dacc9353b3f75f8f46d37162f Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .coveragerc | 5 ---- .../cloud/appengine_admin_v1/gapic_version.py | 16 ++++++++++ .../services/applications/async_client.py | 28 ++++++++--------- .../services/applications/client.py | 22 ++++++-------- .../services/applications/transports/base.py | 13 +++----- .../authorized_certificates/async_client.py | 24 +++++++-------- .../authorized_certificates/client.py | 24 +++++++-------- .../transports/base.py | 13 +++----- .../authorized_domains/async_client.py | 16 ++++------ .../services/authorized_domains/client.py | 16 ++++------ .../authorized_domains/transports/base.py | 13 +++----- .../services/domain_mappings/async_client.py | 30 ++++++++----------- .../services/domain_mappings/client.py | 24 +++++++-------- .../domain_mappings/transports/base.py | 13 +++----- .../services/firewall/async_client.py | 26 +++++++--------- .../services/firewall/client.py | 26 +++++++--------- .../services/firewall/transports/base.py | 13 +++----- .../services/instances/async_client.py | 26 +++++++--------- .../services/instances/client.py | 22 ++++++-------- .../services/instances/transports/base.py | 13 +++----- .../services/services/async_client.py | 26 +++++++--------- .../services/services/client.py | 22 ++++++-------- .../services/services/transports/base.py | 13 +++----- .../services/versions/async_client.py | 30 ++++++++----------- .../services/versions/client.py | 24 +++++++-------- .../services/versions/transports/base.py | 13 +++----- release-please-config.json | 1 + ...d_applications_create_application_async.py | 2 +- ...d_applications_repair_application_async.py | 2 +- ...d_applications_update_application_async.py | 2 +- ...in_mappings_create_domain_mapping_async.py | 2 +- ...in_mappings_delete_domain_mapping_async.py | 2 +- ...in_mappings_update_domain_mapping_async.py | 2 +- ...enerated_instances_debug_instance_async.py | 2 +- ...nerated_instances_delete_instance_async.py | 2 +- ...generated_services_delete_service_async.py | 2 +- ...generated_services_update_service_async.py | 2 +- ...generated_versions_create_version_async.py | 2 +- ...generated_versions_delete_version_async.py | 2 +- ...generated_versions_update_version_async.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- setup.py | 2 +- testing/constraints-3.7.txt | 2 +- 43 files changed, 226 insertions(+), 318 deletions(-) create mode 100644 google/cloud/appengine_admin_v1/gapic_version.py diff --git a/.coveragerc b/.coveragerc index 44c6382..c4d3671 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,8 +10,3 @@ exclude_lines = pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # 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 diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py new file mode 100644 index 0000000..f033c61 --- /dev/null +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +__version__ = "1.7.0" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index 562386f..e094798 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -217,7 +218,7 @@ async def get_application( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> application.Application: r"""Gets information about an application. @@ -318,7 +319,7 @@ async def create_application( request: Optional[Union[appengine.CreateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates an App Engine application for a Google Cloud Platform @@ -357,7 +358,7 @@ async def sample_create_application(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -415,7 +416,7 @@ async def update_application( request: Optional[Union[appengine.UpdateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified Application resource. You can update the @@ -452,7 +453,7 @@ async def sample_update_application(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -516,7 +517,7 @@ async def repair_application( request: Optional[Union[appengine.RepairApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Recreates the required App Engine features for the specified App @@ -555,7 +556,7 @@ async def sample_repair_application(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -621,14 +622,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ApplicationsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 52217f8..ac24ba5 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -426,7 +427,7 @@ def get_application( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> application.Application: r"""Gets information about an application. @@ -527,7 +528,7 @@ def create_application( request: Optional[Union[appengine.CreateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Creates an App Engine application for a Google Cloud Platform @@ -625,7 +626,7 @@ def update_application( request: Optional[Union[appengine.UpdateApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the specified Application resource. You can update the @@ -727,7 +728,7 @@ def repair_application( request: Optional[Union[appengine.RepairApplicationRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Recreates the required App Engine features for the specified App @@ -840,14 +841,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ApplicationsClient",) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/base.py b/google/cloud/appengine_admin_v1/services/applications/transports/base.py index 51740ea..96e0ed7 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine, application -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class ApplicationsTransport(abc.ABC): diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index 6695956..c2a7dc2 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -226,7 +227,7 @@ async def list_authorized_certificates( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedCertificatesAsyncPager: r"""Lists all SSL certificates the user is authorized to @@ -321,7 +322,7 @@ async def get_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. @@ -405,7 +406,7 @@ async def create_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. @@ -489,7 +490,7 @@ async def update_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Updates the specified SSL certificate. To renew a certificate @@ -578,7 +579,7 @@ async def delete_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified SSL certificate. @@ -647,14 +648,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("AuthorizedCertificatesAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index 815cfc6..a7d8cd9 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -430,7 +431,7 @@ def list_authorized_certificates( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedCertificatesPager: r"""Lists all SSL certificates the user is authorized to @@ -528,7 +529,7 @@ def get_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. @@ -615,7 +616,7 @@ def create_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. @@ -702,7 +703,7 @@ def update_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Updates the specified SSL certificate. To renew a certificate @@ -794,7 +795,7 @@ def delete_authorized_certificate( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified SSL certificate. @@ -873,14 +874,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("AuthorizedCertificatesClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py index b59421d..c2771e8 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.protobuf import empty_pb2 # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine, certificate -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class AuthorizedCertificatesTransport(abc.ABC): diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index c021a2e..565a7e7 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -219,7 +220,7 @@ async def list_authorized_domains( request: Optional[Union[appengine.ListAuthorizedDomainsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedDomainsAsyncPager: r"""Lists all domains the user is authorized to @@ -314,14 +315,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("AuthorizedDomainsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index 760bf73..d22ae87 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -426,7 +427,7 @@ def list_authorized_domains( request: Optional[Union[appengine.ListAuthorizedDomainsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedDomainsPager: r"""Lists all domains the user is authorized to @@ -529,14 +530,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("AuthorizedDomainsClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py index f74f018..87e51d4 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py @@ -23,18 +23,13 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class AuthorizedDomainsTransport(abc.ABC): diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 319e8a8..75e8308 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -221,7 +222,7 @@ async def list_domain_mappings( request: Optional[Union[appengine.ListDomainMappingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDomainMappingsAsyncPager: r"""Lists the domain mappings on an application. @@ -312,7 +313,7 @@ async def get_domain_mapping( request: Optional[Union[appengine.GetDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. @@ -391,7 +392,7 @@ async def create_domain_mapping( request: Optional[Union[appengine.CreateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Maps a domain to an application. A user must be authorized to @@ -423,7 +424,7 @@ async def sample_create_domain_mapping(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -488,7 +489,7 @@ async def update_domain_mapping( request: Optional[Union[appengine.UpdateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified domain mapping. To map an SSL certificate @@ -521,7 +522,7 @@ async def sample_update_domain_mapping(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -586,7 +587,7 @@ async def delete_domain_mapping( request: Optional[Union[appengine.DeleteDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the specified domain mapping. A user must be authorized @@ -617,7 +618,7 @@ async def sample_delete_domain_mapping(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -691,14 +692,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("DomainMappingsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index 127254a..f22ddaf 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -428,7 +429,7 @@ def list_domain_mappings( request: Optional[Union[appengine.ListDomainMappingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDomainMappingsPager: r"""Lists the domain mappings on an application. @@ -520,7 +521,7 @@ def get_domain_mapping( request: Optional[Union[appengine.GetDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. @@ -600,7 +601,7 @@ def create_domain_mapping( request: Optional[Union[appengine.CreateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Maps a domain to an application. A user must be authorized to @@ -698,7 +699,7 @@ def update_domain_mapping( request: Optional[Union[appengine.UpdateDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the specified domain mapping. To map an SSL certificate @@ -797,7 +798,7 @@ def delete_domain_mapping( request: Optional[Union[appengine.DeleteDomainMappingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deletes the specified domain mapping. A user must be authorized @@ -910,14 +911,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("DomainMappingsClient",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py index 9fc3f0c..af69105 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine, domain_mapping -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class DomainMappingsTransport(abc.ABC): diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index 140c5c3..02d80a5 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -219,7 +220,7 @@ async def list_ingress_rules( request: Optional[Union[appengine.ListIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIngressRulesAsyncPager: r"""Lists the firewall rules of an application. @@ -310,7 +311,7 @@ async def batch_update_ingress_rules( request: Optional[Union[appengine.BatchUpdateIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> appengine.BatchUpdateIngressRulesResponse: r"""Replaces the entire firewall ruleset in one bulk operation. This @@ -393,7 +394,7 @@ async def create_ingress_rule( request: Optional[Union[appengine.CreateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. @@ -474,7 +475,7 @@ async def get_ingress_rule( request: Optional[Union[appengine.GetIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. @@ -555,7 +556,7 @@ async def update_ingress_rule( request: Optional[Union[appengine.UpdateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. @@ -636,7 +637,7 @@ async def delete_ingress_rule( request: Optional[Union[appengine.DeleteIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified firewall rule. @@ -705,14 +706,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("FirewallAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 4b1f219..0293e45 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -432,7 +433,7 @@ def list_ingress_rules( request: Optional[Union[appengine.ListIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIngressRulesPager: r"""Lists the firewall rules of an application. @@ -524,7 +525,7 @@ def batch_update_ingress_rules( request: Optional[Union[appengine.BatchUpdateIngressRulesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> appengine.BatchUpdateIngressRulesResponse: r"""Replaces the entire firewall ruleset in one bulk operation. This @@ -610,7 +611,7 @@ def create_ingress_rule( request: Optional[Union[appengine.CreateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. @@ -692,7 +693,7 @@ def get_ingress_rule( request: Optional[Union[appengine.GetIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. @@ -774,7 +775,7 @@ def update_ingress_rule( request: Optional[Union[appengine.UpdateIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. @@ -856,7 +857,7 @@ def delete_ingress_rule( request: Optional[Union[appengine.DeleteIngressRuleRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified firewall rule. @@ -933,14 +934,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("FirewallClient",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py index 252df36..ee78145 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.protobuf import empty_pb2 # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine, firewall -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class FirewallTransport(abc.ABC): diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 1cafa52..ab4150f 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -218,7 +219,7 @@ async def list_instances( request: Optional[Union[appengine.ListInstancesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesAsyncPager: r"""Lists the instances of a version. @@ -313,7 +314,7 @@ async def get_instance( request: Optional[Union[appengine.GetInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> instance.Instance: r"""Gets instance information. @@ -393,7 +394,7 @@ async def delete_instance( request: Optional[Union[appengine.DeleteInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Stops a running instance. @@ -436,7 +437,7 @@ async def sample_delete_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -508,7 +509,7 @@ async def debug_instance( request: Optional[Union[appengine.DebugInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Enables debugging on a VM instance. This allows you @@ -546,7 +547,7 @@ async def sample_debug_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -612,14 +613,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("InstancesAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 6e61c63..5ae7a9e 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -451,7 +452,7 @@ def list_instances( request: Optional[Union[appengine.ListInstancesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesPager: r"""Lists the instances of a version. @@ -547,7 +548,7 @@ def get_instance( request: Optional[Union[appengine.GetInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> instance.Instance: r"""Gets instance information. @@ -628,7 +629,7 @@ def delete_instance( request: Optional[Union[appengine.DeleteInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Stops a running instance. @@ -744,7 +745,7 @@ def debug_instance( request: Optional[Union[appengine.DebugInstanceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Enables debugging on a VM instance. This allows you @@ -856,14 +857,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("InstancesClient",) diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/base.py b/google/cloud/appengine_admin_v1/services/instances/transports/base.py index 31325b3..cbba79c 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine, instance -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class InstancesTransport(abc.ABC): diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 242c602..e774ce3 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -214,7 +215,7 @@ async def list_services( request: Optional[Union[appengine.ListServicesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesAsyncPager: r"""Lists all the services in the application. @@ -305,7 +306,7 @@ async def get_service( request: Optional[Union[appengine.GetServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> service.Service: r"""Gets the current configuration of the specified @@ -395,7 +396,7 @@ async def update_service( request: Optional[Union[appengine.UpdateServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the configuration of the specified service. @@ -424,7 +425,7 @@ async def sample_update_service(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -495,7 +496,7 @@ async def delete_service( request: Optional[Union[appengine.DeleteServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the specified service and all enclosed @@ -525,7 +526,7 @@ async def sample_delete_service(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -599,14 +600,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ServicesAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index b1beb5c..7a6d2c2 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -427,7 +428,7 @@ def list_services( request: Optional[Union[appengine.ListServicesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesPager: r"""Lists all the services in the application. @@ -519,7 +520,7 @@ def get_service( request: Optional[Union[appengine.GetServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> service.Service: r"""Gets the current configuration of the specified @@ -610,7 +611,7 @@ def update_service( request: Optional[Union[appengine.UpdateServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the configuration of the specified service. @@ -711,7 +712,7 @@ def delete_service( request: Optional[Union[appengine.DeleteServiceRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deletes the specified service and all enclosed @@ -823,14 +824,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ServicesClient",) diff --git a/google/cloud/appengine_admin_v1/services/services/transports/base.py b/google/cloud/appengine_admin_v1/services/services/transports/base.py index f6eb783..797a86b 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine, service -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class ServicesTransport(abc.ABC): diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index 71f50d0..816c09d 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -216,7 +217,7 @@ async def list_versions( request: Optional[Union[appengine.ListVersionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVersionsAsyncPager: r"""Lists the versions of a service. @@ -307,7 +308,7 @@ async def get_version( request: Optional[Union[appengine.GetVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> version.Version: r"""Gets the specified Version resource. By default, only a @@ -389,7 +390,7 @@ async def create_version( request: Optional[Union[appengine.CreateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deploys code and resource files to a new version. @@ -418,7 +419,7 @@ async def sample_create_version(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -482,7 +483,7 @@ async def update_version( request: Optional[Union[appengine.UpdateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified Version resource. You can specify the @@ -546,7 +547,7 @@ async def sample_update_version(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -610,7 +611,7 @@ async def delete_version( request: Optional[Union[appengine.DeleteVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes an existing Version resource. @@ -639,7 +640,7 @@ async def sample_delete_version(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -713,14 +714,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("VersionsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 0425e51..3b2f0f3 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.appengine_admin_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -429,7 +430,7 @@ def list_versions( request: Optional[Union[appengine.ListVersionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVersionsPager: r"""Lists the versions of a service. @@ -521,7 +522,7 @@ def get_version( request: Optional[Union[appengine.GetVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> version.Version: r"""Gets the specified Version resource. By default, only a @@ -604,7 +605,7 @@ def create_version( request: Optional[Union[appengine.CreateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deploys code and resource files to a new version. @@ -698,7 +699,7 @@ def update_version( request: Optional[Union[appengine.UpdateVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Updates the specified Version resource. You can specify the @@ -827,7 +828,7 @@ def delete_version( request: Optional[Union[appengine.DeleteVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: r"""Deletes an existing Version resource. @@ -938,14 +939,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("VersionsClient",) diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/base.py b/google/cloud/appengine_admin_v1/services/versions/transports/base.py index 1addb34..4490b11 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.appengine_admin_v1 import gapic_version as package_version from google.cloud.appengine_admin_v1.types import appengine, version -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-appengine-admin", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class VersionsTransport(abc.ABC): diff --git a/release-please-config.json b/release-please-config.json index e1ecbdd..1b0eb82 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,6 +5,7 @@ "release-type": "python", "extra-files": [ "google/cloud/appengine_admin/gapic_version.py", + "google/cloud/appengine_admin_v1/gapic_version.py", { "type": "json", "path": "samples/generated_samples/snippet_metadata_google.appengine.v1.json", diff --git a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py index da93f20..8eab013 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py @@ -47,7 +47,7 @@ async def sample_create_application(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py index c849447..827974a 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py @@ -47,7 +47,7 @@ async def sample_repair_application(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py index e5d3402..9b9e504 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py @@ -47,7 +47,7 @@ async def sample_update_application(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py index b117722..51505e6 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py @@ -47,7 +47,7 @@ async def sample_create_domain_mapping(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py index 79ff3a1..1cf7ff2 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py @@ -47,7 +47,7 @@ async def sample_delete_domain_mapping(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py index fbc8087..3db55b5 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py @@ -47,7 +47,7 @@ async def sample_update_domain_mapping(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py index 7834ab3..963c210 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py @@ -47,7 +47,7 @@ async def sample_debug_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py index a1d9063..965849c 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py @@ -47,7 +47,7 @@ async def sample_delete_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py index 6b125aa..02b80fe 100644 --- a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py @@ -47,7 +47,7 @@ async def sample_delete_service(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py index 3a1d440..99914ae 100644 --- a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py @@ -47,7 +47,7 @@ async def sample_update_service(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py index 29ce9fe..9482b6c 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py @@ -47,7 +47,7 @@ async def sample_create_version(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py index 2f5dff4..c69926e 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py @@ -47,7 +47,7 @@ async def sample_delete_version(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py index 7c915fe..13b63b8 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py @@ -47,7 +47,7 @@ async def sample_update_version(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index 5f88fd1..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.7.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/setup.py b/setup.py index 922a440..7306d96 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 6f3158c..6c44adf 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -4,6 +4,6 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.33.2 +google-api-core==1.34.0 proto-plus==1.22.0 protobuf==3.19.5 From 0d17d39bcb5da495e36fba9f4904972238dcc421 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 8 Dec 2022 18:58:29 +0000 Subject: [PATCH 32/73] build(deps): bump certifi from 2022.9.24 to 2022.12.7 [autoapprove] (#214) Source-Link: https://togithub.com/googleapis/synthtool/commit/b4fe62efb5114b6738ad4b13d6f654f2bf4b7cc0 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1 --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.txt | 6 +++--- .pre-commit-config.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 3f1ccc0..fccaa8e 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:e6cbd61f1838d9ff6a31436dfc13717f372a7482a82fc1863ca954ec47bff8c8 + digest: sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 9c1b9be..05dc467 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -20,9 +20,9 @@ cachetools==5.2.0 \ --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db # via google-auth -certifi==2022.9.24 \ - --hash=sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14 \ - --hash=sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382 +certifi==2022.12.7 \ + --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \ + --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18 # via requests cffi==1.15.1 \ --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46d2371..5405cc8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: rev: 22.3.0 hooks: - id: black -- repo: https://gitlab.com/pycqa/flake8 +- repo: https://github.com/pycqa/flake8 rev: 3.9.2 hooks: - id: flake8 From 60a4d71ad1a7e479db90b036b1d013109d739367 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 15 Dec 2022 16:16:57 -0500 Subject: [PATCH 33/73] chore(main): release 1.7.1 (#213) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 64e0684..d0972da 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.7.0" + ".": "1.7.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index b088303..ba72611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.7.1](https://github.com/googleapis/python-appengine-admin/compare/v1.7.0...v1.7.1) (2022-12-08) + + +### Bug Fixes + +* **deps:** Require google-api-core >=1.34.0, >=2.11.0 ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) +* Drop usage of pkg_resources ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) +* Fix timeout default values ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) + + +### Documentation + +* **samples:** Snippetgen should call await on the operation coroutine before calling result ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) + ## [1.7.0](https://github.com/googleapis/python-appengine-admin/compare/v1.6.0...v1.7.0) (2022-11-16) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index f033c61..84856f0 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.7.0" # {x-release-please-version} +__version__ = "1.7.1" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index f033c61..84856f0 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.7.0" # {x-release-please-version} +__version__ = "1.7.1" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..b86c77a 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.7.1" }, "snippets": [ { From 8af5d5b243e4225aad2f41e89adfd3612a610a5a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 11:17:41 -0500 Subject: [PATCH 34/73] chore(python): add support for python 3.11 (#215) Source-Link: https://github.com/googleapis/synthtool/commit/7197a001ffb6d8ce7b0b9b11c280f0c536c1033a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 +- .github/workflows/unittest.yml | 2 +- .kokoro/samples/python3.11/common.cfg | 40 ++++++++++++++++++++ .kokoro/samples/python3.11/continuous.cfg | 6 +++ .kokoro/samples/python3.11/periodic-head.cfg | 11 ++++++ .kokoro/samples/python3.11/periodic.cfg | 6 +++ .kokoro/samples/python3.11/presubmit.cfg | 6 +++ CONTRIBUTING.rst | 6 ++- noxfile.py | 2 +- 9 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 .kokoro/samples/python3.11/common.cfg create mode 100644 .kokoro/samples/python3.11/continuous.cfg create mode 100644 .kokoro/samples/python3.11/periodic-head.cfg create mode 100644 .kokoro/samples/python3.11/periodic.cfg create mode 100644 .kokoro/samples/python3.11/presubmit.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fccaa8e..889f77d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1 + digest: sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 23000c0..8057a76 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.kokoro/samples/python3.11/common.cfg b/.kokoro/samples/python3.11/common.cfg new file mode 100644 index 0000000..c26a74f --- /dev/null +++ b/.kokoro/samples/python3.11/common.cfg @@ -0,0 +1,40 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.11" +} + +# Declare build specific Cloud project. +env_vars: { + key: "BUILD_SPECIFIC_GCLOUD_PROJECT" + value: "python-docs-samples-tests-311" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-appengine-admin/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.11/continuous.cfg b/.kokoro/samples/python3.11/continuous.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.11/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.11/periodic-head.cfg b/.kokoro/samples/python3.11/periodic-head.cfg new file mode 100644 index 0000000..302c7b0 --- /dev/null +++ b/.kokoro/samples/python3.11/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-appengine-admin/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.11/periodic.cfg b/.kokoro/samples/python3.11/periodic.cfg new file mode 100644 index 0000000..71cd1e5 --- /dev/null +++ b/.kokoro/samples/python3.11/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} diff --git a/.kokoro/samples/python3.11/presubmit.cfg b/.kokoro/samples/python3.11/presubmit.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.11/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index f449f7f..72a5caa 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows. + 3.7, 3.8, 3.9, 3.10 and 3.11 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -72,7 +72,7 @@ We use `nox `__ to instrument our tests. - To run a single unit test:: - $ nox -s unit-3.10 -- -k + $ nox -s unit-3.11 -- -k .. note:: @@ -225,11 +225,13 @@ We support: - `Python 3.8`_ - `Python 3.9`_ - `Python 3.10`_ +- `Python 3.11`_ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ .. _Python 3.9: https://docs.python.org/3.9/ .. _Python 3.10: https://docs.python.org/3.10/ +.. _Python 3.11: https://docs.python.org/3.11/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/noxfile.py b/noxfile.py index d8440c0..e716318 100644 --- a/noxfile.py +++ b/noxfile.py @@ -32,7 +32,7 @@ DEFAULT_PYTHON_VERSION = "3.8" -UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"] UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", "asyncmock", From ed1c020e28cc152dc273c409abfdc36c6c376b20 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 22:21:12 -0500 Subject: [PATCH 35/73] feat: Add support for python 3.11 (#216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add support for python 3.11 chore: Update gapic-generator-python to v1.8.0 PiperOrigin-RevId: 500768693 Source-Link: https://github.com/googleapis/googleapis/commit/190b612e3d0ff8f025875a669e5d68a1446d43c1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/7bf29a414b9ecac3170f0b65bdc2a95705c0ef1a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2JmMjlhNDE0YjllY2FjMzE3MGYwYjY1YmRjMmE5NTcwNWMwZWYxYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/applications/async_client.py | 2 +- .../appengine_admin_v1/services/applications/client.py | 2 +- .../services/authorized_certificates/async_client.py | 2 +- .../services/authorized_certificates/client.py | 2 +- .../services/authorized_domains/async_client.py | 2 +- .../services/authorized_domains/client.py | 2 +- .../services/domain_mappings/async_client.py | 2 +- .../appengine_admin_v1/services/domain_mappings/client.py | 2 +- .../appengine_admin_v1/services/firewall/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/firewall/client.py | 2 +- .../appengine_admin_v1/services/instances/async_client.py | 2 +- .../cloud/appengine_admin_v1/services/instances/client.py | 2 +- .../appengine_admin_v1/services/services/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/services/client.py | 2 +- .../appengine_admin_v1/services/versions/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/versions/client.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- setup.py | 2 ++ testing/constraints-3.12.txt | 6 ++++++ 19 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 testing/constraints-3.12.txt diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index e094798..5e9ff63 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -132,7 +132,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index ac24ba5..9a82047 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -270,7 +270,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index c2a7dc2..a22c82f 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -139,7 +139,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index a7d8cd9..2573e72 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -273,7 +273,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 565a7e7..4a51a6e 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -135,7 +135,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index d22ae87..d336158 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -271,7 +271,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 75e8308..997c978 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -137,7 +137,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index f22ddaf..163abcf 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -273,7 +273,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index 02d80a5..67c3e98 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -135,7 +135,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 0293e45..4b9b9f2 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -277,7 +277,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index ab4150f..0d7291d 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -134,7 +134,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 5ae7a9e..612bd41 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -296,7 +296,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index e774ce3..019c831 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -130,7 +130,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 7a6d2c2..11ffc05 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -272,7 +272,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index 816c09d..8fb0116 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -132,7 +132,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 3b2f0f3..b8dc6a0 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -274,7 +274,7 @@ def get_mtls_endpoint_and_cert_source( The API endpoint is determined in the following order: (1) if `client_options.api_endpoint` if provided, use the provided one. (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API + default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint. diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index b86c77a..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.7.1" + "version": "0.1.0" }, "snippets": [ { diff --git a/setup.py b/setup.py index 7306d96..0a6d760 100644 --- a/setup.py +++ b/setup.py @@ -40,6 +40,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", + "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] url = "https://github.com/googleapis/python-appengine-admin" @@ -79,6 +80,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/testing/constraints-3.12.txt b/testing/constraints-3.12.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/testing/constraints-3.12.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf From fd42d19b2b6ca957924ef55d11b4a44ccf7ffe3a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 11 Jan 2023 10:28:40 -0500 Subject: [PATCH 36/73] chore(main): release 1.8.0 (#217) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d0972da..099626f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.7.1" + ".": "1.8.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ba72611..c96d63f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.8.0](https://github.com/googleapis/python-appengine-admin/compare/v1.7.1...v1.8.0) (2023-01-10) + + +### Features + +* Add support for python 3.11 ([#216](https://github.com/googleapis/python-appengine-admin/issues/216)) ([ed1c020](https://github.com/googleapis/python-appengine-admin/commit/ed1c020e28cc152dc273c409abfdc36c6c376b20)) + ## [1.7.1](https://github.com/googleapis/python-appengine-admin/compare/v1.7.0...v1.7.1) (2022-12-08) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index 84856f0..b334dcc 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.7.1" # {x-release-please-version} +__version__ = "1.8.0" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index 84856f0..b334dcc 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.7.1" # {x-release-please-version} +__version__ = "1.8.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..fb8aad8 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.8.0" }, "snippets": [ { From 846b2e19462cbe1a0b2e201b95eee65deb3dbd5b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:47:59 -0500 Subject: [PATCH 37/73] docs: Add documentation for enums (#218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: https://github.com/googleapis/googleapis/commit/a391fd1dac18dfdfa00c18c8404f2c3a6ff8e98e Source-Link: https://github.com/googleapis/googleapis-gen/commit/0080f830dec37c3384157082bce279e37079ea58 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/applications/client.py | 2 +- .../authorized_certificates/client.py | 2 +- .../services/authorized_domains/client.py | 2 +- .../services/domain_mappings/client.py | 2 +- .../services/firewall/client.py | 2 +- .../services/instances/client.py | 2 +- .../services/services/client.py | 2 +- .../services/versions/client.py | 2 +- .../appengine_admin_v1/types/app_yaml.py | 91 ++++++++++++++++++- .../appengine_admin_v1/types/appengine.py | 39 +++++++- .../appengine_admin_v1/types/application.py | 26 +++++- .../appengine_admin_v1/types/certificate.py | 37 ++++++++ .../types/domain_mapping.py | 32 ++++++- .../appengine_admin_v1/types/firewall.py | 11 ++- .../appengine_admin_v1/types/instance.py | 42 ++++++++- .../types/network_settings.py | 16 +++- .../cloud/appengine_admin_v1/types/service.py | 20 +++- .../cloud/appengine_admin_v1/types/version.py | 68 +++++++++++++- .../snippet_metadata_google.appengine.v1.json | 2 +- 19 files changed, 373 insertions(+), 27 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 9a82047..5742ba5 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -827,7 +827,7 @@ def sample_repair_application(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "ApplicationsClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index 2573e72..be433ac 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -860,7 +860,7 @@ def sample_delete_authorized_certificate(): metadata=metadata, ) - def __enter__(self): + def __enter__(self) -> "AuthorizedCertificatesClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index d336158..d4d8c57 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -516,7 +516,7 @@ def sample_list_authorized_domains(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "AuthorizedDomainsClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index 163abcf..a96a7a6 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -897,7 +897,7 @@ def sample_delete_domain_mapping(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "DomainMappingsClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 4b9b9f2..2788d82 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -920,7 +920,7 @@ def sample_delete_ingress_rule(): metadata=metadata, ) - def __enter__(self): + def __enter__(self) -> "FirewallClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 612bd41..ff8afbb 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -843,7 +843,7 @@ def sample_debug_instance(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "InstancesClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 11ffc05..f1bb91a 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -810,7 +810,7 @@ def sample_delete_service(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "ServicesClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index b8dc6a0..f4280cd 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -925,7 +925,7 @@ def sample_delete_version(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "VersionsClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 1f1f30f..9384f6e 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -39,14 +39,42 @@ class AuthFailAction(proto.Enum): - r"""Actions to take when the user is not logged in.""" + r"""Actions to take when the user is not logged in. + + Values: + AUTH_FAIL_ACTION_UNSPECIFIED (0): + Not specified. ``AUTH_FAIL_ACTION_REDIRECT`` is assumed. + AUTH_FAIL_ACTION_REDIRECT (1): + Redirects user to "accounts.google.com". The + user is redirected back to the application URL + after signing in or creating an account. + AUTH_FAIL_ACTION_UNAUTHORIZED (2): + Rejects request with a ``401`` HTTP status code and an error + message. + """ AUTH_FAIL_ACTION_UNSPECIFIED = 0 AUTH_FAIL_ACTION_REDIRECT = 1 AUTH_FAIL_ACTION_UNAUTHORIZED = 2 class LoginRequirement(proto.Enum): - r"""Methods to restrict access to a URL based on login status.""" + r"""Methods to restrict access to a URL based on login status. + + Values: + LOGIN_UNSPECIFIED (0): + Not specified. ``LOGIN_OPTIONAL`` is assumed. + LOGIN_OPTIONAL (1): + Does not require that the user is signed in. + LOGIN_ADMIN (2): + If the user is not signed in, the ``auth_fail_action`` is + taken. In addition, if the user is not an administrator for + the application, they are given an error message regardless + of ``auth_fail_action``. If the user is an administrator, + the handler proceeds. + LOGIN_REQUIRED (3): + If the user has signed in, the handler proceeds normally. + Otherwise, the auth_fail_action is taken. + """ LOGIN_UNSPECIFIED = 0 LOGIN_OPTIONAL = 1 LOGIN_ADMIN = 2 @@ -54,7 +82,32 @@ class LoginRequirement(proto.Enum): class SecurityLevel(proto.Enum): - r"""Methods to enforce security (HTTPS) on a URL.""" + r"""Methods to enforce security (HTTPS) on a URL. + + Values: + SECURE_UNSPECIFIED (0): + Not specified. + SECURE_DEFAULT (0): + Both HTTP and HTTPS requests with URLs that + match the handler succeed without redirects. The + application can examine the request to determine + which protocol was used, and respond + accordingly. + SECURE_NEVER (1): + Requests for a URL that match this handler + that use HTTPS are automatically redirected to + the HTTP equivalent URL. + SECURE_OPTIONAL (2): + Both HTTP and HTTPS requests with URLs that + match the handler succeed without redirects. The + application can examine the request to determine + which protocol was used and respond accordingly. + SECURE_ALWAYS (3): + Requests for a URL that match this handler + that do not use HTTPS are automatically + redirected to the HTTPS URL with the same path. + Query parameters are reserved for the redirect. + """ _pb_options = {"allow_alias": True} SECURE_UNSPECIFIED = 0 SECURE_DEFAULT = 0 @@ -123,7 +176,22 @@ class ErrorHandler(proto.Message): """ class ErrorCode(proto.Enum): - r"""Error codes.""" + r"""Error codes. + + Values: + ERROR_CODE_UNSPECIFIED (0): + Not specified. ERROR_CODE_DEFAULT is assumed. + ERROR_CODE_DEFAULT (0): + All other error types. + ERROR_CODE_OVER_QUOTA (1): + Application has exceeded a resource quota. + ERROR_CODE_DOS_API_DENIAL (2): + Client blocked by the application's Denial of + Service protection configuration. + ERROR_CODE_TIMEOUT (3): + Deadline reached before the application + responds. + """ _pb_options = {"allow_alias": True} ERROR_CODE_UNSPECIFIED = 0 ERROR_CODE_DEFAULT = 0 @@ -198,7 +266,20 @@ class UrlMap(proto.Message): """ class RedirectHttpResponseCode(proto.Enum): - r"""Redirect codes.""" + r"""Redirect codes. + + Values: + REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED (0): + Not specified. ``302`` is assumed. + REDIRECT_HTTP_RESPONSE_CODE_301 (1): + ``301 Moved Permanently`` code. + REDIRECT_HTTP_RESPONSE_CODE_302 (2): + ``302 Moved Temporarily`` code. + REDIRECT_HTTP_RESPONSE_CODE_303 (3): + ``303 See Other`` code. + REDIRECT_HTTP_RESPONSE_CODE_307 (4): + ``307 Temporary Redirect`` code. + """ REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED = 0 REDIRECT_HTTP_RESPONSE_CODE_301 = 1 REDIRECT_HTTP_RESPONSE_CODE_302 = 2 diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index 3b24d8e..28ceb53 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -81,6 +81,17 @@ class VersionView(proto.Enum): r"""Fields that should be returned when [Version][google.appengine.v1.Version] resources are retrieved. + + Values: + BASIC (0): + Basic version information including scaling + and inbound services, but not detailed + deployment information. + FULL (1): + The information from ``BASIC``, plus detailed information + about the deployment. This format is required when creating + resources, but is not returned in ``Get`` or ``List`` by + default. """ BASIC = 0 FULL = 1 @@ -89,13 +100,39 @@ class VersionView(proto.Enum): class AuthorizedCertificateView(proto.Enum): r"""Fields that should be returned when an AuthorizedCertificate resource is retrieved. + + Values: + BASIC_CERTIFICATE (0): + Basic certificate information, including + applicable domains and expiration date. + FULL_CERTIFICATE (1): + The information from ``BASIC_CERTIFICATE``, plus detailed + information on the domain mappings that have this + certificate mapped. """ BASIC_CERTIFICATE = 0 FULL_CERTIFICATE = 1 class DomainOverrideStrategy(proto.Enum): - r"""Override strategy for mutating an existing mapping.""" + r"""Override strategy for mutating an existing mapping. + + Values: + UNSPECIFIED_DOMAIN_OVERRIDE_STRATEGY (0): + Strategy unspecified. Defaults to ``STRICT``. + STRICT (1): + Overrides not allowed. If a mapping already exists for the + specified domain, the request will return an ALREADY_EXISTS + (409). + OVERRIDE (2): + Overrides allowed. If a mapping already + exists for the specified domain, the request + will overwrite it. Note that this might stop + another Google product from serving. For + example, if the domain is mapped to another App + Engine application, that app will no longer + serve from that domain. + """ UNSPECIFIED_DOMAIN_OVERRIDE_STRATEGY = 0 STRICT = 1 OVERRIDE = 2 diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index 4206407..d50a6c0 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -104,14 +104,36 @@ class Application(proto.Message): """ class ServingStatus(proto.Enum): - r"""""" + r""" + + Values: + UNSPECIFIED (0): + Serving status is unspecified. + SERVING (1): + Application is serving. + USER_DISABLED (2): + Application has been disabled by the user. + SYSTEM_DISABLED (3): + Application has been disabled by the system. + """ UNSPECIFIED = 0 SERVING = 1 USER_DISABLED = 2 SYSTEM_DISABLED = 3 class DatabaseType(proto.Enum): - r"""""" + r""" + + Values: + DATABASE_TYPE_UNSPECIFIED (0): + Database type is unspecified. + CLOUD_DATASTORE (1): + Cloud Datastore + CLOUD_FIRESTORE (2): + Cloud Firestore Native + CLOUD_DATASTORE_COMPATIBILITY (3): + Cloud Firestore in Datastore Mode + """ DATABASE_TYPE_UNSPECIFIED = 0 CLOUD_DATASTORE = 1 CLOUD_FIRESTORE = 2 diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index 0fe3c65..e314a8a 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -32,6 +32,43 @@ class ManagementStatus(proto.Enum): r"""State of certificate management. Refers to the most recent certificate acquisition or renewal attempt. + + Values: + MANAGEMENT_STATUS_UNSPECIFIED (0): + + OK (1): + Certificate was successfully obtained and + inserted into the serving system. + PENDING (2): + Certificate is under active attempts to + acquire or renew. + FAILED_RETRYING_NOT_VISIBLE (4): + Most recent renewal failed due to an invalid + DNS setup and will be retried. Renewal attempts + will continue to fail until the certificate + domain's DNS configuration is fixed. The last + successfully provisioned certificate may still + be serving. + FAILED_PERMANENT (6): + All renewal attempts have been exhausted, + likely due to an invalid DNS setup. + FAILED_RETRYING_CAA_FORBIDDEN (7): + Most recent renewal failed due to an explicit + CAA record that does not include one of the + in-use CAs (Google CA and Let's Encrypt). + Renewals will continue to fail until the CAA is + reconfigured. The last successfully provisioned + certificate may still be serving. + FAILED_RETRYING_CAA_CHECKING (8): + Most recent renewal failed due to a CAA + retrieval failure. This means that the domain's + DNS provider does not properly handle CAA + records, failing requests for CAA records when + no CAA records are defined. Renewals will + continue to fail until the DNS provider is + changed or a CAA record is added for the given + domain. The last successfully provisioned + certificate may still be serving. """ MANAGEMENT_STATUS_UNSPECIFIED = 0 OK = 1 diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index 7d75e5b..5007c5a 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -107,7 +107,21 @@ class SslSettings(proto.Message): """ class SslManagementType(proto.Enum): - r"""The SSL management type for this domain.""" + r"""The SSL management type for this domain. + + Values: + SSL_MANAGEMENT_TYPE_UNSPECIFIED (0): + Defaults to ``AUTOMATIC``. + AUTOMATIC (1): + SSL support for this domain is configured + automatically. The mapped SSL certificate will + be automatically renewed. + MANUAL (2): + SSL support for this domain is configured + manually by the user. Either the domain has no + SSL support or a user-obtained SSL certificate + has been explictly mapped to this domain. + """ SSL_MANAGEMENT_TYPE_UNSPECIFIED = 0 AUTOMATIC = 1 MANUAL = 2 @@ -143,7 +157,21 @@ class ResourceRecord(proto.Message): """ class RecordType(proto.Enum): - r"""A resource record type.""" + r"""A resource record type. + + Values: + RECORD_TYPE_UNSPECIFIED (0): + An unknown resource record. + A (1): + An A resource record. Data is an IPv4 + address. + AAAA (2): + An AAAA resource record. Data is an IPv6 + address. + CNAME (3): + A CNAME resource record. Data is a domain + name to be aliased. + """ RECORD_TYPE_UNSPECIFIED = 0 A = 1 AAAA = 2 diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py index 9062b66..cd8209a 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -61,7 +61,16 @@ class FirewallRule(proto.Message): """ class Action(proto.Enum): - r"""Available actions to take on matching requests.""" + r"""Available actions to take on matching requests. + + Values: + UNSPECIFIED_ACTION (0): + + ALLOW (1): + Matching requests are allowed. + DENY (2): + Matching requests are denied. + """ UNSPECIFIED_ACTION = 0 ALLOW = 1 DENY = 2 diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index a767775..db103a8 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -92,7 +92,16 @@ class Instance(proto.Message): """ class Availability(proto.Enum): - r"""Availability of the instance.""" + r"""Availability of the instance. + + Values: + UNSPECIFIED (0): + + RESIDENT (1): + + DYNAMIC (2): + + """ UNSPECIFIED = 0 RESIDENT = 1 DYNAMIC = 2 @@ -101,7 +110,36 @@ class Liveness(proto.Message): r"""Wrapper for LivenessState enum.""" class LivenessState(proto.Enum): - r"""Liveness health check status for Flex instances.""" + r"""Liveness health check status for Flex instances. + + Values: + LIVENESS_STATE_UNSPECIFIED (0): + There is no liveness health check for the + instance. Only applicable for instances in App + Engine standard environment. + UNKNOWN (1): + The health checking system is aware of the + instance but its health is not known at the + moment. + HEALTHY (2): + The instance is reachable i.e. a connection + to the application health checking endpoint can + be established, and conforms to the requirements + defined by the health check. + UNHEALTHY (3): + The instance is reachable, but does not + conform to the requirements defined by the + health check. + DRAINING (4): + The instance is being drained. The existing + connections to the instance have time to + complete, but the new ones are being refused. + TIMEOUT (5): + The instance is unreachable i.e. a connection + to the application health checking endpoint + cannot be established, or the server does not + respond within the specified timeout. + """ LIVENESS_STATE_UNSPECIFIED = 0 UNKNOWN = 1 HEALTHY = 2 diff --git a/google/cloud/appengine_admin_v1/types/network_settings.py b/google/cloud/appengine_admin_v1/types/network_settings.py index 3594eb4..f47ece3 100644 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ b/google/cloud/appengine_admin_v1/types/network_settings.py @@ -35,7 +35,21 @@ class NetworkSettings(proto.Message): """ class IngressTrafficAllowed(proto.Enum): - r"""If unspecified, INGRESS_TRAFFIC_ALLOWED_ALL will be used.""" + r"""If unspecified, INGRESS_TRAFFIC_ALLOWED_ALL will be used. + + Values: + INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED (0): + Unspecified + INGRESS_TRAFFIC_ALLOWED_ALL (1): + Allow HTTP traffic from public and private + sources. + INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY (2): + Allow HTTP traffic from only private VPC + sources. + INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB (3): + Allow HTTP traffic from private VPC sources + and through load balancers. + """ INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED = 0 INGRESS_TRAFFIC_ALLOWED_ALL = 1 INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY = 2 diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index e09e628..1da091b 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -127,7 +127,25 @@ class TrafficSplit(proto.Message): """ class ShardBy(proto.Enum): - r"""Available sharding mechanisms.""" + r"""Available sharding mechanisms. + + Values: + UNSPECIFIED (0): + Diversion method unspecified. + COOKIE (1): + Diversion based on a specially named cookie, + "GOOGAPPUID." The cookie must be set by the + application itself or no diversion will occur. + IP (2): + Diversion based on applying the modulus + operation to a fingerprint of the IP address. + RANDOM (3): + Diversion based on weighted random + assignment. An incoming request is randomly + routed to a version in the traffic split, with + probability proportional to the version's + traffic share. + """ UNSPECIFIED = 0 COOKIE = 1 IP = 2 diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 62361bc..e1c5027 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -46,7 +46,35 @@ class InboundServiceType(proto.Enum): - r"""Available inbound services.""" + r"""Available inbound services. + + Values: + INBOUND_SERVICE_UNSPECIFIED (0): + Not specified. + INBOUND_SERVICE_MAIL (1): + Allows an application to receive mail. + INBOUND_SERVICE_MAIL_BOUNCE (2): + Allows an application to receive email-bound + notifications. + INBOUND_SERVICE_XMPP_ERROR (3): + Allows an application to receive error + stanzas. + INBOUND_SERVICE_XMPP_MESSAGE (4): + Allows an application to receive instant + messages. + INBOUND_SERVICE_XMPP_SUBSCRIBE (5): + Allows an application to receive user + subscription POSTs. + INBOUND_SERVICE_XMPP_PRESENCE (6): + Allows an application to receive a user's + chat presence. + INBOUND_SERVICE_CHANNEL_PRESENCE (7): + Registers an application for notifications + when a client connects or disconnects from a + channel. + INBOUND_SERVICE_WARMUP (9): + Enables warmup requests. + """ INBOUND_SERVICE_UNSPECIFIED = 0 INBOUND_SERVICE_MAIL = 1 INBOUND_SERVICE_MAIL_BOUNCE = 2 @@ -59,7 +87,20 @@ class InboundServiceType(proto.Enum): class ServingStatus(proto.Enum): - r"""Run states of a version.""" + r"""Run states of a version. + + Values: + SERVING_STATUS_UNSPECIFIED (0): + Not specified. + SERVING (1): + Currently serving. Instances are created + according to the scaling settings of the + version. + STOPPED (2): + Disabled. No instances will be created and the scaling + settings are ignored until the state of the version changes + to ``SERVING``. + """ SERVING_STATUS_UNSPECIFIED = 0 SERVING = 1 STOPPED = 2 @@ -497,7 +538,18 @@ class EndpointsApiService(proto.Message): """ class RolloutStrategy(proto.Enum): - r"""Available rollout strategies.""" + r"""Available rollout strategies. + + Values: + UNSPECIFIED_ROLLOUT_STRATEGY (0): + Not specified. Defaults to ``FIXED``. + FIXED (1): + Endpoints service configuration ID will be fixed to the + configuration ID specified by ``config_id``. + MANAGED (2): + Endpoints service configuration ID will be + updated with each rollout. + """ UNSPECIFIED_ROLLOUT_STRATEGY = 0 FIXED = 1 MANAGED = 2 @@ -981,6 +1033,16 @@ class EgressSetting(proto.Enum): This controls what traffic is diverted through the VPC Access Connector resource. By default PRIVATE_IP_RANGES will be used. + + Values: + EGRESS_SETTING_UNSPECIFIED (0): + + ALL_TRAFFIC (1): + Force the use of VPC Access for all egress + traffic from the function. + PRIVATE_IP_RANGES (2): + Use the VPC Access Connector for private IP + space from RFC1918. """ EGRESS_SETTING_UNSPECIFIED = 0 ALL_TRAFFIC = 1 diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8aad8..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.8.0" + "version": "0.1.0" }, "snippets": [ { From e156b27a32b83bd6276915899ed334a7a99eebb3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 10:40:42 -0500 Subject: [PATCH 38/73] chore(main): release 1.8.1 (#219) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 12 ++++++++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 099626f..7840fde 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.0" + ".": "1.8.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c96d63f..1c9c677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.8.1](https://github.com/googleapis/python-appengine-admin/compare/v1.8.0...v1.8.1) (2023-01-20) + + +### Bug Fixes + +* Add context manager return types ([846b2e1](https://github.com/googleapis/python-appengine-admin/commit/846b2e19462cbe1a0b2e201b95eee65deb3dbd5b)) + + +### Documentation + +* Add documentation for enums ([846b2e1](https://github.com/googleapis/python-appengine-admin/commit/846b2e19462cbe1a0b2e201b95eee65deb3dbd5b)) + ## [1.8.0](https://github.com/googleapis/python-appengine-admin/compare/v1.7.1...v1.8.0) (2023-01-10) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index b334dcc..90e0293 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.0" # {x-release-please-version} +__version__ = "1.8.1" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index b334dcc..90e0293 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.0" # {x-release-please-version} +__version__ = "1.8.1" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..4447546 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.8.1" }, "snippets": [ { From ffbaba5aa827e917b792594dc27284f1b3b4f7a0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 10:42:39 -0500 Subject: [PATCH 39/73] chore: Update gapic-generator-python to v1.8.2 (#220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.8.2 PiperOrigin-RevId: 504289125 Source-Link: https://github.com/googleapis/googleapis/commit/38a48a44a44279e9cf9f2f864b588958a2d87491 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b2dc22663dbe47a972c8d8c2f8a4df013dafdcbc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJkYzIyNjYzZGJlNDdhOTcyYzhkOGMyZjhhNGRmMDEzZGFmZGNiYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .coveragerc | 1 + google/cloud/appengine_admin_v1/__init__.py | 2 +- google/cloud/appengine_admin_v1/types/certificate.py | 2 +- google/cloud/appengine_admin_v1/types/firewall.py | 2 +- google/cloud/appengine_admin_v1/types/instance.py | 6 +++--- google/cloud/appengine_admin_v1/types/version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.coveragerc b/.coveragerc index c4d3671..d1bb5ee 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,6 +5,7 @@ branch = True show_missing = True omit = google/cloud/appengine_admin/__init__.py + google/cloud/appengine_admin/gapic_version.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER diff --git a/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index 38164c2..1b5d78c 100644 --- a/google/cloud/appengine_admin_v1/__init__.py +++ b/google/cloud/appengine_admin_v1/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from google.cloud.appengine_admin import gapic_version as package_version +from google.cloud.appengine_admin_v1 import gapic_version as package_version __version__ = package_version.__version__ diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index e314a8a..3424a63 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -35,7 +35,7 @@ class ManagementStatus(proto.Enum): Values: MANAGEMENT_STATUS_UNSPECIFIED (0): - + No description available. OK (1): Certificate was successfully obtained and inserted into the serving system. diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py index cd8209a..9c049dc 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -65,7 +65,7 @@ class Action(proto.Enum): Values: UNSPECIFIED_ACTION (0): - + No description available. ALLOW (1): Matching requests are allowed. DENY (2): diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index db103a8..37bf282 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -96,11 +96,11 @@ class Availability(proto.Enum): Values: UNSPECIFIED (0): - + No description available. RESIDENT (1): - + No description available. DYNAMIC (2): - + No description available. """ UNSPECIFIED = 0 RESIDENT = 1 diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index e1c5027..7b5946d 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -1036,7 +1036,7 @@ class EgressSetting(proto.Enum): Values: EGRESS_SETTING_UNSPECIFIED (0): - + No description available. ALL_TRAFFIC (1): Force the use of VPC Access for all egress traffic from the function. diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index 4447546..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.8.1" + "version": "0.1.0" }, "snippets": [ { From 76b35aa1686a5cbf9861939044e1621f747d681e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 16:48:12 +0000 Subject: [PATCH 40/73] chore: fix prerelease_deps nox session [autoapprove] (#221) Source-Link: https://togithub.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790 --- .github/.OwlBot.lock.yaml | 2 +- noxfile.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 889f77d..f0f3b24 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 + digest: sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790 diff --git a/noxfile.py b/noxfile.py index e716318..95e58c5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -189,9 +189,9 @@ def unit(session): def install_systemtest_dependencies(session, *constraints): # Use pre-release gRPC for system tests. - # Exclude version 1.49.0rc1 which has a known issue. - # See https://github.com/grpc/grpc/pull/30642 - session.install("--pre", "grpcio!=1.49.0rc1") + # Exclude version 1.52.0rc1 which has a known issue. + # See https://github.com/grpc/grpc/issues/32163 + session.install("--pre", "grpcio!=1.52.0rc1") session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) @@ -346,9 +346,7 @@ def prerelease_deps(session): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS + SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES ) session.install(*system_deps_all) @@ -378,8 +376,8 @@ def prerelease_deps(session): # dependency of grpc "six", "googleapis-common-protos", - # Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642 - "grpcio!=1.49.0rc1", + # Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163 + "grpcio!=1.52.0rc1", "grpcio-status", "google-api-core", "proto-plus", From ab088d99b648237260575286450902779bc3aecd Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 8 Feb 2023 06:34:50 -0500 Subject: [PATCH 41/73] chore: Update gapic-generator-python to v1.8.4 (#222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.8.4 PiperOrigin-RevId: 507808936 Source-Link: https://github.com/googleapis/googleapis/commit/64cf8492b21778ce62c66ecee81b468a293bfd4c Source-Link: https://github.com/googleapis/googleapis-gen/commit/53c48cac153d3b37f3d2c2dec4830cfd91ec4153 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTNjNDhjYWMxNTNkM2IzN2YzZDJjMmRlYzQ4MzBjZmQ5MWVjNDE1MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 0a6d760..3652982 100644 --- a/setup.py +++ b/setup.py @@ -57,9 +57,7 @@ if package.startswith("google") ] -namespaces = ["google"] -if "google.cloud" in packages: - namespaces.append("google.cloud") +namespaces = ["google", "google.cloud"] setuptools.setup( name=name, From c7233049794ac7416f12fe88170d6311ba6229f9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 8 Feb 2023 15:16:30 +0000 Subject: [PATCH 42/73] build(deps): bump cryptography from 38.0.3 to 39.0.1 in /synthtool/gcp/templates/python_library/.kokoro (#223) Source-Link: https://togithub.com/googleapis/synthtool/commit/bb171351c3946d3c3c32e60f5f18cee8c464ec51 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.txt | 49 ++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f0f3b24..894fb6b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790 + digest: sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 05dc467..096e480 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,33 +113,28 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==38.0.3 \ - --hash=sha256:068147f32fa662c81aebab95c74679b401b12b57494872886eb5c1139250ec5d \ - --hash=sha256:06fc3cc7b6f6cca87bd56ec80a580c88f1da5306f505876a71c8cfa7050257dd \ - --hash=sha256:25c1d1f19729fb09d42e06b4bf9895212292cb27bb50229f5aa64d039ab29146 \ - --hash=sha256:402852a0aea73833d982cabb6d0c3bb582c15483d29fb7085ef2c42bfa7e38d7 \ - --hash=sha256:4e269dcd9b102c5a3d72be3c45d8ce20377b8076a43cbed6f660a1afe365e436 \ - --hash=sha256:5419a127426084933076132d317911e3c6eb77568a1ce23c3ac1e12d111e61e0 \ - --hash=sha256:554bec92ee7d1e9d10ded2f7e92a5d70c1f74ba9524947c0ba0c850c7b011828 \ - --hash=sha256:5e89468fbd2fcd733b5899333bc54d0d06c80e04cd23d8c6f3e0542358c6060b \ - --hash=sha256:65535bc550b70bd6271984d9863a37741352b4aad6fb1b3344a54e6950249b55 \ - --hash=sha256:6ab9516b85bebe7aa83f309bacc5f44a61eeb90d0b4ec125d2d003ce41932d36 \ - --hash=sha256:6addc3b6d593cd980989261dc1cce38263c76954d758c3c94de51f1e010c9a50 \ - --hash=sha256:728f2694fa743a996d7784a6194da430f197d5c58e2f4e278612b359f455e4a2 \ - --hash=sha256:785e4056b5a8b28f05a533fab69febf5004458e20dad7e2e13a3120d8ecec75a \ - --hash=sha256:78cf5eefac2b52c10398a42765bfa981ce2372cbc0457e6bf9658f41ec3c41d8 \ - --hash=sha256:7f836217000342d448e1c9a342e9163149e45d5b5eca76a30e84503a5a96cab0 \ - --hash=sha256:8d41a46251bf0634e21fac50ffd643216ccecfaf3701a063257fe0b2be1b6548 \ - --hash=sha256:984fe150f350a3c91e84de405fe49e688aa6092b3525f407a18b9646f6612320 \ - --hash=sha256:9b24bcff7853ed18a63cfb0c2b008936a9554af24af2fb146e16d8e1aed75748 \ - --hash=sha256:b1b35d9d3a65542ed2e9d90115dfd16bbc027b3f07ee3304fc83580f26e43249 \ - --hash=sha256:b1b52c9e5f8aa2b802d48bd693190341fae201ea51c7a167d69fc48b60e8a959 \ - --hash=sha256:bbf203f1a814007ce24bd4d51362991d5cb90ba0c177a9c08825f2cc304d871f \ - --hash=sha256:be243c7e2bfcf6cc4cb350c0d5cdf15ca6383bbcb2a8ef51d3c9411a9d4386f0 \ - --hash=sha256:bfbe6ee19615b07a98b1d2287d6a6073f734735b49ee45b11324d85efc4d5cbd \ - --hash=sha256:c46837ea467ed1efea562bbeb543994c2d1f6e800785bd5a2c98bc096f5cb220 \ - --hash=sha256:dfb4f4dd568de1b6af9f4cda334adf7d72cf5bc052516e1b2608b683375dd95c \ - --hash=sha256:ed7b00096790213e09eb11c97cc6e2b757f15f3d2f85833cd2d3ec3fe37c1722 +cryptography==39.0.1 \ + --hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \ + --hash=sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f \ + --hash=sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502 \ + --hash=sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41 \ + --hash=sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965 \ + --hash=sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e \ + --hash=sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc \ + --hash=sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad \ + --hash=sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505 \ + --hash=sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388 \ + --hash=sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6 \ + --hash=sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2 \ + --hash=sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac \ + --hash=sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695 \ + --hash=sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6 \ + --hash=sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336 \ + --hash=sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0 \ + --hash=sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c \ + --hash=sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106 \ + --hash=sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a \ + --hash=sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8 # via # gcp-releasetool # secretstorage From 819631abc6b95d3d40d1772f74dac62300f4616f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 9 Feb 2023 06:35:29 -0500 Subject: [PATCH 43/73] feat: enable "rest" transport in Python for services supporting numeric enums (#224) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: enable "rest" transport in Python for services supporting numeric enums PiperOrigin-RevId: 508143576 Source-Link: https://github.com/googleapis/googleapis/commit/7a702a989db3b413f39ff8994ca53fb38b6928c2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6ad1279c0e7aa787ac6b66c9fd4a210692edffcd Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmFkMTI3OWMwZTdhYTc4N2FjNmI2NmM5ZmQ0YTIxMDY5MmVkZmZjZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../appengine_admin_v1/gapic_metadata.json | 210 +++ .../services/applications/client.py | 2 + .../applications/transports/__init__.py | 4 + .../services/applications/transports/rest.py | 710 ++++++++ .../authorized_certificates/client.py | 2 + .../transports/__init__.py | 7 + .../transports/rest.py | 795 +++++++++ .../services/authorized_domains/client.py | 2 + .../authorized_domains/transports/__init__.py | 4 + .../authorized_domains/transports/rest.py | 302 ++++ .../services/domain_mappings/client.py | 2 + .../domain_mappings/transports/__init__.py | 4 + .../domain_mappings/transports/rest.py | 828 ++++++++++ .../services/firewall/client.py | 2 + .../services/firewall/transports/__init__.py | 4 + .../services/firewall/transports/rest.py | 905 ++++++++++ .../services/instances/client.py | 2 + .../services/instances/transports/__init__.py | 4 + .../services/instances/transports/rest.py | 679 ++++++++ .../services/services/client.py | 2 + .../services/services/transports/__init__.py | 4 + .../services/services/transports/rest.py | 686 ++++++++ .../services/versions/client.py | 2 + .../services/versions/transports/__init__.py | 4 + .../services/versions/transports/rest.py | 801 +++++++++ .../appengine_admin_v1/test_applications.py | 786 ++++++++- .../test_authorized_certificates.py | 897 +++++++++- .../test_authorized_domains.py | 276 +++- .../test_domain_mappings.py | 838 +++++++++- .../gapic/appengine_admin_v1/test_firewall.py | 921 ++++++++++- .../appengine_admin_v1/test_instances.py | 685 +++++++- .../gapic/appengine_admin_v1/test_services.py | 657 +++++++- .../gapic/appengine_admin_v1/test_versions.py | 1457 ++++++++++++++++- 33 files changed, 12452 insertions(+), 32 deletions(-) create mode 100644 google/cloud/appengine_admin_v1/services/applications/transports/rest.py create mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py create mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py create mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py create mode 100644 google/cloud/appengine_admin_v1/services/firewall/transports/rest.py create mode 100644 google/cloud/appengine_admin_v1/services/instances/transports/rest.py create mode 100644 google/cloud/appengine_admin_v1/services/services/transports/rest.py create mode 100644 google/cloud/appengine_admin_v1/services/versions/transports/rest.py diff --git a/google/cloud/appengine_admin_v1/gapic_metadata.json b/google/cloud/appengine_admin_v1/gapic_metadata.json index 0bb6583..d99b434 100644 --- a/google/cloud/appengine_admin_v1/gapic_metadata.json +++ b/google/cloud/appengine_admin_v1/gapic_metadata.json @@ -56,6 +56,31 @@ ] } } + }, + "rest": { + "libraryClient": "ApplicationsClient", + "rpcs": { + "CreateApplication": { + "methods": [ + "create_application" + ] + }, + "GetApplication": { + "methods": [ + "get_application" + ] + }, + "RepairApplication": { + "methods": [ + "repair_application" + ] + }, + "UpdateApplication": { + "methods": [ + "update_application" + ] + } + } } } }, @@ -120,6 +145,36 @@ ] } } + }, + "rest": { + "libraryClient": "AuthorizedCertificatesClient", + "rpcs": { + "CreateAuthorizedCertificate": { + "methods": [ + "create_authorized_certificate" + ] + }, + "DeleteAuthorizedCertificate": { + "methods": [ + "delete_authorized_certificate" + ] + }, + "GetAuthorizedCertificate": { + "methods": [ + "get_authorized_certificate" + ] + }, + "ListAuthorizedCertificates": { + "methods": [ + "list_authorized_certificates" + ] + }, + "UpdateAuthorizedCertificate": { + "methods": [ + "update_authorized_certificate" + ] + } + } } } }, @@ -144,6 +199,16 @@ ] } } + }, + "rest": { + "libraryClient": "AuthorizedDomainsClient", + "rpcs": { + "ListAuthorizedDomains": { + "methods": [ + "list_authorized_domains" + ] + } + } } } }, @@ -208,6 +273,36 @@ ] } } + }, + "rest": { + "libraryClient": "DomainMappingsClient", + "rpcs": { + "CreateDomainMapping": { + "methods": [ + "create_domain_mapping" + ] + }, + "DeleteDomainMapping": { + "methods": [ + "delete_domain_mapping" + ] + }, + "GetDomainMapping": { + "methods": [ + "get_domain_mapping" + ] + }, + "ListDomainMappings": { + "methods": [ + "list_domain_mappings" + ] + }, + "UpdateDomainMapping": { + "methods": [ + "update_domain_mapping" + ] + } + } } } }, @@ -282,6 +377,41 @@ ] } } + }, + "rest": { + "libraryClient": "FirewallClient", + "rpcs": { + "BatchUpdateIngressRules": { + "methods": [ + "batch_update_ingress_rules" + ] + }, + "CreateIngressRule": { + "methods": [ + "create_ingress_rule" + ] + }, + "DeleteIngressRule": { + "methods": [ + "delete_ingress_rule" + ] + }, + "GetIngressRule": { + "methods": [ + "get_ingress_rule" + ] + }, + "ListIngressRules": { + "methods": [ + "list_ingress_rules" + ] + }, + "UpdateIngressRule": { + "methods": [ + "update_ingress_rule" + ] + } + } } } }, @@ -336,6 +466,31 @@ ] } } + }, + "rest": { + "libraryClient": "InstancesClient", + "rpcs": { + "DebugInstance": { + "methods": [ + "debug_instance" + ] + }, + "DeleteInstance": { + "methods": [ + "delete_instance" + ] + }, + "GetInstance": { + "methods": [ + "get_instance" + ] + }, + "ListInstances": { + "methods": [ + "list_instances" + ] + } + } } } }, @@ -390,6 +545,31 @@ ] } } + }, + "rest": { + "libraryClient": "ServicesClient", + "rpcs": { + "DeleteService": { + "methods": [ + "delete_service" + ] + }, + "GetService": { + "methods": [ + "get_service" + ] + }, + "ListServices": { + "methods": [ + "list_services" + ] + }, + "UpdateService": { + "methods": [ + "update_service" + ] + } + } } } }, @@ -454,6 +634,36 @@ ] } } + }, + "rest": { + "libraryClient": "VersionsClient", + "rpcs": { + "CreateVersion": { + "methods": [ + "create_version" + ] + }, + "DeleteVersion": { + "methods": [ + "delete_version" + ] + }, + "GetVersion": { + "methods": [ + "get_version" + ] + }, + "ListVersions": { + "methods": [ + "list_versions" + ] + }, + "UpdateVersion": { + "methods": [ + "update_version" + ] + } + } } } } diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 5742ba5..8ae55a0 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -56,6 +56,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, ApplicationsTransport from .transports.grpc import ApplicationsGrpcTransport from .transports.grpc_asyncio import ApplicationsGrpcAsyncIOTransport +from .transports.rest import ApplicationsRestTransport class ApplicationsClientMeta(type): @@ -69,6 +70,7 @@ class ApplicationsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[ApplicationsTransport]] _transport_registry["grpc"] = ApplicationsGrpcTransport _transport_registry["grpc_asyncio"] = ApplicationsGrpcAsyncIOTransport + _transport_registry["rest"] = ApplicationsRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py b/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py index d911b25..827f1d5 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py @@ -19,14 +19,18 @@ from .base import ApplicationsTransport from .grpc import ApplicationsGrpcTransport from .grpc_asyncio import ApplicationsGrpcAsyncIOTransport +from .rest import ApplicationsRestInterceptor, ApplicationsRestTransport # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ApplicationsTransport]] _transport_registry["grpc"] = ApplicationsGrpcTransport _transport_registry["grpc_asyncio"] = ApplicationsGrpcAsyncIOTransport +_transport_registry["rest"] = ApplicationsRestTransport __all__ = ( "ApplicationsTransport", "ApplicationsGrpcTransport", "ApplicationsGrpcAsyncIOTransport", + "ApplicationsRestTransport", + "ApplicationsRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py new file mode 100644 index 0000000..8ee3048 --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py @@ -0,0 +1,710 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import ( + gapic_v1, + operations_v1, + path_template, + rest_helpers, + rest_streaming, +) +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.longrunning import operations_pb2 # type: ignore + +from google.cloud.appengine_admin_v1.types import appengine, application + +from .base import ApplicationsTransport +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class ApplicationsRestInterceptor: + """Interceptor for Applications. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the ApplicationsRestTransport. + + .. code-block:: python + class MyCustomApplicationsInterceptor(ApplicationsRestInterceptor): + def pre_create_application(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_application(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_application(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_application(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_repair_application(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_repair_application(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_application(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_application(self, response): + logging.log(f"Received response: {response}") + return response + + transport = ApplicationsRestTransport(interceptor=MyCustomApplicationsInterceptor()) + client = ApplicationsClient(transport=transport) + + + """ + + def pre_create_application( + self, + request: appengine.CreateApplicationRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.CreateApplicationRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for create_application + + Override in a subclass to manipulate the request or metadata + before they are sent to the Applications server. + """ + return request, metadata + + def post_create_application( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for create_application + + Override in a subclass to manipulate the response + after it is returned by the Applications server but before + it is returned to user code. + """ + return response + + def pre_get_application( + self, + request: appengine.GetApplicationRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.GetApplicationRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_application + + Override in a subclass to manipulate the request or metadata + before they are sent to the Applications server. + """ + return request, metadata + + def post_get_application( + self, response: application.Application + ) -> application.Application: + """Post-rpc interceptor for get_application + + Override in a subclass to manipulate the response + after it is returned by the Applications server but before + it is returned to user code. + """ + return response + + def pre_repair_application( + self, + request: appengine.RepairApplicationRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.RepairApplicationRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for repair_application + + Override in a subclass to manipulate the request or metadata + before they are sent to the Applications server. + """ + return request, metadata + + def post_repair_application( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for repair_application + + Override in a subclass to manipulate the response + after it is returned by the Applications server but before + it is returned to user code. + """ + return response + + def pre_update_application( + self, + request: appengine.UpdateApplicationRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.UpdateApplicationRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_application + + Override in a subclass to manipulate the request or metadata + before they are sent to the Applications server. + """ + return request, metadata + + def post_update_application( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for update_application + + Override in a subclass to manipulate the response + after it is returned by the Applications server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class ApplicationsRestStub: + _session: AuthorizedSession + _host: str + _interceptor: ApplicationsRestInterceptor + + +class ApplicationsRestTransport(ApplicationsTransport): + """REST backend transport for Applications. + + Manages App Engine applications. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[ApplicationsRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or ApplicationsRestInterceptor() + self._prep_wrapped_messages(client_info) + + @property + def operations_client(self) -> operations_v1.AbstractOperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Only create a new client if we do not already have one. + if self._operations_client is None: + http_options: Dict[str, List[Dict[str, str]]] = {} + + rest_transport = operations_v1.OperationsRestTransport( + host=self._host, + # use the credentials which are saved + credentials=self._credentials, + scopes=self._scopes, + http_options=http_options, + path_prefix="v1", + ) + + self._operations_client = operations_v1.AbstractOperationsClient( + transport=rest_transport + ) + + # Return the client from cache. + return self._operations_client + + class _CreateApplication(ApplicationsRestStub): + def __hash__(self): + return hash("CreateApplication") + + def __call__( + self, + request: appengine.CreateApplicationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the create application method over HTTP. + + Args: + request (~.appengine.CreateApplicationRequest): + The request object. Request message for ``Applications.CreateApplication``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/apps", + "body": "application", + }, + ] + request, metadata = self._interceptor.pre_create_application( + request, metadata + ) + pb_request = appengine.CreateApplicationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_application(resp) + return resp + + class _GetApplication(ApplicationsRestStub): + def __hash__(self): + return hash("GetApplication") + + def __call__( + self, + request: appengine.GetApplicationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> application.Application: + r"""Call the get application method over HTTP. + + Args: + request (~.appengine.GetApplicationRequest): + The request object. Request message for ``Applications.GetApplication``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.application.Application: + An Application resource contains the + top-level configuration of an App Engine + application. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=apps/*}", + }, + ] + request, metadata = self._interceptor.pre_get_application(request, metadata) + pb_request = appengine.GetApplicationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = application.Application() + pb_resp = application.Application.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_application(resp) + return resp + + class _RepairApplication(ApplicationsRestStub): + def __hash__(self): + return hash("RepairApplication") + + def __call__( + self, + request: appengine.RepairApplicationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the repair application method over HTTP. + + Args: + request (~.appengine.RepairApplicationRequest): + The request object. Request message for + 'Applications.RepairApplication'. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{name=apps/*}:repair", + "body": "*", + }, + ] + request, metadata = self._interceptor.pre_repair_application( + request, metadata + ) + pb_request = appengine.RepairApplicationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_repair_application(resp) + return resp + + class _UpdateApplication(ApplicationsRestStub): + def __hash__(self): + return hash("UpdateApplication") + + def __call__( + self, + request: appengine.UpdateApplicationRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the update application method over HTTP. + + Args: + request (~.appengine.UpdateApplicationRequest): + The request object. Request message for ``Applications.UpdateApplication``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1/{name=apps/*}", + "body": "application", + }, + ] + request, metadata = self._interceptor.pre_update_application( + request, metadata + ) + pb_request = appengine.UpdateApplicationRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_application(resp) + return resp + + @property + def create_application( + self, + ) -> Callable[[appengine.CreateApplicationRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateApplication(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_application( + self, + ) -> Callable[[appengine.GetApplicationRequest], application.Application]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetApplication(self._session, self._host, self._interceptor) # type: ignore + + @property + def repair_application( + self, + ) -> Callable[[appengine.RepairApplicationRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._RepairApplication(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_application( + self, + ) -> Callable[[appengine.UpdateApplicationRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateApplication(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("ApplicationsRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index be433ac..d6a9f17 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -54,6 +54,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport from .transports.grpc import AuthorizedCertificatesGrpcTransport from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport +from .transports.rest import AuthorizedCertificatesRestTransport class AuthorizedCertificatesClientMeta(type): @@ -69,6 +70,7 @@ class AuthorizedCertificatesClientMeta(type): ) # type: Dict[str, Type[AuthorizedCertificatesTransport]] _transport_registry["grpc"] = AuthorizedCertificatesGrpcTransport _transport_registry["grpc_asyncio"] = AuthorizedCertificatesGrpcAsyncIOTransport + _transport_registry["rest"] = AuthorizedCertificatesRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py index 659030c..24f04d2 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py @@ -19,6 +19,10 @@ from .base import AuthorizedCertificatesTransport from .grpc import AuthorizedCertificatesGrpcTransport from .grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport +from .rest import ( + AuthorizedCertificatesRestInterceptor, + AuthorizedCertificatesRestTransport, +) # Compile a registry of transports. _transport_registry = ( @@ -26,9 +30,12 @@ ) # type: Dict[str, Type[AuthorizedCertificatesTransport]] _transport_registry["grpc"] = AuthorizedCertificatesGrpcTransport _transport_registry["grpc_asyncio"] = AuthorizedCertificatesGrpcAsyncIOTransport +_transport_registry["rest"] = AuthorizedCertificatesRestTransport __all__ = ( "AuthorizedCertificatesTransport", "AuthorizedCertificatesGrpcTransport", "AuthorizedCertificatesGrpcAsyncIOTransport", + "AuthorizedCertificatesRestTransport", + "AuthorizedCertificatesRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py new file mode 100644 index 0000000..31d05e8 --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py @@ -0,0 +1,795 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.protobuf import empty_pb2 # type: ignore + +from google.cloud.appengine_admin_v1.types import appengine, certificate + +from .base import AuthorizedCertificatesTransport +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class AuthorizedCertificatesRestInterceptor: + """Interceptor for AuthorizedCertificates. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the AuthorizedCertificatesRestTransport. + + .. code-block:: python + class MyCustomAuthorizedCertificatesInterceptor(AuthorizedCertificatesRestInterceptor): + def pre_create_authorized_certificate(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_authorized_certificate(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_delete_authorized_certificate(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def pre_get_authorized_certificate(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_authorized_certificate(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_authorized_certificates(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_authorized_certificates(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_authorized_certificate(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_authorized_certificate(self, response): + logging.log(f"Received response: {response}") + return response + + transport = AuthorizedCertificatesRestTransport(interceptor=MyCustomAuthorizedCertificatesInterceptor()) + client = AuthorizedCertificatesClient(transport=transport) + + + """ + + def pre_create_authorized_certificate( + self, + request: appengine.CreateAuthorizedCertificateRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.CreateAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for create_authorized_certificate + + Override in a subclass to manipulate the request or metadata + before they are sent to the AuthorizedCertificates server. + """ + return request, metadata + + def post_create_authorized_certificate( + self, response: certificate.AuthorizedCertificate + ) -> certificate.AuthorizedCertificate: + """Post-rpc interceptor for create_authorized_certificate + + Override in a subclass to manipulate the response + after it is returned by the AuthorizedCertificates server but before + it is returned to user code. + """ + return response + + def pre_delete_authorized_certificate( + self, + request: appengine.DeleteAuthorizedCertificateRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.DeleteAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete_authorized_certificate + + Override in a subclass to manipulate the request or metadata + before they are sent to the AuthorizedCertificates server. + """ + return request, metadata + + def pre_get_authorized_certificate( + self, + request: appengine.GetAuthorizedCertificateRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.GetAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_authorized_certificate + + Override in a subclass to manipulate the request or metadata + before they are sent to the AuthorizedCertificates server. + """ + return request, metadata + + def post_get_authorized_certificate( + self, response: certificate.AuthorizedCertificate + ) -> certificate.AuthorizedCertificate: + """Post-rpc interceptor for get_authorized_certificate + + Override in a subclass to manipulate the response + after it is returned by the AuthorizedCertificates server but before + it is returned to user code. + """ + return response + + def pre_list_authorized_certificates( + self, + request: appengine.ListAuthorizedCertificatesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.ListAuthorizedCertificatesRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_authorized_certificates + + Override in a subclass to manipulate the request or metadata + before they are sent to the AuthorizedCertificates server. + """ + return request, metadata + + def post_list_authorized_certificates( + self, response: appengine.ListAuthorizedCertificatesResponse + ) -> appengine.ListAuthorizedCertificatesResponse: + """Post-rpc interceptor for list_authorized_certificates + + Override in a subclass to manipulate the response + after it is returned by the AuthorizedCertificates server but before + it is returned to user code. + """ + return response + + def pre_update_authorized_certificate( + self, + request: appengine.UpdateAuthorizedCertificateRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.UpdateAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_authorized_certificate + + Override in a subclass to manipulate the request or metadata + before they are sent to the AuthorizedCertificates server. + """ + return request, metadata + + def post_update_authorized_certificate( + self, response: certificate.AuthorizedCertificate + ) -> certificate.AuthorizedCertificate: + """Post-rpc interceptor for update_authorized_certificate + + Override in a subclass to manipulate the response + after it is returned by the AuthorizedCertificates server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class AuthorizedCertificatesRestStub: + _session: AuthorizedSession + _host: str + _interceptor: AuthorizedCertificatesRestInterceptor + + +class AuthorizedCertificatesRestTransport(AuthorizedCertificatesTransport): + """REST backend transport for AuthorizedCertificates. + + Manages SSL certificates a user is authorized to administer. + A user can administer any SSL certificates applicable to their + authorized domains. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[AuthorizedCertificatesRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or AuthorizedCertificatesRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _CreateAuthorizedCertificate(AuthorizedCertificatesRestStub): + def __hash__(self): + return hash("CreateAuthorizedCertificate") + + def __call__( + self, + request: appengine.CreateAuthorizedCertificateRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> certificate.AuthorizedCertificate: + r"""Call the create authorized + certificate method over HTTP. + + Args: + request (~.appengine.CreateAuthorizedCertificateRequest): + The request object. Request message for + ``AuthorizedCertificates.CreateAuthorizedCertificate``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.certificate.AuthorizedCertificate: + An SSL certificate that a user has + been authorized to administer. A user is + authorized to administer any certificate + that applies to one of their authorized + domains. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{parent=apps/*}/authorizedCertificates", + "body": "certificate", + }, + ] + request, metadata = self._interceptor.pre_create_authorized_certificate( + request, metadata + ) + pb_request = appengine.CreateAuthorizedCertificateRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = certificate.AuthorizedCertificate() + pb_resp = certificate.AuthorizedCertificate.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_authorized_certificate(resp) + return resp + + class _DeleteAuthorizedCertificate(AuthorizedCertificatesRestStub): + def __hash__(self): + return hash("DeleteAuthorizedCertificate") + + def __call__( + self, + request: appengine.DeleteAuthorizedCertificateRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ): + r"""Call the delete authorized + certificate method over HTTP. + + Args: + request (~.appengine.DeleteAuthorizedCertificateRequest): + The request object. Request message for + ``AuthorizedCertificates.DeleteAuthorizedCertificate``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1/{name=apps/*/authorizedCertificates/*}", + }, + ] + request, metadata = self._interceptor.pre_delete_authorized_certificate( + request, metadata + ) + pb_request = appengine.DeleteAuthorizedCertificateRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + class _GetAuthorizedCertificate(AuthorizedCertificatesRestStub): + def __hash__(self): + return hash("GetAuthorizedCertificate") + + def __call__( + self, + request: appengine.GetAuthorizedCertificateRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> certificate.AuthorizedCertificate: + r"""Call the get authorized + certificate method over HTTP. + + Args: + request (~.appengine.GetAuthorizedCertificateRequest): + The request object. Request message for + ``AuthorizedCertificates.GetAuthorizedCertificate``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.certificate.AuthorizedCertificate: + An SSL certificate that a user has + been authorized to administer. A user is + authorized to administer any certificate + that applies to one of their authorized + domains. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=apps/*/authorizedCertificates/*}", + }, + ] + request, metadata = self._interceptor.pre_get_authorized_certificate( + request, metadata + ) + pb_request = appengine.GetAuthorizedCertificateRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = certificate.AuthorizedCertificate() + pb_resp = certificate.AuthorizedCertificate.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_authorized_certificate(resp) + return resp + + class _ListAuthorizedCertificates(AuthorizedCertificatesRestStub): + def __hash__(self): + return hash("ListAuthorizedCertificates") + + def __call__( + self, + request: appengine.ListAuthorizedCertificatesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.ListAuthorizedCertificatesResponse: + r"""Call the list authorized + certificates method over HTTP. + + Args: + request (~.appengine.ListAuthorizedCertificatesRequest): + The request object. Request message for + ``AuthorizedCertificates.ListAuthorizedCertificates``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.ListAuthorizedCertificatesResponse: + Response message for + ``AuthorizedCertificates.ListAuthorizedCertificates``. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=apps/*}/authorizedCertificates", + }, + ] + request, metadata = self._interceptor.pre_list_authorized_certificates( + request, metadata + ) + pb_request = appengine.ListAuthorizedCertificatesRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.ListAuthorizedCertificatesResponse() + pb_resp = appengine.ListAuthorizedCertificatesResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_authorized_certificates(resp) + return resp + + class _UpdateAuthorizedCertificate(AuthorizedCertificatesRestStub): + def __hash__(self): + return hash("UpdateAuthorizedCertificate") + + def __call__( + self, + request: appengine.UpdateAuthorizedCertificateRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> certificate.AuthorizedCertificate: + r"""Call the update authorized + certificate method over HTTP. + + Args: + request (~.appengine.UpdateAuthorizedCertificateRequest): + The request object. Request message for + ``AuthorizedCertificates.UpdateAuthorizedCertificate``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.certificate.AuthorizedCertificate: + An SSL certificate that a user has + been authorized to administer. A user is + authorized to administer any certificate + that applies to one of their authorized + domains. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1/{name=apps/*/authorizedCertificates/*}", + "body": "certificate", + }, + ] + request, metadata = self._interceptor.pre_update_authorized_certificate( + request, metadata + ) + pb_request = appengine.UpdateAuthorizedCertificateRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = certificate.AuthorizedCertificate() + pb_resp = certificate.AuthorizedCertificate.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_authorized_certificate(resp) + return resp + + @property + def create_authorized_certificate( + self, + ) -> Callable[ + [appengine.CreateAuthorizedCertificateRequest], + certificate.AuthorizedCertificate, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore + + @property + def delete_authorized_certificate( + self, + ) -> Callable[[appengine.DeleteAuthorizedCertificateRequest], empty_pb2.Empty]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_authorized_certificate( + self, + ) -> Callable[ + [appengine.GetAuthorizedCertificateRequest], certificate.AuthorizedCertificate + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_authorized_certificates( + self, + ) -> Callable[ + [appengine.ListAuthorizedCertificatesRequest], + appengine.ListAuthorizedCertificatesResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListAuthorizedCertificates(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_authorized_certificate( + self, + ) -> Callable[ + [appengine.UpdateAuthorizedCertificateRequest], + certificate.AuthorizedCertificate, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("AuthorizedCertificatesRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index d4d8c57..3a6b4ed 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -52,6 +52,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport from .transports.grpc import AuthorizedDomainsGrpcTransport from .transports.grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport +from .transports.rest import AuthorizedDomainsRestTransport class AuthorizedDomainsClientMeta(type): @@ -67,6 +68,7 @@ class AuthorizedDomainsClientMeta(type): ) # type: Dict[str, Type[AuthorizedDomainsTransport]] _transport_registry["grpc"] = AuthorizedDomainsGrpcTransport _transport_registry["grpc_asyncio"] = AuthorizedDomainsGrpcAsyncIOTransport + _transport_registry["rest"] = AuthorizedDomainsRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py index 5938ca9..f2fffb0 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py @@ -19,14 +19,18 @@ from .base import AuthorizedDomainsTransport from .grpc import AuthorizedDomainsGrpcTransport from .grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport +from .rest import AuthorizedDomainsRestInterceptor, AuthorizedDomainsRestTransport # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[AuthorizedDomainsTransport]] _transport_registry["grpc"] = AuthorizedDomainsGrpcTransport _transport_registry["grpc_asyncio"] = AuthorizedDomainsGrpcAsyncIOTransport +_transport_registry["rest"] = AuthorizedDomainsRestTransport __all__ = ( "AuthorizedDomainsTransport", "AuthorizedDomainsGrpcTransport", "AuthorizedDomainsGrpcAsyncIOTransport", + "AuthorizedDomainsRestTransport", + "AuthorizedDomainsRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py new file mode 100644 index 0000000..f5adcbf --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py @@ -0,0 +1,302 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.cloud.appengine_admin_v1.types import appengine + +from .base import AuthorizedDomainsTransport +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class AuthorizedDomainsRestInterceptor: + """Interceptor for AuthorizedDomains. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the AuthorizedDomainsRestTransport. + + .. code-block:: python + class MyCustomAuthorizedDomainsInterceptor(AuthorizedDomainsRestInterceptor): + def pre_list_authorized_domains(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_authorized_domains(self, response): + logging.log(f"Received response: {response}") + return response + + transport = AuthorizedDomainsRestTransport(interceptor=MyCustomAuthorizedDomainsInterceptor()) + client = AuthorizedDomainsClient(transport=transport) + + + """ + + def pre_list_authorized_domains( + self, + request: appengine.ListAuthorizedDomainsRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.ListAuthorizedDomainsRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_authorized_domains + + Override in a subclass to manipulate the request or metadata + before they are sent to the AuthorizedDomains server. + """ + return request, metadata + + def post_list_authorized_domains( + self, response: appengine.ListAuthorizedDomainsResponse + ) -> appengine.ListAuthorizedDomainsResponse: + """Post-rpc interceptor for list_authorized_domains + + Override in a subclass to manipulate the response + after it is returned by the AuthorizedDomains server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class AuthorizedDomainsRestStub: + _session: AuthorizedSession + _host: str + _interceptor: AuthorizedDomainsRestInterceptor + + +class AuthorizedDomainsRestTransport(AuthorizedDomainsTransport): + """REST backend transport for AuthorizedDomains. + + Manages domains a user is authorized to administer. To authorize use + of a domain, verify ownership via `Webmaster + Central `__. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[AuthorizedDomainsRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or AuthorizedDomainsRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _ListAuthorizedDomains(AuthorizedDomainsRestStub): + def __hash__(self): + return hash("ListAuthorizedDomains") + + def __call__( + self, + request: appengine.ListAuthorizedDomainsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.ListAuthorizedDomainsResponse: + r"""Call the list authorized domains method over HTTP. + + Args: + request (~.appengine.ListAuthorizedDomainsRequest): + The request object. Request message for + ``AuthorizedDomains.ListAuthorizedDomains``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.ListAuthorizedDomainsResponse: + Response message for + ``AuthorizedDomains.ListAuthorizedDomains``. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=apps/*}/authorizedDomains", + }, + ] + request, metadata = self._interceptor.pre_list_authorized_domains( + request, metadata + ) + pb_request = appengine.ListAuthorizedDomainsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.ListAuthorizedDomainsResponse() + pb_resp = appengine.ListAuthorizedDomainsResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_authorized_domains(resp) + return resp + + @property + def list_authorized_domains( + self, + ) -> Callable[ + [appengine.ListAuthorizedDomainsRequest], + appengine.ListAuthorizedDomainsResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListAuthorizedDomains(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("AuthorizedDomainsRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index a96a7a6..d2a2e17 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -57,6 +57,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, DomainMappingsTransport from .transports.grpc import DomainMappingsGrpcTransport from .transports.grpc_asyncio import DomainMappingsGrpcAsyncIOTransport +from .transports.rest import DomainMappingsRestTransport class DomainMappingsClientMeta(type): @@ -72,6 +73,7 @@ class DomainMappingsClientMeta(type): ) # type: Dict[str, Type[DomainMappingsTransport]] _transport_registry["grpc"] = DomainMappingsGrpcTransport _transport_registry["grpc_asyncio"] = DomainMappingsGrpcAsyncIOTransport + _transport_registry["rest"] = DomainMappingsRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py index 1883c69..a17f0ae 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py @@ -19,14 +19,18 @@ from .base import DomainMappingsTransport from .grpc import DomainMappingsGrpcTransport from .grpc_asyncio import DomainMappingsGrpcAsyncIOTransport +from .rest import DomainMappingsRestInterceptor, DomainMappingsRestTransport # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[DomainMappingsTransport]] _transport_registry["grpc"] = DomainMappingsGrpcTransport _transport_registry["grpc_asyncio"] = DomainMappingsGrpcAsyncIOTransport +_transport_registry["rest"] = DomainMappingsRestTransport __all__ = ( "DomainMappingsTransport", "DomainMappingsGrpcTransport", "DomainMappingsGrpcAsyncIOTransport", + "DomainMappingsRestTransport", + "DomainMappingsRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py new file mode 100644 index 0000000..c5a1a81 --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py @@ -0,0 +1,828 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import ( + gapic_v1, + operations_v1, + path_template, + rest_helpers, + rest_streaming, +) +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.longrunning import operations_pb2 # type: ignore + +from google.cloud.appengine_admin_v1.types import appengine, domain_mapping + +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO +from .base import DomainMappingsTransport + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class DomainMappingsRestInterceptor: + """Interceptor for DomainMappings. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the DomainMappingsRestTransport. + + .. code-block:: python + class MyCustomDomainMappingsInterceptor(DomainMappingsRestInterceptor): + def pre_create_domain_mapping(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_domain_mapping(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_delete_domain_mapping(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete_domain_mapping(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_domain_mapping(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_domain_mapping(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_domain_mappings(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_domain_mappings(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_domain_mapping(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_domain_mapping(self, response): + logging.log(f"Received response: {response}") + return response + + transport = DomainMappingsRestTransport(interceptor=MyCustomDomainMappingsInterceptor()) + client = DomainMappingsClient(transport=transport) + + + """ + + def pre_create_domain_mapping( + self, + request: appengine.CreateDomainMappingRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.CreateDomainMappingRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for create_domain_mapping + + Override in a subclass to manipulate the request or metadata + before they are sent to the DomainMappings server. + """ + return request, metadata + + def post_create_domain_mapping( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for create_domain_mapping + + Override in a subclass to manipulate the response + after it is returned by the DomainMappings server but before + it is returned to user code. + """ + return response + + def pre_delete_domain_mapping( + self, + request: appengine.DeleteDomainMappingRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.DeleteDomainMappingRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete_domain_mapping + + Override in a subclass to manipulate the request or metadata + before they are sent to the DomainMappings server. + """ + return request, metadata + + def post_delete_domain_mapping( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for delete_domain_mapping + + Override in a subclass to manipulate the response + after it is returned by the DomainMappings server but before + it is returned to user code. + """ + return response + + def pre_get_domain_mapping( + self, + request: appengine.GetDomainMappingRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.GetDomainMappingRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_domain_mapping + + Override in a subclass to manipulate the request or metadata + before they are sent to the DomainMappings server. + """ + return request, metadata + + def post_get_domain_mapping( + self, response: domain_mapping.DomainMapping + ) -> domain_mapping.DomainMapping: + """Post-rpc interceptor for get_domain_mapping + + Override in a subclass to manipulate the response + after it is returned by the DomainMappings server but before + it is returned to user code. + """ + return response + + def pre_list_domain_mappings( + self, + request: appengine.ListDomainMappingsRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.ListDomainMappingsRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_domain_mappings + + Override in a subclass to manipulate the request or metadata + before they are sent to the DomainMappings server. + """ + return request, metadata + + def post_list_domain_mappings( + self, response: appengine.ListDomainMappingsResponse + ) -> appengine.ListDomainMappingsResponse: + """Post-rpc interceptor for list_domain_mappings + + Override in a subclass to manipulate the response + after it is returned by the DomainMappings server but before + it is returned to user code. + """ + return response + + def pre_update_domain_mapping( + self, + request: appengine.UpdateDomainMappingRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.UpdateDomainMappingRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_domain_mapping + + Override in a subclass to manipulate the request or metadata + before they are sent to the DomainMappings server. + """ + return request, metadata + + def post_update_domain_mapping( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for update_domain_mapping + + Override in a subclass to manipulate the response + after it is returned by the DomainMappings server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class DomainMappingsRestStub: + _session: AuthorizedSession + _host: str + _interceptor: DomainMappingsRestInterceptor + + +class DomainMappingsRestTransport(DomainMappingsTransport): + """REST backend transport for DomainMappings. + + Manages domains serving an application. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[DomainMappingsRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or DomainMappingsRestInterceptor() + self._prep_wrapped_messages(client_info) + + @property + def operations_client(self) -> operations_v1.AbstractOperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Only create a new client if we do not already have one. + if self._operations_client is None: + http_options: Dict[str, List[Dict[str, str]]] = {} + + rest_transport = operations_v1.OperationsRestTransport( + host=self._host, + # use the credentials which are saved + credentials=self._credentials, + scopes=self._scopes, + http_options=http_options, + path_prefix="v1", + ) + + self._operations_client = operations_v1.AbstractOperationsClient( + transport=rest_transport + ) + + # Return the client from cache. + return self._operations_client + + class _CreateDomainMapping(DomainMappingsRestStub): + def __hash__(self): + return hash("CreateDomainMapping") + + def __call__( + self, + request: appengine.CreateDomainMappingRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the create domain mapping method over HTTP. + + Args: + request (~.appengine.CreateDomainMappingRequest): + The request object. Request message for + ``DomainMappings.CreateDomainMapping``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{parent=apps/*}/domainMappings", + "body": "domain_mapping", + }, + ] + request, metadata = self._interceptor.pre_create_domain_mapping( + request, metadata + ) + pb_request = appengine.CreateDomainMappingRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_domain_mapping(resp) + return resp + + class _DeleteDomainMapping(DomainMappingsRestStub): + def __hash__(self): + return hash("DeleteDomainMapping") + + def __call__( + self, + request: appengine.DeleteDomainMappingRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the delete domain mapping method over HTTP. + + Args: + request (~.appengine.DeleteDomainMappingRequest): + The request object. Request message for + ``DomainMappings.DeleteDomainMapping``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1/{name=apps/*/domainMappings/*}", + }, + ] + request, metadata = self._interceptor.pre_delete_domain_mapping( + request, metadata + ) + pb_request = appengine.DeleteDomainMappingRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_domain_mapping(resp) + return resp + + class _GetDomainMapping(DomainMappingsRestStub): + def __hash__(self): + return hash("GetDomainMapping") + + def __call__( + self, + request: appengine.GetDomainMappingRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> domain_mapping.DomainMapping: + r"""Call the get domain mapping method over HTTP. + + Args: + request (~.appengine.GetDomainMappingRequest): + The request object. Request message for ``DomainMappings.GetDomainMapping``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.domain_mapping.DomainMapping: + A domain serving an App Engine + application. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=apps/*/domainMappings/*}", + }, + ] + request, metadata = self._interceptor.pre_get_domain_mapping( + request, metadata + ) + pb_request = appengine.GetDomainMappingRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = domain_mapping.DomainMapping() + pb_resp = domain_mapping.DomainMapping.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_domain_mapping(resp) + return resp + + class _ListDomainMappings(DomainMappingsRestStub): + def __hash__(self): + return hash("ListDomainMappings") + + def __call__( + self, + request: appengine.ListDomainMappingsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.ListDomainMappingsResponse: + r"""Call the list domain mappings method over HTTP. + + Args: + request (~.appengine.ListDomainMappingsRequest): + The request object. Request message for + ``DomainMappings.ListDomainMappings``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.ListDomainMappingsResponse: + Response message for + ``DomainMappings.ListDomainMappings``. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=apps/*}/domainMappings", + }, + ] + request, metadata = self._interceptor.pre_list_domain_mappings( + request, metadata + ) + pb_request = appengine.ListDomainMappingsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.ListDomainMappingsResponse() + pb_resp = appengine.ListDomainMappingsResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_domain_mappings(resp) + return resp + + class _UpdateDomainMapping(DomainMappingsRestStub): + def __hash__(self): + return hash("UpdateDomainMapping") + + def __call__( + self, + request: appengine.UpdateDomainMappingRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the update domain mapping method over HTTP. + + Args: + request (~.appengine.UpdateDomainMappingRequest): + The request object. Request message for + ``DomainMappings.UpdateDomainMapping``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1/{name=apps/*/domainMappings/*}", + "body": "domain_mapping", + }, + ] + request, metadata = self._interceptor.pre_update_domain_mapping( + request, metadata + ) + pb_request = appengine.UpdateDomainMappingRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_domain_mapping(resp) + return resp + + @property + def create_domain_mapping( + self, + ) -> Callable[[appengine.CreateDomainMappingRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateDomainMapping(self._session, self._host, self._interceptor) # type: ignore + + @property + def delete_domain_mapping( + self, + ) -> Callable[[appengine.DeleteDomainMappingRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteDomainMapping(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_domain_mapping( + self, + ) -> Callable[[appengine.GetDomainMappingRequest], domain_mapping.DomainMapping]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetDomainMapping(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_domain_mappings( + self, + ) -> Callable[ + [appengine.ListDomainMappingsRequest], appengine.ListDomainMappingsResponse + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListDomainMappings(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_domain_mapping( + self, + ) -> Callable[[appengine.UpdateDomainMappingRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateDomainMapping(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("DomainMappingsRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 2788d82..2bc056a 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -52,6 +52,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, FirewallTransport from .transports.grpc import FirewallGrpcTransport from .transports.grpc_asyncio import FirewallGrpcAsyncIOTransport +from .transports.rest import FirewallRestTransport class FirewallClientMeta(type): @@ -65,6 +66,7 @@ class FirewallClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[FirewallTransport]] _transport_registry["grpc"] = FirewallGrpcTransport _transport_registry["grpc_asyncio"] = FirewallGrpcAsyncIOTransport + _transport_registry["rest"] = FirewallRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py index 382119f..fa9b990 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py @@ -19,14 +19,18 @@ from .base import FirewallTransport from .grpc import FirewallGrpcTransport from .grpc_asyncio import FirewallGrpcAsyncIOTransport +from .rest import FirewallRestInterceptor, FirewallRestTransport # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[FirewallTransport]] _transport_registry["grpc"] = FirewallGrpcTransport _transport_registry["grpc_asyncio"] = FirewallGrpcAsyncIOTransport +_transport_registry["rest"] = FirewallRestTransport __all__ = ( "FirewallTransport", "FirewallGrpcTransport", "FirewallGrpcAsyncIOTransport", + "FirewallRestTransport", + "FirewallRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py new file mode 100644 index 0000000..c11db17 --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py @@ -0,0 +1,905 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.protobuf import empty_pb2 # type: ignore + +from google.cloud.appengine_admin_v1.types import appengine, firewall + +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO +from .base import FirewallTransport + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class FirewallRestInterceptor: + """Interceptor for Firewall. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the FirewallRestTransport. + + .. code-block:: python + class MyCustomFirewallInterceptor(FirewallRestInterceptor): + def pre_batch_update_ingress_rules(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_batch_update_ingress_rules(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_create_ingress_rule(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_ingress_rule(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_delete_ingress_rule(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def pre_get_ingress_rule(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_ingress_rule(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_ingress_rules(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_ingress_rules(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_ingress_rule(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_ingress_rule(self, response): + logging.log(f"Received response: {response}") + return response + + transport = FirewallRestTransport(interceptor=MyCustomFirewallInterceptor()) + client = FirewallClient(transport=transport) + + + """ + + def pre_batch_update_ingress_rules( + self, + request: appengine.BatchUpdateIngressRulesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.BatchUpdateIngressRulesRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for batch_update_ingress_rules + + Override in a subclass to manipulate the request or metadata + before they are sent to the Firewall server. + """ + return request, metadata + + def post_batch_update_ingress_rules( + self, response: appengine.BatchUpdateIngressRulesResponse + ) -> appengine.BatchUpdateIngressRulesResponse: + """Post-rpc interceptor for batch_update_ingress_rules + + Override in a subclass to manipulate the response + after it is returned by the Firewall server but before + it is returned to user code. + """ + return response + + def pre_create_ingress_rule( + self, + request: appengine.CreateIngressRuleRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.CreateIngressRuleRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for create_ingress_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the Firewall server. + """ + return request, metadata + + def post_create_ingress_rule( + self, response: firewall.FirewallRule + ) -> firewall.FirewallRule: + """Post-rpc interceptor for create_ingress_rule + + Override in a subclass to manipulate the response + after it is returned by the Firewall server but before + it is returned to user code. + """ + return response + + def pre_delete_ingress_rule( + self, + request: appengine.DeleteIngressRuleRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.DeleteIngressRuleRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete_ingress_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the Firewall server. + """ + return request, metadata + + def pre_get_ingress_rule( + self, + request: appengine.GetIngressRuleRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.GetIngressRuleRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_ingress_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the Firewall server. + """ + return request, metadata + + def post_get_ingress_rule( + self, response: firewall.FirewallRule + ) -> firewall.FirewallRule: + """Post-rpc interceptor for get_ingress_rule + + Override in a subclass to manipulate the response + after it is returned by the Firewall server but before + it is returned to user code. + """ + return response + + def pre_list_ingress_rules( + self, + request: appengine.ListIngressRulesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.ListIngressRulesRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_ingress_rules + + Override in a subclass to manipulate the request or metadata + before they are sent to the Firewall server. + """ + return request, metadata + + def post_list_ingress_rules( + self, response: appengine.ListIngressRulesResponse + ) -> appengine.ListIngressRulesResponse: + """Post-rpc interceptor for list_ingress_rules + + Override in a subclass to manipulate the response + after it is returned by the Firewall server but before + it is returned to user code. + """ + return response + + def pre_update_ingress_rule( + self, + request: appengine.UpdateIngressRuleRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.UpdateIngressRuleRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_ingress_rule + + Override in a subclass to manipulate the request or metadata + before they are sent to the Firewall server. + """ + return request, metadata + + def post_update_ingress_rule( + self, response: firewall.FirewallRule + ) -> firewall.FirewallRule: + """Post-rpc interceptor for update_ingress_rule + + Override in a subclass to manipulate the response + after it is returned by the Firewall server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class FirewallRestStub: + _session: AuthorizedSession + _host: str + _interceptor: FirewallRestInterceptor + + +class FirewallRestTransport(FirewallTransport): + """REST backend transport for Firewall. + + Firewall resources are used to define a collection of access + control rules for an Application. Each rule is defined with a + position which specifies the rule's order in the sequence of + rules, an IP range to be matched against requests, and an action + to take upon matching requests. + Every request is evaluated against the Firewall rules in + priority order. Processesing stops at the first rule which + matches the request's IP address. A final rule always specifies + an action that applies to all remaining IP addresses. The + default final rule for a newly-created application will be set + to "allow" if not otherwise specified by the user. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[FirewallRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or FirewallRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _BatchUpdateIngressRules(FirewallRestStub): + def __hash__(self): + return hash("BatchUpdateIngressRules") + + def __call__( + self, + request: appengine.BatchUpdateIngressRulesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.BatchUpdateIngressRulesResponse: + r"""Call the batch update ingress + rules method over HTTP. + + Args: + request (~.appengine.BatchUpdateIngressRulesRequest): + The request object. Request message for + ``Firewall.BatchUpdateIngressRules``. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.BatchUpdateIngressRulesResponse: + Response message for ``Firewall.UpdateAllIngressRules``. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{name=apps/*/firewall/ingressRules}:batchUpdate", + "body": "*", + }, + ] + request, metadata = self._interceptor.pre_batch_update_ingress_rules( + request, metadata + ) + pb_request = appengine.BatchUpdateIngressRulesRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.BatchUpdateIngressRulesResponse() + pb_resp = appengine.BatchUpdateIngressRulesResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_update_ingress_rules(resp) + return resp + + class _CreateIngressRule(FirewallRestStub): + def __hash__(self): + return hash("CreateIngressRule") + + def __call__( + self, + request: appengine.CreateIngressRuleRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> firewall.FirewallRule: + r"""Call the create ingress rule method over HTTP. + + Args: + request (~.appengine.CreateIngressRuleRequest): + The request object. Request message for ``Firewall.CreateIngressRule``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.firewall.FirewallRule: + A single firewall rule that is + evaluated against incoming traffic and + provides an action to take on matched + requests. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{parent=apps/*}/firewall/ingressRules", + "body": "rule", + }, + ] + request, metadata = self._interceptor.pre_create_ingress_rule( + request, metadata + ) + pb_request = appengine.CreateIngressRuleRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = firewall.FirewallRule() + pb_resp = firewall.FirewallRule.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_ingress_rule(resp) + return resp + + class _DeleteIngressRule(FirewallRestStub): + def __hash__(self): + return hash("DeleteIngressRule") + + def __call__( + self, + request: appengine.DeleteIngressRuleRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ): + r"""Call the delete ingress rule method over HTTP. + + Args: + request (~.appengine.DeleteIngressRuleRequest): + The request object. Request message for ``Firewall.DeleteIngressRule``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1/{name=apps/*/firewall/ingressRules/*}", + }, + ] + request, metadata = self._interceptor.pre_delete_ingress_rule( + request, metadata + ) + pb_request = appengine.DeleteIngressRuleRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + class _GetIngressRule(FirewallRestStub): + def __hash__(self): + return hash("GetIngressRule") + + def __call__( + self, + request: appengine.GetIngressRuleRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> firewall.FirewallRule: + r"""Call the get ingress rule method over HTTP. + + Args: + request (~.appengine.GetIngressRuleRequest): + The request object. Request message for ``Firewall.GetIngressRule``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.firewall.FirewallRule: + A single firewall rule that is + evaluated against incoming traffic and + provides an action to take on matched + requests. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=apps/*/firewall/ingressRules/*}", + }, + ] + request, metadata = self._interceptor.pre_get_ingress_rule( + request, metadata + ) + pb_request = appengine.GetIngressRuleRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = firewall.FirewallRule() + pb_resp = firewall.FirewallRule.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_ingress_rule(resp) + return resp + + class _ListIngressRules(FirewallRestStub): + def __hash__(self): + return hash("ListIngressRules") + + def __call__( + self, + request: appengine.ListIngressRulesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.ListIngressRulesResponse: + r"""Call the list ingress rules method over HTTP. + + Args: + request (~.appengine.ListIngressRulesRequest): + The request object. Request message for ``Firewall.ListIngressRules``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.ListIngressRulesResponse: + Response message for ``Firewall.ListIngressRules``. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=apps/*}/firewall/ingressRules", + }, + ] + request, metadata = self._interceptor.pre_list_ingress_rules( + request, metadata + ) + pb_request = appengine.ListIngressRulesRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.ListIngressRulesResponse() + pb_resp = appengine.ListIngressRulesResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_ingress_rules(resp) + return resp + + class _UpdateIngressRule(FirewallRestStub): + def __hash__(self): + return hash("UpdateIngressRule") + + def __call__( + self, + request: appengine.UpdateIngressRuleRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> firewall.FirewallRule: + r"""Call the update ingress rule method over HTTP. + + Args: + request (~.appengine.UpdateIngressRuleRequest): + The request object. Request message for ``Firewall.UpdateIngressRule``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.firewall.FirewallRule: + A single firewall rule that is + evaluated against incoming traffic and + provides an action to take on matched + requests. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1/{name=apps/*/firewall/ingressRules/*}", + "body": "rule", + }, + ] + request, metadata = self._interceptor.pre_update_ingress_rule( + request, metadata + ) + pb_request = appengine.UpdateIngressRuleRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = firewall.FirewallRule() + pb_resp = firewall.FirewallRule.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_ingress_rule(resp) + return resp + + @property + def batch_update_ingress_rules( + self, + ) -> Callable[ + [appengine.BatchUpdateIngressRulesRequest], + appengine.BatchUpdateIngressRulesResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._BatchUpdateIngressRules(self._session, self._host, self._interceptor) # type: ignore + + @property + def create_ingress_rule( + self, + ) -> Callable[[appengine.CreateIngressRuleRequest], firewall.FirewallRule]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateIngressRule(self._session, self._host, self._interceptor) # type: ignore + + @property + def delete_ingress_rule( + self, + ) -> Callable[[appengine.DeleteIngressRuleRequest], empty_pb2.Empty]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteIngressRule(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_ingress_rule( + self, + ) -> Callable[[appengine.GetIngressRuleRequest], firewall.FirewallRule]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetIngressRule(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_ingress_rules( + self, + ) -> Callable[ + [appengine.ListIngressRulesRequest], appengine.ListIngressRulesResponse + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListIngressRules(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_ingress_rule( + self, + ) -> Callable[[appengine.UpdateIngressRuleRequest], firewall.FirewallRule]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateIngressRule(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("FirewallRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index ff8afbb..7cc1120 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -58,6 +58,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, InstancesTransport from .transports.grpc import InstancesGrpcTransport from .transports.grpc_asyncio import InstancesGrpcAsyncIOTransport +from .transports.rest import InstancesRestTransport class InstancesClientMeta(type): @@ -71,6 +72,7 @@ class InstancesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[InstancesTransport]] _transport_registry["grpc"] = InstancesGrpcTransport _transport_registry["grpc_asyncio"] = InstancesGrpcAsyncIOTransport + _transport_registry["rest"] = InstancesRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py b/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py index 5a5096b..eb0bbd8 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py @@ -19,14 +19,18 @@ from .base import InstancesTransport from .grpc import InstancesGrpcTransport from .grpc_asyncio import InstancesGrpcAsyncIOTransport +from .rest import InstancesRestInterceptor, InstancesRestTransport # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[InstancesTransport]] _transport_registry["grpc"] = InstancesGrpcTransport _transport_registry["grpc_asyncio"] = InstancesGrpcAsyncIOTransport +_transport_registry["rest"] = InstancesRestTransport __all__ = ( "InstancesTransport", "InstancesGrpcTransport", "InstancesGrpcAsyncIOTransport", + "InstancesRestTransport", + "InstancesRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py new file mode 100644 index 0000000..6822b9c --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py @@ -0,0 +1,679 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import ( + gapic_v1, + operations_v1, + path_template, + rest_helpers, + rest_streaming, +) +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.longrunning import operations_pb2 # type: ignore + +from google.cloud.appengine_admin_v1.types import appengine, instance + +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO +from .base import InstancesTransport + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class InstancesRestInterceptor: + """Interceptor for Instances. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the InstancesRestTransport. + + .. code-block:: python + class MyCustomInstancesInterceptor(InstancesRestInterceptor): + def pre_debug_instance(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_debug_instance(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_delete_instance(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete_instance(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_instance(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_instance(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_instances(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_instances(self, response): + logging.log(f"Received response: {response}") + return response + + transport = InstancesRestTransport(interceptor=MyCustomInstancesInterceptor()) + client = InstancesClient(transport=transport) + + + """ + + def pre_debug_instance( + self, + request: appengine.DebugInstanceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.DebugInstanceRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for debug_instance + + Override in a subclass to manipulate the request or metadata + before they are sent to the Instances server. + """ + return request, metadata + + def post_debug_instance( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for debug_instance + + Override in a subclass to manipulate the response + after it is returned by the Instances server but before + it is returned to user code. + """ + return response + + def pre_delete_instance( + self, + request: appengine.DeleteInstanceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.DeleteInstanceRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete_instance + + Override in a subclass to manipulate the request or metadata + before they are sent to the Instances server. + """ + return request, metadata + + def post_delete_instance( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for delete_instance + + Override in a subclass to manipulate the response + after it is returned by the Instances server but before + it is returned to user code. + """ + return response + + def pre_get_instance( + self, request: appengine.GetInstanceRequest, metadata: Sequence[Tuple[str, str]] + ) -> Tuple[appengine.GetInstanceRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_instance + + Override in a subclass to manipulate the request or metadata + before they are sent to the Instances server. + """ + return request, metadata + + def post_get_instance(self, response: instance.Instance) -> instance.Instance: + """Post-rpc interceptor for get_instance + + Override in a subclass to manipulate the response + after it is returned by the Instances server but before + it is returned to user code. + """ + return response + + def pre_list_instances( + self, + request: appengine.ListInstancesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.ListInstancesRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_instances + + Override in a subclass to manipulate the request or metadata + before they are sent to the Instances server. + """ + return request, metadata + + def post_list_instances( + self, response: appengine.ListInstancesResponse + ) -> appengine.ListInstancesResponse: + """Post-rpc interceptor for list_instances + + Override in a subclass to manipulate the response + after it is returned by the Instances server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class InstancesRestStub: + _session: AuthorizedSession + _host: str + _interceptor: InstancesRestInterceptor + + +class InstancesRestTransport(InstancesTransport): + """REST backend transport for Instances. + + Manages instances of a version. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[InstancesRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or InstancesRestInterceptor() + self._prep_wrapped_messages(client_info) + + @property + def operations_client(self) -> operations_v1.AbstractOperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Only create a new client if we do not already have one. + if self._operations_client is None: + http_options: Dict[str, List[Dict[str, str]]] = {} + + rest_transport = operations_v1.OperationsRestTransport( + host=self._host, + # use the credentials which are saved + credentials=self._credentials, + scopes=self._scopes, + http_options=http_options, + path_prefix="v1", + ) + + self._operations_client = operations_v1.AbstractOperationsClient( + transport=rest_transport + ) + + # Return the client from cache. + return self._operations_client + + class _DebugInstance(InstancesRestStub): + def __hash__(self): + return hash("DebugInstance") + + def __call__( + self, + request: appengine.DebugInstanceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the debug instance method over HTTP. + + Args: + request (~.appengine.DebugInstanceRequest): + The request object. Request message for ``Instances.DebugInstance``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{name=apps/*/services/*/versions/*/instances/*}:debug", + "body": "*", + }, + ] + request, metadata = self._interceptor.pre_debug_instance(request, metadata) + pb_request = appengine.DebugInstanceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_debug_instance(resp) + return resp + + class _DeleteInstance(InstancesRestStub): + def __hash__(self): + return hash("DeleteInstance") + + def __call__( + self, + request: appengine.DeleteInstanceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the delete instance method over HTTP. + + Args: + request (~.appengine.DeleteInstanceRequest): + The request object. Request message for ``Instances.DeleteInstance``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1/{name=apps/*/services/*/versions/*/instances/*}", + }, + ] + request, metadata = self._interceptor.pre_delete_instance(request, metadata) + pb_request = appengine.DeleteInstanceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_instance(resp) + return resp + + class _GetInstance(InstancesRestStub): + def __hash__(self): + return hash("GetInstance") + + def __call__( + self, + request: appengine.GetInstanceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> instance.Instance: + r"""Call the get instance method over HTTP. + + Args: + request (~.appengine.GetInstanceRequest): + The request object. Request message for ``Instances.GetInstance``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.instance.Instance: + An Instance resource is the computing + unit that App Engine uses to + automatically scale an application. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=apps/*/services/*/versions/*/instances/*}", + }, + ] + request, metadata = self._interceptor.pre_get_instance(request, metadata) + pb_request = appengine.GetInstanceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = instance.Instance() + pb_resp = instance.Instance.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_instance(resp) + return resp + + class _ListInstances(InstancesRestStub): + def __hash__(self): + return hash("ListInstances") + + def __call__( + self, + request: appengine.ListInstancesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.ListInstancesResponse: + r"""Call the list instances method over HTTP. + + Args: + request (~.appengine.ListInstancesRequest): + The request object. Request message for ``Instances.ListInstances``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.ListInstancesResponse: + Response message for ``Instances.ListInstances``. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=apps/*/services/*/versions/*}/instances", + }, + ] + request, metadata = self._interceptor.pre_list_instances(request, metadata) + pb_request = appengine.ListInstancesRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.ListInstancesResponse() + pb_resp = appengine.ListInstancesResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_instances(resp) + return resp + + @property + def debug_instance( + self, + ) -> Callable[[appengine.DebugInstanceRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DebugInstance(self._session, self._host, self._interceptor) # type: ignore + + @property + def delete_instance( + self, + ) -> Callable[[appengine.DeleteInstanceRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteInstance(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_instance( + self, + ) -> Callable[[appengine.GetInstanceRequest], instance.Instance]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetInstance(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_instances( + self, + ) -> Callable[[appengine.ListInstancesRequest], appengine.ListInstancesResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListInstances(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("InstancesRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index f1bb91a..24562ea 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -58,6 +58,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, ServicesTransport from .transports.grpc import ServicesGrpcTransport from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport +from .transports.rest import ServicesRestTransport class ServicesClientMeta(type): @@ -71,6 +72,7 @@ class ServicesClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[ServicesTransport]] _transport_registry["grpc"] = ServicesGrpcTransport _transport_registry["grpc_asyncio"] = ServicesGrpcAsyncIOTransport + _transport_registry["rest"] = ServicesRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py b/google/cloud/appengine_admin_v1/services/services/transports/__init__.py index f362184..94ca3b8 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/__init__.py @@ -19,14 +19,18 @@ from .base import ServicesTransport from .grpc import ServicesGrpcTransport from .grpc_asyncio import ServicesGrpcAsyncIOTransport +from .rest import ServicesRestInterceptor, ServicesRestTransport # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ServicesTransport]] _transport_registry["grpc"] = ServicesGrpcTransport _transport_registry["grpc_asyncio"] = ServicesGrpcAsyncIOTransport +_transport_registry["rest"] = ServicesRestTransport __all__ = ( "ServicesTransport", "ServicesGrpcTransport", "ServicesGrpcAsyncIOTransport", + "ServicesRestTransport", + "ServicesRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/services/transports/rest.py b/google/cloud/appengine_admin_v1/services/services/transports/rest.py new file mode 100644 index 0000000..e8d3814 --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/services/transports/rest.py @@ -0,0 +1,686 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import ( + gapic_v1, + operations_v1, + path_template, + rest_helpers, + rest_streaming, +) +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.longrunning import operations_pb2 # type: ignore + +from google.cloud.appengine_admin_v1.types import appengine, service + +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO +from .base import ServicesTransport + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class ServicesRestInterceptor: + """Interceptor for Services. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the ServicesRestTransport. + + .. code-block:: python + class MyCustomServicesInterceptor(ServicesRestInterceptor): + def pre_delete_service(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete_service(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_service(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_service(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_services(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_services(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_service(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_service(self, response): + logging.log(f"Received response: {response}") + return response + + transport = ServicesRestTransport(interceptor=MyCustomServicesInterceptor()) + client = ServicesClient(transport=transport) + + + """ + + def pre_delete_service( + self, + request: appengine.DeleteServiceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.DeleteServiceRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete_service + + Override in a subclass to manipulate the request or metadata + before they are sent to the Services server. + """ + return request, metadata + + def post_delete_service( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for delete_service + + Override in a subclass to manipulate the response + after it is returned by the Services server but before + it is returned to user code. + """ + return response + + def pre_get_service( + self, request: appengine.GetServiceRequest, metadata: Sequence[Tuple[str, str]] + ) -> Tuple[appengine.GetServiceRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_service + + Override in a subclass to manipulate the request or metadata + before they are sent to the Services server. + """ + return request, metadata + + def post_get_service(self, response: service.Service) -> service.Service: + """Post-rpc interceptor for get_service + + Override in a subclass to manipulate the response + after it is returned by the Services server but before + it is returned to user code. + """ + return response + + def pre_list_services( + self, + request: appengine.ListServicesRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.ListServicesRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_services + + Override in a subclass to manipulate the request or metadata + before they are sent to the Services server. + """ + return request, metadata + + def post_list_services( + self, response: appengine.ListServicesResponse + ) -> appengine.ListServicesResponse: + """Post-rpc interceptor for list_services + + Override in a subclass to manipulate the response + after it is returned by the Services server but before + it is returned to user code. + """ + return response + + def pre_update_service( + self, + request: appengine.UpdateServiceRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.UpdateServiceRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_service + + Override in a subclass to manipulate the request or metadata + before they are sent to the Services server. + """ + return request, metadata + + def post_update_service( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for update_service + + Override in a subclass to manipulate the response + after it is returned by the Services server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class ServicesRestStub: + _session: AuthorizedSession + _host: str + _interceptor: ServicesRestInterceptor + + +class ServicesRestTransport(ServicesTransport): + """REST backend transport for Services. + + Manages services of an application. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[ServicesRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or ServicesRestInterceptor() + self._prep_wrapped_messages(client_info) + + @property + def operations_client(self) -> operations_v1.AbstractOperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Only create a new client if we do not already have one. + if self._operations_client is None: + http_options: Dict[str, List[Dict[str, str]]] = {} + + rest_transport = operations_v1.OperationsRestTransport( + host=self._host, + # use the credentials which are saved + credentials=self._credentials, + scopes=self._scopes, + http_options=http_options, + path_prefix="v1", + ) + + self._operations_client = operations_v1.AbstractOperationsClient( + transport=rest_transport + ) + + # Return the client from cache. + return self._operations_client + + class _DeleteService(ServicesRestStub): + def __hash__(self): + return hash("DeleteService") + + def __call__( + self, + request: appengine.DeleteServiceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the delete service method over HTTP. + + Args: + request (~.appengine.DeleteServiceRequest): + The request object. Request message for ``Services.DeleteService``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1/{name=apps/*/services/*}", + }, + ] + request, metadata = self._interceptor.pre_delete_service(request, metadata) + pb_request = appengine.DeleteServiceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_service(resp) + return resp + + class _GetService(ServicesRestStub): + def __hash__(self): + return hash("GetService") + + def __call__( + self, + request: appengine.GetServiceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.Service: + r"""Call the get service method over HTTP. + + Args: + request (~.appengine.GetServiceRequest): + The request object. Request message for ``Services.GetService``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.service.Service: + A Service resource is a logical + component of an application that can + share state and communicate in a secure + fashion with other services. For + example, an application that handles + customer requests might include separate + services to handle tasks such as backend + data analysis or API requests from + mobile devices. Each service has a + collection of versions that define a + specific set of code used to implement + the functionality of that service. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=apps/*/services/*}", + }, + ] + request, metadata = self._interceptor.pre_get_service(request, metadata) + pb_request = appengine.GetServiceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = service.Service() + pb_resp = service.Service.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_service(resp) + return resp + + class _ListServices(ServicesRestStub): + def __hash__(self): + return hash("ListServices") + + def __call__( + self, + request: appengine.ListServicesRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.ListServicesResponse: + r"""Call the list services method over HTTP. + + Args: + request (~.appengine.ListServicesRequest): + The request object. Request message for ``Services.ListServices``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.ListServicesResponse: + Response message for ``Services.ListServices``. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=apps/*}/services", + }, + ] + request, metadata = self._interceptor.pre_list_services(request, metadata) + pb_request = appengine.ListServicesRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.ListServicesResponse() + pb_resp = appengine.ListServicesResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_services(resp) + return resp + + class _UpdateService(ServicesRestStub): + def __hash__(self): + return hash("UpdateService") + + def __call__( + self, + request: appengine.UpdateServiceRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the update service method over HTTP. + + Args: + request (~.appengine.UpdateServiceRequest): + The request object. Request message for ``Services.UpdateService``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1/{name=apps/*/services/*}", + "body": "service", + }, + ] + request, metadata = self._interceptor.pre_update_service(request, metadata) + pb_request = appengine.UpdateServiceRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_service(resp) + return resp + + @property + def delete_service( + self, + ) -> Callable[[appengine.DeleteServiceRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteService(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_service(self) -> Callable[[appengine.GetServiceRequest], service.Service]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetService(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_services( + self, + ) -> Callable[[appengine.ListServicesRequest], appengine.ListServicesResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListServices(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_service( + self, + ) -> Callable[[appengine.UpdateServiceRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateService(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("ServicesRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index f4280cd..48d71ea 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -60,6 +60,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, VersionsTransport from .transports.grpc import VersionsGrpcTransport from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport +from .transports.rest import VersionsRestTransport class VersionsClientMeta(type): @@ -73,6 +74,7 @@ class VersionsClientMeta(type): _transport_registry = OrderedDict() # type: Dict[str, Type[VersionsTransport]] _transport_registry["grpc"] = VersionsGrpcTransport _transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport + _transport_registry["rest"] = VersionsRestTransport def get_transport_class( cls, diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py b/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py index e31c216..e921ca1 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py @@ -19,14 +19,18 @@ from .base import VersionsTransport from .grpc import VersionsGrpcTransport from .grpc_asyncio import VersionsGrpcAsyncIOTransport +from .rest import VersionsRestInterceptor, VersionsRestTransport # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[VersionsTransport]] _transport_registry["grpc"] = VersionsGrpcTransport _transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport +_transport_registry["rest"] = VersionsRestTransport __all__ = ( "VersionsTransport", "VersionsGrpcTransport", "VersionsGrpcAsyncIOTransport", + "VersionsRestTransport", + "VersionsRestInterceptor", ) diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py new file mode 100644 index 0000000..fd62126 --- /dev/null +++ b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py @@ -0,0 +1,801 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import ( + gapic_v1, + operations_v1, + path_template, + rest_helpers, + rest_streaming, +) +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.longrunning import operations_pb2 # type: ignore + +from google.cloud.appengine_admin_v1.types import appengine, version + +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO +from .base import VersionsTransport + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class VersionsRestInterceptor: + """Interceptor for Versions. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the VersionsRestTransport. + + .. code-block:: python + class MyCustomVersionsInterceptor(VersionsRestInterceptor): + def pre_create_version(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_version(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_delete_version(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_delete_version(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_get_version(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_version(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_versions(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_versions(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_version(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_version(self, response): + logging.log(f"Received response: {response}") + return response + + transport = VersionsRestTransport(interceptor=MyCustomVersionsInterceptor()) + client = VersionsClient(transport=transport) + + + """ + + def pre_create_version( + self, + request: appengine.CreateVersionRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.CreateVersionRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for create_version + + Override in a subclass to manipulate the request or metadata + before they are sent to the Versions server. + """ + return request, metadata + + def post_create_version( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for create_version + + Override in a subclass to manipulate the response + after it is returned by the Versions server but before + it is returned to user code. + """ + return response + + def pre_delete_version( + self, + request: appengine.DeleteVersionRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.DeleteVersionRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for delete_version + + Override in a subclass to manipulate the request or metadata + before they are sent to the Versions server. + """ + return request, metadata + + def post_delete_version( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for delete_version + + Override in a subclass to manipulate the response + after it is returned by the Versions server but before + it is returned to user code. + """ + return response + + def pre_get_version( + self, request: appengine.GetVersionRequest, metadata: Sequence[Tuple[str, str]] + ) -> Tuple[appengine.GetVersionRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_version + + Override in a subclass to manipulate the request or metadata + before they are sent to the Versions server. + """ + return request, metadata + + def post_get_version(self, response: version.Version) -> version.Version: + """Post-rpc interceptor for get_version + + Override in a subclass to manipulate the response + after it is returned by the Versions server but before + it is returned to user code. + """ + return response + + def pre_list_versions( + self, + request: appengine.ListVersionsRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.ListVersionsRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_versions + + Override in a subclass to manipulate the request or metadata + before they are sent to the Versions server. + """ + return request, metadata + + def post_list_versions( + self, response: appengine.ListVersionsResponse + ) -> appengine.ListVersionsResponse: + """Post-rpc interceptor for list_versions + + Override in a subclass to manipulate the response + after it is returned by the Versions server but before + it is returned to user code. + """ + return response + + def pre_update_version( + self, + request: appengine.UpdateVersionRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[appengine.UpdateVersionRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_version + + Override in a subclass to manipulate the request or metadata + before they are sent to the Versions server. + """ + return request, metadata + + def post_update_version( + self, response: operations_pb2.Operation + ) -> operations_pb2.Operation: + """Post-rpc interceptor for update_version + + Override in a subclass to manipulate the response + after it is returned by the Versions server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class VersionsRestStub: + _session: AuthorizedSession + _host: str + _interceptor: VersionsRestInterceptor + + +class VersionsRestTransport(VersionsTransport): + """REST backend transport for Versions. + + Manages versions of a service. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "appengine.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[VersionsRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` 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 are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or VersionsRestInterceptor() + self._prep_wrapped_messages(client_info) + + @property + def operations_client(self) -> operations_v1.AbstractOperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Only create a new client if we do not already have one. + if self._operations_client is None: + http_options: Dict[str, List[Dict[str, str]]] = {} + + rest_transport = operations_v1.OperationsRestTransport( + host=self._host, + # use the credentials which are saved + credentials=self._credentials, + scopes=self._scopes, + http_options=http_options, + path_prefix="v1", + ) + + self._operations_client = operations_v1.AbstractOperationsClient( + transport=rest_transport + ) + + # Return the client from cache. + return self._operations_client + + class _CreateVersion(VersionsRestStub): + def __hash__(self): + return hash("CreateVersion") + + def __call__( + self, + request: appengine.CreateVersionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the create version method over HTTP. + + Args: + request (~.appengine.CreateVersionRequest): + The request object. Request message for ``Versions.CreateVersion``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1/{parent=apps/*/services/*}/versions", + "body": "version", + }, + ] + request, metadata = self._interceptor.pre_create_version(request, metadata) + pb_request = appengine.CreateVersionRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_version(resp) + return resp + + class _DeleteVersion(VersionsRestStub): + def __hash__(self): + return hash("DeleteVersion") + + def __call__( + self, + request: appengine.DeleteVersionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the delete version method over HTTP. + + Args: + request (~.appengine.DeleteVersionRequest): + The request object. Request message for ``Versions.DeleteVersion``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1/{name=apps/*/services/*/versions/*}", + }, + ] + request, metadata = self._interceptor.pre_delete_version(request, metadata) + pb_request = appengine.DeleteVersionRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_version(resp) + return resp + + class _GetVersion(VersionsRestStub): + def __hash__(self): + return hash("GetVersion") + + def __call__( + self, + request: appengine.GetVersionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> version.Version: + r"""Call the get version method over HTTP. + + Args: + request (~.appengine.GetVersionRequest): + The request object. Request message for ``Versions.GetVersion``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.version.Version: + A Version resource is a specific set + of source code and configuration files + that are deployed into a service. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=apps/*/services/*/versions/*}", + }, + ] + request, metadata = self._interceptor.pre_get_version(request, metadata) + pb_request = appengine.GetVersionRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = version.Version() + pb_resp = version.Version.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_version(resp) + return resp + + class _ListVersions(VersionsRestStub): + def __hash__(self): + return hash("ListVersions") + + def __call__( + self, + request: appengine.ListVersionsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> appengine.ListVersionsResponse: + r"""Call the list versions method over HTTP. + + Args: + request (~.appengine.ListVersionsRequest): + The request object. Request message for ``Versions.ListVersions``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.appengine.ListVersionsResponse: + Response message for ``Versions.ListVersions``. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=apps/*/services/*}/versions", + }, + ] + request, metadata = self._interceptor.pre_list_versions(request, metadata) + pb_request = appengine.ListVersionsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = appengine.ListVersionsResponse() + pb_resp = appengine.ListVersionsResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_versions(resp) + return resp + + class _UpdateVersion(VersionsRestStub): + def __hash__(self): + return hash("UpdateVersion") + + def __call__( + self, + request: appengine.UpdateVersionRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Call the update version method over HTTP. + + Args: + request (~.appengine.UpdateVersionRequest): + The request object. Request message for ``Versions.UpdateVersion``. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operations_pb2.Operation: + This resource represents a + long-running operation that is the + result of a network API call. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1/{name=apps/*/services/*/versions/*}", + "body": "version", + }, + ] + request, metadata = self._interceptor.pre_update_version(request, metadata) + pb_request = appengine.UpdateVersionRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = operations_pb2.Operation() + json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_version(resp) + return resp + + @property + def create_version( + self, + ) -> Callable[[appengine.CreateVersionRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateVersion(self._session, self._host, self._interceptor) # type: ignore + + @property + def delete_version( + self, + ) -> Callable[[appengine.DeleteVersionRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteVersion(self._session, self._host, self._interceptor) # type: ignore + + @property + def get_version(self) -> Callable[[appengine.GetVersionRequest], version.Version]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetVersion(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_versions( + self, + ) -> Callable[[appengine.ListVersionsRequest], appengine.ListVersionsResponse]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListVersions(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_version( + self, + ) -> Callable[[appengine.UpdateVersionRequest], operations_pb2.Operation]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateVersion(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("VersionsRestTransport",) diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index cdb6687..7fb2233 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import ( @@ -43,11 +45,14 @@ from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import json_format import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.applications import ( ApplicationsAsyncClient, @@ -104,6 +109,7 @@ def test__get_default_mtls_endpoint(): [ (ApplicationsClient, "grpc"), (ApplicationsAsyncClient, "grpc_asyncio"), + (ApplicationsClient, "rest"), ], ) def test_applications_client_from_service_account_info(client_class, transport_name): @@ -117,7 +123,11 @@ def test_applications_client_from_service_account_info(client_class, transport_n assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -125,6 +135,7 @@ def test_applications_client_from_service_account_info(client_class, transport_n [ (transports.ApplicationsGrpcTransport, "grpc"), (transports.ApplicationsGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.ApplicationsRestTransport, "rest"), ], ) def test_applications_client_service_account_always_use_jwt( @@ -150,6 +161,7 @@ def test_applications_client_service_account_always_use_jwt( [ (ApplicationsClient, "grpc"), (ApplicationsAsyncClient, "grpc_asyncio"), + (ApplicationsClient, "rest"), ], ) def test_applications_client_from_service_account_file(client_class, transport_name): @@ -170,13 +182,18 @@ def test_applications_client_from_service_account_file(client_class, transport_n assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_applications_client_get_transport_class(): transport = ApplicationsClient.get_transport_class() available_transports = [ transports.ApplicationsGrpcTransport, + transports.ApplicationsRestTransport, ] assert transport in available_transports @@ -193,6 +210,7 @@ def test_applications_client_get_transport_class(): transports.ApplicationsGrpcAsyncIOTransport, "grpc_asyncio", ), + (ApplicationsClient, transports.ApplicationsRestTransport, "rest"), ], ) @mock.patch.object( @@ -336,6 +354,8 @@ def test_applications_client_client_options( "grpc_asyncio", "false", ), + (ApplicationsClient, transports.ApplicationsRestTransport, "rest", "true"), + (ApplicationsClient, transports.ApplicationsRestTransport, "rest", "false"), ], ) @mock.patch.object( @@ -529,6 +549,7 @@ def test_applications_client_get_mtls_endpoint_and_cert_source(client_class): transports.ApplicationsGrpcAsyncIOTransport, "grpc_asyncio", ), + (ApplicationsClient, transports.ApplicationsRestTransport, "rest"), ], ) def test_applications_client_client_options_scopes( @@ -569,6 +590,7 @@ def test_applications_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + (ApplicationsClient, transports.ApplicationsRestTransport, "rest", None), ], ) def test_applications_client_client_options_credentials_file( @@ -1356,6 +1378,688 @@ async def test_repair_application_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetApplicationRequest, + dict, + ], +) +def test_get_application_rest(request_type): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = application.Application( + name="name_value", + id="id_value", + auth_domain="auth_domain_value", + location_id="location_id_value", + code_bucket="code_bucket_value", + serving_status=application.Application.ServingStatus.SERVING, + default_hostname="default_hostname_value", + default_bucket="default_bucket_value", + service_account="service_account_value", + gcr_domain="gcr_domain_value", + database_type=application.Application.DatabaseType.CLOUD_DATASTORE, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = application.Application.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_application(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, application.Application) + assert response.name == "name_value" + assert response.id == "id_value" + assert response.auth_domain == "auth_domain_value" + assert response.location_id == "location_id_value" + assert response.code_bucket == "code_bucket_value" + assert response.serving_status == application.Application.ServingStatus.SERVING + assert response.default_hostname == "default_hostname_value" + assert response.default_bucket == "default_bucket_value" + assert response.service_account == "service_account_value" + assert response.gcr_domain == "gcr_domain_value" + assert ( + response.database_type == application.Application.DatabaseType.CLOUD_DATASTORE + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_application_rest_interceptors(null_interceptor): + transport = transports.ApplicationsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.ApplicationsRestInterceptor(), + ) + client = ApplicationsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ApplicationsRestInterceptor, "post_get_application" + ) as post, mock.patch.object( + transports.ApplicationsRestInterceptor, "pre_get_application" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.GetApplicationRequest.pb( + appengine.GetApplicationRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = application.Application.to_json( + application.Application() + ) + + request = appengine.GetApplicationRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = application.Application() + + client.get_application( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_application_rest_bad_request( + transport: str = "rest", request_type=appengine.GetApplicationRequest +): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_application(request) + + +def test_get_application_rest_flattened(): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = application.Application() + + # get arguments that satisfy an http rule for this method + sample_request = {"name": "apps/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = application.Application.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_application(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1/{name=apps/*}" % client.transport._host, args[1] + ) + + +def test_get_application_rest_flattened_error(transport: str = "rest"): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_application( + appengine.GetApplicationRequest(), + name="name_value", + ) + + +def test_get_application_rest_error(): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateApplicationRequest, + dict, + ], +) +def test_create_application_rest(request_type): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {} + request_init["application"] = { + "name": "name_value", + "id": "id_value", + "dispatch_rules": [ + {"domain": "domain_value", "path": "path_value", "service": "service_value"} + ], + "auth_domain": "auth_domain_value", + "location_id": "location_id_value", + "code_bucket": "code_bucket_value", + "default_cookie_expiration": {"seconds": 751, "nanos": 543}, + "serving_status": 1, + "default_hostname": "default_hostname_value", + "default_bucket": "default_bucket_value", + "service_account": "service_account_value", + "iap": { + "enabled": True, + "oauth2_client_id": "oauth2_client_id_value", + "oauth2_client_secret": "oauth2_client_secret_value", + "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", + }, + "gcr_domain": "gcr_domain_value", + "database_type": 1, + "feature_settings": { + "split_health_checks": True, + "use_container_optimized_os": True, + }, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.create_application(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_application_rest_interceptors(null_interceptor): + transport = transports.ApplicationsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.ApplicationsRestInterceptor(), + ) + client = ApplicationsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.ApplicationsRestInterceptor, "post_create_application" + ) as post, mock.patch.object( + transports.ApplicationsRestInterceptor, "pre_create_application" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.CreateApplicationRequest.pb( + appengine.CreateApplicationRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.CreateApplicationRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.create_application( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_application_rest_bad_request( + transport: str = "rest", request_type=appengine.CreateApplicationRequest +): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {} + request_init["application"] = { + "name": "name_value", + "id": "id_value", + "dispatch_rules": [ + {"domain": "domain_value", "path": "path_value", "service": "service_value"} + ], + "auth_domain": "auth_domain_value", + "location_id": "location_id_value", + "code_bucket": "code_bucket_value", + "default_cookie_expiration": {"seconds": 751, "nanos": 543}, + "serving_status": 1, + "default_hostname": "default_hostname_value", + "default_bucket": "default_bucket_value", + "service_account": "service_account_value", + "iap": { + "enabled": True, + "oauth2_client_id": "oauth2_client_id_value", + "oauth2_client_secret": "oauth2_client_secret_value", + "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", + }, + "gcr_domain": "gcr_domain_value", + "database_type": 1, + "feature_settings": { + "split_health_checks": True, + "use_container_optimized_os": True, + }, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.create_application(request) + + +def test_create_application_rest_error(): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateApplicationRequest, + dict, + ], +) +def test_update_application_rest(request_type): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1"} + request_init["application"] = { + "name": "name_value", + "id": "id_value", + "dispatch_rules": [ + {"domain": "domain_value", "path": "path_value", "service": "service_value"} + ], + "auth_domain": "auth_domain_value", + "location_id": "location_id_value", + "code_bucket": "code_bucket_value", + "default_cookie_expiration": {"seconds": 751, "nanos": 543}, + "serving_status": 1, + "default_hostname": "default_hostname_value", + "default_bucket": "default_bucket_value", + "service_account": "service_account_value", + "iap": { + "enabled": True, + "oauth2_client_id": "oauth2_client_id_value", + "oauth2_client_secret": "oauth2_client_secret_value", + "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", + }, + "gcr_domain": "gcr_domain_value", + "database_type": 1, + "feature_settings": { + "split_health_checks": True, + "use_container_optimized_os": True, + }, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_application(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_application_rest_interceptors(null_interceptor): + transport = transports.ApplicationsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.ApplicationsRestInterceptor(), + ) + client = ApplicationsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.ApplicationsRestInterceptor, "post_update_application" + ) as post, mock.patch.object( + transports.ApplicationsRestInterceptor, "pre_update_application" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.UpdateApplicationRequest.pb( + appengine.UpdateApplicationRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.UpdateApplicationRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.update_application( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_application_rest_bad_request( + transport: str = "rest", request_type=appengine.UpdateApplicationRequest +): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1"} + request_init["application"] = { + "name": "name_value", + "id": "id_value", + "dispatch_rules": [ + {"domain": "domain_value", "path": "path_value", "service": "service_value"} + ], + "auth_domain": "auth_domain_value", + "location_id": "location_id_value", + "code_bucket": "code_bucket_value", + "default_cookie_expiration": {"seconds": 751, "nanos": 543}, + "serving_status": 1, + "default_hostname": "default_hostname_value", + "default_bucket": "default_bucket_value", + "service_account": "service_account_value", + "iap": { + "enabled": True, + "oauth2_client_id": "oauth2_client_id_value", + "oauth2_client_secret": "oauth2_client_secret_value", + "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", + }, + "gcr_domain": "gcr_domain_value", + "database_type": 1, + "feature_settings": { + "split_health_checks": True, + "use_container_optimized_os": True, + }, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_application(request) + + +def test_update_application_rest_error(): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.RepairApplicationRequest, + dict, + ], +) +def test_repair_application_rest(request_type): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.repair_application(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_repair_application_rest_interceptors(null_interceptor): + transport = transports.ApplicationsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.ApplicationsRestInterceptor(), + ) + client = ApplicationsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.ApplicationsRestInterceptor, "post_repair_application" + ) as post, mock.patch.object( + transports.ApplicationsRestInterceptor, "pre_repair_application" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.RepairApplicationRequest.pb( + appengine.RepairApplicationRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.RepairApplicationRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.repair_application( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_repair_application_rest_bad_request( + transport: str = "rest", request_type=appengine.RepairApplicationRequest +): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.repair_application(request) + + +def test_repair_application_rest_error(): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ApplicationsGrpcTransport( @@ -1437,6 +2141,7 @@ def test_transport_get_channel(): [ transports.ApplicationsGrpcTransport, transports.ApplicationsGrpcAsyncIOTransport, + transports.ApplicationsRestTransport, ], ) def test_transport_adc(transport_class): @@ -1451,6 +2156,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -1600,6 +2306,7 @@ def test_applications_transport_auth_adc(transport_class): [ transports.ApplicationsGrpcTransport, transports.ApplicationsGrpcAsyncIOTransport, + transports.ApplicationsRestTransport, ], ) def test_applications_transport_auth_gdch_credentials(transport_class): @@ -1698,11 +2405,40 @@ def test_applications_grpc_transport_client_cert_source_for_mtls(transport_class ) +def test_applications_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.ApplicationsRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +def test_applications_rest_lro_client(): + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.AbstractOperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_applications_host_no_port(transport_name): @@ -1713,7 +2449,11 @@ def test_applications_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -1721,6 +2461,7 @@ def test_applications_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_applications_host_with_port(transport_name): @@ -1731,7 +2472,42 @@ def test_applications_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_applications_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = ApplicationsClient( + credentials=creds1, + transport=transport_name, + ) + client2 = ApplicationsClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.get_application._session + session2 = client2.transport.get_application._session + assert session1 != session2 + session1 = client1.transport.create_application._session + session2 = client2.transport.create_application._session + assert session1 != session2 + session1 = client1.transport.update_application._session + session2 = client2.transport.update_application._session + assert session1 != session2 + session1 = client1.transport.repair_application._session + session2 = client2.transport.repair_application._session + assert session1 != session2 def test_applications_grpc_transport_channel(): @@ -2028,6 +2804,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2045,6 +2822,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index 60d680e..e37feae 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template @@ -32,12 +34,15 @@ from google.auth.exceptions import MutualTLSChannelError from google.oauth2 import service_account from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import json_format from google.protobuf import timestamp_pb2 # type: ignore import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.authorized_certificates import ( AuthorizedCertificatesAsyncClient, @@ -98,6 +103,7 @@ def test__get_default_mtls_endpoint(): [ (AuthorizedCertificatesClient, "grpc"), (AuthorizedCertificatesAsyncClient, "grpc_asyncio"), + (AuthorizedCertificatesClient, "rest"), ], ) def test_authorized_certificates_client_from_service_account_info( @@ -113,7 +119,11 @@ def test_authorized_certificates_client_from_service_account_info( assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -121,6 +131,7 @@ def test_authorized_certificates_client_from_service_account_info( [ (transports.AuthorizedCertificatesGrpcTransport, "grpc"), (transports.AuthorizedCertificatesGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.AuthorizedCertificatesRestTransport, "rest"), ], ) def test_authorized_certificates_client_service_account_always_use_jwt( @@ -146,6 +157,7 @@ def test_authorized_certificates_client_service_account_always_use_jwt( [ (AuthorizedCertificatesClient, "grpc"), (AuthorizedCertificatesAsyncClient, "grpc_asyncio"), + (AuthorizedCertificatesClient, "rest"), ], ) def test_authorized_certificates_client_from_service_account_file( @@ -168,13 +180,18 @@ def test_authorized_certificates_client_from_service_account_file( assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_authorized_certificates_client_get_transport_class(): transport = AuthorizedCertificatesClient.get_transport_class() available_transports = [ transports.AuthorizedCertificatesGrpcTransport, + transports.AuthorizedCertificatesRestTransport, ] assert transport in available_transports @@ -195,6 +212,11 @@ def test_authorized_certificates_client_get_transport_class(): transports.AuthorizedCertificatesGrpcAsyncIOTransport, "grpc_asyncio", ), + ( + AuthorizedCertificatesClient, + transports.AuthorizedCertificatesRestTransport, + "rest", + ), ], ) @mock.patch.object( @@ -350,6 +372,18 @@ def test_authorized_certificates_client_client_options( "grpc_asyncio", "false", ), + ( + AuthorizedCertificatesClient, + transports.AuthorizedCertificatesRestTransport, + "rest", + "true", + ), + ( + AuthorizedCertificatesClient, + transports.AuthorizedCertificatesRestTransport, + "rest", + "false", + ), ], ) @mock.patch.object( @@ -553,6 +587,11 @@ def test_authorized_certificates_client_get_mtls_endpoint_and_cert_source(client transports.AuthorizedCertificatesGrpcAsyncIOTransport, "grpc_asyncio", ), + ( + AuthorizedCertificatesClient, + transports.AuthorizedCertificatesRestTransport, + "rest", + ), ], ) def test_authorized_certificates_client_client_options_scopes( @@ -593,6 +632,12 @@ def test_authorized_certificates_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + ( + AuthorizedCertificatesClient, + transports.AuthorizedCertificatesRestTransport, + "rest", + None, + ), ], ) def test_authorized_certificates_client_client_options_credentials_file( @@ -1760,6 +1805,790 @@ async def test_delete_authorized_certificate_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListAuthorizedCertificatesRequest, + dict, + ], +) +def test_list_authorized_certificates_rest(request_type): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.ListAuthorizedCertificatesResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.ListAuthorizedCertificatesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_authorized_certificates(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListAuthorizedCertificatesPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_authorized_certificates_rest_interceptors(null_interceptor): + transport = transports.AuthorizedCertificatesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AuthorizedCertificatesRestInterceptor(), + ) + client = AuthorizedCertificatesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "post_list_authorized_certificates", + ) as post, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "pre_list_authorized_certificates", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.ListAuthorizedCertificatesRequest.pb( + appengine.ListAuthorizedCertificatesRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = ( + appengine.ListAuthorizedCertificatesResponse.to_json( + appengine.ListAuthorizedCertificatesResponse() + ) + ) + + request = appengine.ListAuthorizedCertificatesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.ListAuthorizedCertificatesResponse() + + client.list_authorized_certificates( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_authorized_certificates_rest_bad_request( + transport: str = "rest", request_type=appengine.ListAuthorizedCertificatesRequest +): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_authorized_certificates(request) + + +def test_list_authorized_certificates_rest_pager(transport: str = "rest"): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + appengine.ListAuthorizedCertificatesResponse( + certificates=[ + certificate.AuthorizedCertificate(), + certificate.AuthorizedCertificate(), + certificate.AuthorizedCertificate(), + ], + next_page_token="abc", + ), + appengine.ListAuthorizedCertificatesResponse( + certificates=[], + next_page_token="def", + ), + appengine.ListAuthorizedCertificatesResponse( + certificates=[ + certificate.AuthorizedCertificate(), + ], + next_page_token="ghi", + ), + appengine.ListAuthorizedCertificatesResponse( + certificates=[ + certificate.AuthorizedCertificate(), + certificate.AuthorizedCertificate(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + appengine.ListAuthorizedCertificatesResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "apps/sample1"} + + pager = client.list_authorized_certificates(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, certificate.AuthorizedCertificate) for i in results) + + pages = list(client.list_authorized_certificates(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetAuthorizedCertificateRequest, + dict, + ], +) +def test_get_authorized_certificate_rest(request_type): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = certificate.AuthorizedCertificate( + name="name_value", + id="id_value", + display_name="display_name_value", + domain_names=["domain_names_value"], + visible_domain_mappings=["visible_domain_mappings_value"], + domain_mappings_count=2238, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = certificate.AuthorizedCertificate.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_authorized_certificate(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, certificate.AuthorizedCertificate) + assert response.name == "name_value" + assert response.id == "id_value" + assert response.display_name == "display_name_value" + assert response.domain_names == ["domain_names_value"] + assert response.visible_domain_mappings == ["visible_domain_mappings_value"] + assert response.domain_mappings_count == 2238 + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_authorized_certificate_rest_interceptors(null_interceptor): + transport = transports.AuthorizedCertificatesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AuthorizedCertificatesRestInterceptor(), + ) + client = AuthorizedCertificatesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "post_get_authorized_certificate", + ) as post, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "pre_get_authorized_certificate", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.GetAuthorizedCertificateRequest.pb( + appengine.GetAuthorizedCertificateRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = certificate.AuthorizedCertificate.to_json( + certificate.AuthorizedCertificate() + ) + + request = appengine.GetAuthorizedCertificateRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = certificate.AuthorizedCertificate() + + client.get_authorized_certificate( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_authorized_certificate_rest_bad_request( + transport: str = "rest", request_type=appengine.GetAuthorizedCertificateRequest +): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_authorized_certificate(request) + + +def test_get_authorized_certificate_rest_error(): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateAuthorizedCertificateRequest, + dict, + ], +) +def test_create_authorized_certificate_rest(request_type): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request_init["certificate"] = { + "name": "name_value", + "id": "id_value", + "display_name": "display_name_value", + "domain_names": ["domain_names_value1", "domain_names_value2"], + "expire_time": {"seconds": 751, "nanos": 543}, + "certificate_raw_data": { + "public_certificate": "public_certificate_value", + "private_key": "private_key_value", + }, + "managed_certificate": {"last_renewal_time": {}, "status": 1}, + "visible_domain_mappings": [ + "visible_domain_mappings_value1", + "visible_domain_mappings_value2", + ], + "domain_mappings_count": 2238, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = certificate.AuthorizedCertificate( + name="name_value", + id="id_value", + display_name="display_name_value", + domain_names=["domain_names_value"], + visible_domain_mappings=["visible_domain_mappings_value"], + domain_mappings_count=2238, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = certificate.AuthorizedCertificate.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.create_authorized_certificate(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, certificate.AuthorizedCertificate) + assert response.name == "name_value" + assert response.id == "id_value" + assert response.display_name == "display_name_value" + assert response.domain_names == ["domain_names_value"] + assert response.visible_domain_mappings == ["visible_domain_mappings_value"] + assert response.domain_mappings_count == 2238 + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_authorized_certificate_rest_interceptors(null_interceptor): + transport = transports.AuthorizedCertificatesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AuthorizedCertificatesRestInterceptor(), + ) + client = AuthorizedCertificatesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "post_create_authorized_certificate", + ) as post, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "pre_create_authorized_certificate", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.CreateAuthorizedCertificateRequest.pb( + appengine.CreateAuthorizedCertificateRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = certificate.AuthorizedCertificate.to_json( + certificate.AuthorizedCertificate() + ) + + request = appengine.CreateAuthorizedCertificateRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = certificate.AuthorizedCertificate() + + client.create_authorized_certificate( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_authorized_certificate_rest_bad_request( + transport: str = "rest", request_type=appengine.CreateAuthorizedCertificateRequest +): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request_init["certificate"] = { + "name": "name_value", + "id": "id_value", + "display_name": "display_name_value", + "domain_names": ["domain_names_value1", "domain_names_value2"], + "expire_time": {"seconds": 751, "nanos": 543}, + "certificate_raw_data": { + "public_certificate": "public_certificate_value", + "private_key": "private_key_value", + }, + "managed_certificate": {"last_renewal_time": {}, "status": 1}, + "visible_domain_mappings": [ + "visible_domain_mappings_value1", + "visible_domain_mappings_value2", + ], + "domain_mappings_count": 2238, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.create_authorized_certificate(request) + + +def test_create_authorized_certificate_rest_error(): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateAuthorizedCertificateRequest, + dict, + ], +) +def test_update_authorized_certificate_rest(request_type): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} + request_init["certificate"] = { + "name": "name_value", + "id": "id_value", + "display_name": "display_name_value", + "domain_names": ["domain_names_value1", "domain_names_value2"], + "expire_time": {"seconds": 751, "nanos": 543}, + "certificate_raw_data": { + "public_certificate": "public_certificate_value", + "private_key": "private_key_value", + }, + "managed_certificate": {"last_renewal_time": {}, "status": 1}, + "visible_domain_mappings": [ + "visible_domain_mappings_value1", + "visible_domain_mappings_value2", + ], + "domain_mappings_count": 2238, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = certificate.AuthorizedCertificate( + name="name_value", + id="id_value", + display_name="display_name_value", + domain_names=["domain_names_value"], + visible_domain_mappings=["visible_domain_mappings_value"], + domain_mappings_count=2238, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = certificate.AuthorizedCertificate.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_authorized_certificate(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, certificate.AuthorizedCertificate) + assert response.name == "name_value" + assert response.id == "id_value" + assert response.display_name == "display_name_value" + assert response.domain_names == ["domain_names_value"] + assert response.visible_domain_mappings == ["visible_domain_mappings_value"] + assert response.domain_mappings_count == 2238 + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_authorized_certificate_rest_interceptors(null_interceptor): + transport = transports.AuthorizedCertificatesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AuthorizedCertificatesRestInterceptor(), + ) + client = AuthorizedCertificatesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "post_update_authorized_certificate", + ) as post, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "pre_update_authorized_certificate", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.UpdateAuthorizedCertificateRequest.pb( + appengine.UpdateAuthorizedCertificateRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = certificate.AuthorizedCertificate.to_json( + certificate.AuthorizedCertificate() + ) + + request = appengine.UpdateAuthorizedCertificateRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = certificate.AuthorizedCertificate() + + client.update_authorized_certificate( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_authorized_certificate_rest_bad_request( + transport: str = "rest", request_type=appengine.UpdateAuthorizedCertificateRequest +): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} + request_init["certificate"] = { + "name": "name_value", + "id": "id_value", + "display_name": "display_name_value", + "domain_names": ["domain_names_value1", "domain_names_value2"], + "expire_time": {"seconds": 751, "nanos": 543}, + "certificate_raw_data": { + "public_certificate": "public_certificate_value", + "private_key": "private_key_value", + }, + "managed_certificate": {"last_renewal_time": {}, "status": 1}, + "visible_domain_mappings": [ + "visible_domain_mappings_value1", + "visible_domain_mappings_value2", + ], + "domain_mappings_count": 2238, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_authorized_certificate(request) + + +def test_update_authorized_certificate_rest_error(): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteAuthorizedCertificateRequest, + dict, + ], +) +def test_delete_authorized_certificate_rest(request_type): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = "" + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_authorized_certificate(request) + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_authorized_certificate_rest_interceptors(null_interceptor): + transport = transports.AuthorizedCertificatesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AuthorizedCertificatesRestInterceptor(), + ) + client = AuthorizedCertificatesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AuthorizedCertificatesRestInterceptor, + "pre_delete_authorized_certificate", + ) as pre: + pre.assert_not_called() + pb_message = appengine.DeleteAuthorizedCertificateRequest.pb( + appengine.DeleteAuthorizedCertificateRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + + request = appengine.DeleteAuthorizedCertificateRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + + client.delete_authorized_certificate( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + + +def test_delete_authorized_certificate_rest_bad_request( + transport: str = "rest", request_type=appengine.DeleteAuthorizedCertificateRequest +): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_authorized_certificate(request) + + +def test_delete_authorized_certificate_rest_error(): + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AuthorizedCertificatesGrpcTransport( @@ -1841,6 +2670,7 @@ def test_transport_get_channel(): [ transports.AuthorizedCertificatesGrpcTransport, transports.AuthorizedCertificatesGrpcAsyncIOTransport, + transports.AuthorizedCertificatesRestTransport, ], ) def test_transport_adc(transport_class): @@ -1855,6 +2685,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -2000,6 +2831,7 @@ def test_authorized_certificates_transport_auth_adc(transport_class): [ transports.AuthorizedCertificatesGrpcTransport, transports.AuthorizedCertificatesGrpcAsyncIOTransport, + transports.AuthorizedCertificatesRestTransport, ], ) def test_authorized_certificates_transport_auth_gdch_credentials(transport_class): @@ -2105,11 +2937,23 @@ def test_authorized_certificates_grpc_transport_client_cert_source_for_mtls( ) +def test_authorized_certificates_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.AuthorizedCertificatesRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_authorized_certificates_host_no_port(transport_name): @@ -2120,7 +2964,11 @@ def test_authorized_certificates_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -2128,6 +2976,7 @@ def test_authorized_certificates_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_authorized_certificates_host_with_port(transport_name): @@ -2138,7 +2987,45 @@ def test_authorized_certificates_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_authorized_certificates_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = AuthorizedCertificatesClient( + credentials=creds1, + transport=transport_name, + ) + client2 = AuthorizedCertificatesClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_authorized_certificates._session + session2 = client2.transport.list_authorized_certificates._session + assert session1 != session2 + session1 = client1.transport.get_authorized_certificate._session + session2 = client2.transport.get_authorized_certificate._session + assert session1 != session2 + session1 = client1.transport.create_authorized_certificate._session + session2 = client2.transport.create_authorized_certificate._session + assert session1 != session2 + session1 = client1.transport.update_authorized_certificate._session + session2 = client2.transport.update_authorized_certificate._session + assert session1 != session2 + session1 = client1.transport.delete_authorized_certificate._session + session2 = client2.transport.delete_authorized_certificate._session + assert session1 != session2 def test_authorized_certificates_grpc_transport_channel(): @@ -2409,6 +3296,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2426,6 +3314,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index faee289..b4b6f36 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template @@ -31,11 +33,14 @@ from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.oauth2 import service_account +from google.protobuf import json_format import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.authorized_domains import ( AuthorizedDomainsAsyncClient, @@ -96,6 +101,7 @@ def test__get_default_mtls_endpoint(): [ (AuthorizedDomainsClient, "grpc"), (AuthorizedDomainsAsyncClient, "grpc_asyncio"), + (AuthorizedDomainsClient, "rest"), ], ) def test_authorized_domains_client_from_service_account_info( @@ -111,7 +117,11 @@ def test_authorized_domains_client_from_service_account_info( assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -119,6 +129,7 @@ def test_authorized_domains_client_from_service_account_info( [ (transports.AuthorizedDomainsGrpcTransport, "grpc"), (transports.AuthorizedDomainsGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.AuthorizedDomainsRestTransport, "rest"), ], ) def test_authorized_domains_client_service_account_always_use_jwt( @@ -144,6 +155,7 @@ def test_authorized_domains_client_service_account_always_use_jwt( [ (AuthorizedDomainsClient, "grpc"), (AuthorizedDomainsAsyncClient, "grpc_asyncio"), + (AuthorizedDomainsClient, "rest"), ], ) def test_authorized_domains_client_from_service_account_file( @@ -166,13 +178,18 @@ def test_authorized_domains_client_from_service_account_file( assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_authorized_domains_client_get_transport_class(): transport = AuthorizedDomainsClient.get_transport_class() available_transports = [ transports.AuthorizedDomainsGrpcTransport, + transports.AuthorizedDomainsRestTransport, ] assert transport in available_transports @@ -189,6 +206,7 @@ def test_authorized_domains_client_get_transport_class(): transports.AuthorizedDomainsGrpcAsyncIOTransport, "grpc_asyncio", ), + (AuthorizedDomainsClient, transports.AuthorizedDomainsRestTransport, "rest"), ], ) @mock.patch.object( @@ -344,6 +362,18 @@ def test_authorized_domains_client_client_options( "grpc_asyncio", "false", ), + ( + AuthorizedDomainsClient, + transports.AuthorizedDomainsRestTransport, + "rest", + "true", + ), + ( + AuthorizedDomainsClient, + transports.AuthorizedDomainsRestTransport, + "rest", + "false", + ), ], ) @mock.patch.object( @@ -543,6 +573,7 @@ def test_authorized_domains_client_get_mtls_endpoint_and_cert_source(client_clas transports.AuthorizedDomainsGrpcAsyncIOTransport, "grpc_asyncio", ), + (AuthorizedDomainsClient, transports.AuthorizedDomainsRestTransport, "rest"), ], ) def test_authorized_domains_client_client_options_scopes( @@ -583,6 +614,12 @@ def test_authorized_domains_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + ( + AuthorizedDomainsClient, + transports.AuthorizedDomainsRestTransport, + "rest", + None, + ), ], ) def test_authorized_domains_client_client_options_credentials_file( @@ -1055,6 +1092,189 @@ async def test_list_authorized_domains_async_pages(): assert page_.raw_page.next_page_token == token +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListAuthorizedDomainsRequest, + dict, + ], +) +def test_list_authorized_domains_rest(request_type): + client = AuthorizedDomainsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.ListAuthorizedDomainsResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.ListAuthorizedDomainsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_authorized_domains(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListAuthorizedDomainsPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_authorized_domains_rest_interceptors(null_interceptor): + transport = transports.AuthorizedDomainsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AuthorizedDomainsRestInterceptor(), + ) + client = AuthorizedDomainsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AuthorizedDomainsRestInterceptor, "post_list_authorized_domains" + ) as post, mock.patch.object( + transports.AuthorizedDomainsRestInterceptor, "pre_list_authorized_domains" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.ListAuthorizedDomainsRequest.pb( + appengine.ListAuthorizedDomainsRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = appengine.ListAuthorizedDomainsResponse.to_json( + appengine.ListAuthorizedDomainsResponse() + ) + + request = appengine.ListAuthorizedDomainsRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.ListAuthorizedDomainsResponse() + + client.list_authorized_domains( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_authorized_domains_rest_bad_request( + transport: str = "rest", request_type=appengine.ListAuthorizedDomainsRequest +): + client = AuthorizedDomainsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_authorized_domains(request) + + +def test_list_authorized_domains_rest_pager(transport: str = "rest"): + client = AuthorizedDomainsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + appengine.ListAuthorizedDomainsResponse( + domains=[ + domain.AuthorizedDomain(), + domain.AuthorizedDomain(), + domain.AuthorizedDomain(), + ], + next_page_token="abc", + ), + appengine.ListAuthorizedDomainsResponse( + domains=[], + next_page_token="def", + ), + appengine.ListAuthorizedDomainsResponse( + domains=[ + domain.AuthorizedDomain(), + ], + next_page_token="ghi", + ), + appengine.ListAuthorizedDomainsResponse( + domains=[ + domain.AuthorizedDomain(), + domain.AuthorizedDomain(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + appengine.ListAuthorizedDomainsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "apps/sample1"} + + pager = client.list_authorized_domains(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, domain.AuthorizedDomain) for i in results) + + pages = list(client.list_authorized_domains(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AuthorizedDomainsGrpcTransport( @@ -1136,6 +1356,7 @@ def test_transport_get_channel(): [ transports.AuthorizedDomainsGrpcTransport, transports.AuthorizedDomainsGrpcAsyncIOTransport, + transports.AuthorizedDomainsRestTransport, ], ) def test_transport_adc(transport_class): @@ -1150,6 +1371,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -1289,6 +1511,7 @@ def test_authorized_domains_transport_auth_adc(transport_class): [ transports.AuthorizedDomainsGrpcTransport, transports.AuthorizedDomainsGrpcAsyncIOTransport, + transports.AuthorizedDomainsRestTransport, ], ) def test_authorized_domains_transport_auth_gdch_credentials(transport_class): @@ -1390,11 +1613,23 @@ def test_authorized_domains_grpc_transport_client_cert_source_for_mtls(transport ) +def test_authorized_domains_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.AuthorizedDomainsRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_authorized_domains_host_no_port(transport_name): @@ -1405,7 +1640,11 @@ def test_authorized_domains_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -1413,6 +1652,7 @@ def test_authorized_domains_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_authorized_domains_host_with_port(transport_name): @@ -1423,7 +1663,33 @@ def test_authorized_domains_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_authorized_domains_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = AuthorizedDomainsClient( + credentials=creds1, + transport=transport_name, + ) + client2 = AuthorizedDomainsClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_authorized_domains._session + session2 = client2.transport.list_authorized_domains._session + assert session1 != session2 def test_authorized_domains_grpc_transport_channel(): @@ -1694,6 +1960,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -1711,6 +1978,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index e7095b9..ce41f03 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import ( @@ -43,11 +45,14 @@ from google.oauth2 import service_account from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import json_format import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.domain_mappings import ( DomainMappingsAsyncClient, @@ -108,6 +113,7 @@ def test__get_default_mtls_endpoint(): [ (DomainMappingsClient, "grpc"), (DomainMappingsAsyncClient, "grpc_asyncio"), + (DomainMappingsClient, "rest"), ], ) def test_domain_mappings_client_from_service_account_info(client_class, transport_name): @@ -121,7 +127,11 @@ def test_domain_mappings_client_from_service_account_info(client_class, transpor assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -129,6 +139,7 @@ def test_domain_mappings_client_from_service_account_info(client_class, transpor [ (transports.DomainMappingsGrpcTransport, "grpc"), (transports.DomainMappingsGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.DomainMappingsRestTransport, "rest"), ], ) def test_domain_mappings_client_service_account_always_use_jwt( @@ -154,6 +165,7 @@ def test_domain_mappings_client_service_account_always_use_jwt( [ (DomainMappingsClient, "grpc"), (DomainMappingsAsyncClient, "grpc_asyncio"), + (DomainMappingsClient, "rest"), ], ) def test_domain_mappings_client_from_service_account_file(client_class, transport_name): @@ -174,13 +186,18 @@ def test_domain_mappings_client_from_service_account_file(client_class, transpor assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_domain_mappings_client_get_transport_class(): transport = DomainMappingsClient.get_transport_class() available_transports = [ transports.DomainMappingsGrpcTransport, + transports.DomainMappingsRestTransport, ] assert transport in available_transports @@ -197,6 +214,7 @@ def test_domain_mappings_client_get_transport_class(): transports.DomainMappingsGrpcAsyncIOTransport, "grpc_asyncio", ), + (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest"), ], ) @mock.patch.object( @@ -342,6 +360,8 @@ def test_domain_mappings_client_client_options( "grpc_asyncio", "false", ), + (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest", "true"), + (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest", "false"), ], ) @mock.patch.object( @@ -541,6 +561,7 @@ def test_domain_mappings_client_get_mtls_endpoint_and_cert_source(client_class): transports.DomainMappingsGrpcAsyncIOTransport, "grpc_asyncio", ), + (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest"), ], ) def test_domain_mappings_client_client_options_scopes( @@ -581,6 +602,7 @@ def test_domain_mappings_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest", None), ], ) def test_domain_mappings_client_client_options_credentials_file( @@ -1679,6 +1701,737 @@ async def test_delete_domain_mapping_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListDomainMappingsRequest, + dict, + ], +) +def test_list_domain_mappings_rest(request_type): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.ListDomainMappingsResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.ListDomainMappingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_domain_mappings(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListDomainMappingsPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_domain_mappings_rest_interceptors(null_interceptor): + transport = transports.DomainMappingsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.DomainMappingsRestInterceptor(), + ) + client = DomainMappingsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.DomainMappingsRestInterceptor, "post_list_domain_mappings" + ) as post, mock.patch.object( + transports.DomainMappingsRestInterceptor, "pre_list_domain_mappings" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.ListDomainMappingsRequest.pb( + appengine.ListDomainMappingsRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = appengine.ListDomainMappingsResponse.to_json( + appengine.ListDomainMappingsResponse() + ) + + request = appengine.ListDomainMappingsRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.ListDomainMappingsResponse() + + client.list_domain_mappings( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_domain_mappings_rest_bad_request( + transport: str = "rest", request_type=appengine.ListDomainMappingsRequest +): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_domain_mappings(request) + + +def test_list_domain_mappings_rest_pager(transport: str = "rest"): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + appengine.ListDomainMappingsResponse( + domain_mappings=[ + domain_mapping.DomainMapping(), + domain_mapping.DomainMapping(), + domain_mapping.DomainMapping(), + ], + next_page_token="abc", + ), + appengine.ListDomainMappingsResponse( + domain_mappings=[], + next_page_token="def", + ), + appengine.ListDomainMappingsResponse( + domain_mappings=[ + domain_mapping.DomainMapping(), + ], + next_page_token="ghi", + ), + appengine.ListDomainMappingsResponse( + domain_mappings=[ + domain_mapping.DomainMapping(), + domain_mapping.DomainMapping(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + appengine.ListDomainMappingsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "apps/sample1"} + + pager = client.list_domain_mappings(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, domain_mapping.DomainMapping) for i in results) + + pages = list(client.list_domain_mappings(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetDomainMappingRequest, + dict, + ], +) +def test_get_domain_mapping_rest(request_type): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/domainMappings/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = domain_mapping.DomainMapping( + name="name_value", + id="id_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = domain_mapping.DomainMapping.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_domain_mapping(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, domain_mapping.DomainMapping) + assert response.name == "name_value" + assert response.id == "id_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_domain_mapping_rest_interceptors(null_interceptor): + transport = transports.DomainMappingsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.DomainMappingsRestInterceptor(), + ) + client = DomainMappingsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.DomainMappingsRestInterceptor, "post_get_domain_mapping" + ) as post, mock.patch.object( + transports.DomainMappingsRestInterceptor, "pre_get_domain_mapping" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.GetDomainMappingRequest.pb( + appengine.GetDomainMappingRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = domain_mapping.DomainMapping.to_json( + domain_mapping.DomainMapping() + ) + + request = appengine.GetDomainMappingRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = domain_mapping.DomainMapping() + + client.get_domain_mapping( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_domain_mapping_rest_bad_request( + transport: str = "rest", request_type=appengine.GetDomainMappingRequest +): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/domainMappings/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_domain_mapping(request) + + +def test_get_domain_mapping_rest_error(): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateDomainMappingRequest, + dict, + ], +) +def test_create_domain_mapping_rest(request_type): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request_init["domain_mapping"] = { + "name": "name_value", + "id": "id_value", + "ssl_settings": { + "certificate_id": "certificate_id_value", + "ssl_management_type": 1, + "pending_managed_certificate_id": "pending_managed_certificate_id_value", + }, + "resource_records": [ + {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} + ], + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.create_domain_mapping(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_domain_mapping_rest_interceptors(null_interceptor): + transport = transports.DomainMappingsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.DomainMappingsRestInterceptor(), + ) + client = DomainMappingsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.DomainMappingsRestInterceptor, "post_create_domain_mapping" + ) as post, mock.patch.object( + transports.DomainMappingsRestInterceptor, "pre_create_domain_mapping" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.CreateDomainMappingRequest.pb( + appengine.CreateDomainMappingRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.CreateDomainMappingRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.create_domain_mapping( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_domain_mapping_rest_bad_request( + transport: str = "rest", request_type=appengine.CreateDomainMappingRequest +): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request_init["domain_mapping"] = { + "name": "name_value", + "id": "id_value", + "ssl_settings": { + "certificate_id": "certificate_id_value", + "ssl_management_type": 1, + "pending_managed_certificate_id": "pending_managed_certificate_id_value", + }, + "resource_records": [ + {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} + ], + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.create_domain_mapping(request) + + +def test_create_domain_mapping_rest_error(): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateDomainMappingRequest, + dict, + ], +) +def test_update_domain_mapping_rest(request_type): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/domainMappings/sample2"} + request_init["domain_mapping"] = { + "name": "name_value", + "id": "id_value", + "ssl_settings": { + "certificate_id": "certificate_id_value", + "ssl_management_type": 1, + "pending_managed_certificate_id": "pending_managed_certificate_id_value", + }, + "resource_records": [ + {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} + ], + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_domain_mapping(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_domain_mapping_rest_interceptors(null_interceptor): + transport = transports.DomainMappingsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.DomainMappingsRestInterceptor(), + ) + client = DomainMappingsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.DomainMappingsRestInterceptor, "post_update_domain_mapping" + ) as post, mock.patch.object( + transports.DomainMappingsRestInterceptor, "pre_update_domain_mapping" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.UpdateDomainMappingRequest.pb( + appengine.UpdateDomainMappingRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.UpdateDomainMappingRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.update_domain_mapping( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_domain_mapping_rest_bad_request( + transport: str = "rest", request_type=appengine.UpdateDomainMappingRequest +): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/domainMappings/sample2"} + request_init["domain_mapping"] = { + "name": "name_value", + "id": "id_value", + "ssl_settings": { + "certificate_id": "certificate_id_value", + "ssl_management_type": 1, + "pending_managed_certificate_id": "pending_managed_certificate_id_value", + }, + "resource_records": [ + {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} + ], + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_domain_mapping(request) + + +def test_update_domain_mapping_rest_error(): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteDomainMappingRequest, + dict, + ], +) +def test_delete_domain_mapping_rest(request_type): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/domainMappings/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_domain_mapping(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_domain_mapping_rest_interceptors(null_interceptor): + transport = transports.DomainMappingsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.DomainMappingsRestInterceptor(), + ) + client = DomainMappingsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.DomainMappingsRestInterceptor, "post_delete_domain_mapping" + ) as post, mock.patch.object( + transports.DomainMappingsRestInterceptor, "pre_delete_domain_mapping" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.DeleteDomainMappingRequest.pb( + appengine.DeleteDomainMappingRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.DeleteDomainMappingRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.delete_domain_mapping( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_domain_mapping_rest_bad_request( + transport: str = "rest", request_type=appengine.DeleteDomainMappingRequest +): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/domainMappings/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_domain_mapping(request) + + +def test_delete_domain_mapping_rest_error(): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.DomainMappingsGrpcTransport( @@ -1760,6 +2513,7 @@ def test_transport_get_channel(): [ transports.DomainMappingsGrpcTransport, transports.DomainMappingsGrpcAsyncIOTransport, + transports.DomainMappingsRestTransport, ], ) def test_transport_adc(transport_class): @@ -1774,6 +2528,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -1924,6 +2679,7 @@ def test_domain_mappings_transport_auth_adc(transport_class): [ transports.DomainMappingsGrpcTransport, transports.DomainMappingsGrpcAsyncIOTransport, + transports.DomainMappingsRestTransport, ], ) def test_domain_mappings_transport_auth_gdch_credentials(transport_class): @@ -2025,11 +2781,40 @@ def test_domain_mappings_grpc_transport_client_cert_source_for_mtls(transport_cl ) +def test_domain_mappings_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.DomainMappingsRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +def test_domain_mappings_rest_lro_client(): + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.AbstractOperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_domain_mappings_host_no_port(transport_name): @@ -2040,7 +2825,11 @@ def test_domain_mappings_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -2048,6 +2837,7 @@ def test_domain_mappings_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_domain_mappings_host_with_port(transport_name): @@ -2058,7 +2848,45 @@ def test_domain_mappings_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_domain_mappings_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = DomainMappingsClient( + credentials=creds1, + transport=transport_name, + ) + client2 = DomainMappingsClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_domain_mappings._session + session2 = client2.transport.list_domain_mappings._session + assert session1 != session2 + session1 = client1.transport.get_domain_mapping._session + session2 = client2.transport.get_domain_mapping._session + assert session1 != session2 + session1 = client1.transport.create_domain_mapping._session + session2 = client2.transport.create_domain_mapping._session + assert session1 != session2 + session1 = client1.transport.update_domain_mapping._session + session2 = client2.transport.update_domain_mapping._session + assert session1 != session2 + session1 = client1.transport.delete_domain_mapping._session + session2 = client2.transport.delete_domain_mapping._session + assert session1 != session2 def test_domain_mappings_grpc_transport_channel(): @@ -2363,6 +3191,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2380,6 +3209,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index b0fef84..bf32eb1 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template @@ -32,11 +34,14 @@ from google.auth.exceptions import MutualTLSChannelError from google.oauth2 import service_account from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import json_format import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.firewall import ( FirewallAsyncClient, @@ -91,6 +96,7 @@ def test__get_default_mtls_endpoint(): [ (FirewallClient, "grpc"), (FirewallAsyncClient, "grpc_asyncio"), + (FirewallClient, "rest"), ], ) def test_firewall_client_from_service_account_info(client_class, transport_name): @@ -104,7 +110,11 @@ def test_firewall_client_from_service_account_info(client_class, transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -112,6 +122,7 @@ def test_firewall_client_from_service_account_info(client_class, transport_name) [ (transports.FirewallGrpcTransport, "grpc"), (transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.FirewallRestTransport, "rest"), ], ) def test_firewall_client_service_account_always_use_jwt( @@ -137,6 +148,7 @@ def test_firewall_client_service_account_always_use_jwt( [ (FirewallClient, "grpc"), (FirewallAsyncClient, "grpc_asyncio"), + (FirewallClient, "rest"), ], ) def test_firewall_client_from_service_account_file(client_class, transport_name): @@ -157,13 +169,18 @@ def test_firewall_client_from_service_account_file(client_class, transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_firewall_client_get_transport_class(): transport = FirewallClient.get_transport_class() available_transports = [ transports.FirewallGrpcTransport, + transports.FirewallRestTransport, ] assert transport in available_transports @@ -176,6 +193,7 @@ def test_firewall_client_get_transport_class(): [ (FirewallClient, transports.FirewallGrpcTransport, "grpc"), (FirewallAsyncClient, transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), + (FirewallClient, transports.FirewallRestTransport, "rest"), ], ) @mock.patch.object( @@ -317,6 +335,8 @@ def test_firewall_client_client_options(client_class, transport_class, transport "grpc_asyncio", "false", ), + (FirewallClient, transports.FirewallRestTransport, "rest", "true"), + (FirewallClient, transports.FirewallRestTransport, "rest", "false"), ], ) @mock.patch.object( @@ -506,6 +526,7 @@ def test_firewall_client_get_mtls_endpoint_and_cert_source(client_class): [ (FirewallClient, transports.FirewallGrpcTransport, "grpc"), (FirewallAsyncClient, transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), + (FirewallClient, transports.FirewallRestTransport, "rest"), ], ) def test_firewall_client_client_options_scopes( @@ -541,6 +562,7 @@ def test_firewall_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + (FirewallClient, transports.FirewallRestTransport, "rest", None), ], ) def test_firewall_client_client_options_credentials_file( @@ -1817,6 +1839,834 @@ async def test_delete_ingress_rule_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListIngressRulesRequest, + dict, + ], +) +def test_list_ingress_rules_rest(request_type): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.ListIngressRulesResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.ListIngressRulesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_ingress_rules(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListIngressRulesPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_ingress_rules_rest_interceptors(null_interceptor): + transport = transports.FirewallRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), + ) + client = FirewallClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.FirewallRestInterceptor, "post_list_ingress_rules" + ) as post, mock.patch.object( + transports.FirewallRestInterceptor, "pre_list_ingress_rules" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.ListIngressRulesRequest.pb( + appengine.ListIngressRulesRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = appengine.ListIngressRulesResponse.to_json( + appengine.ListIngressRulesResponse() + ) + + request = appengine.ListIngressRulesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.ListIngressRulesResponse() + + client.list_ingress_rules( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_ingress_rules_rest_bad_request( + transport: str = "rest", request_type=appengine.ListIngressRulesRequest +): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_ingress_rules(request) + + +def test_list_ingress_rules_rest_pager(transport: str = "rest"): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + appengine.ListIngressRulesResponse( + ingress_rules=[ + firewall.FirewallRule(), + firewall.FirewallRule(), + firewall.FirewallRule(), + ], + next_page_token="abc", + ), + appengine.ListIngressRulesResponse( + ingress_rules=[], + next_page_token="def", + ), + appengine.ListIngressRulesResponse( + ingress_rules=[ + firewall.FirewallRule(), + ], + next_page_token="ghi", + ), + appengine.ListIngressRulesResponse( + ingress_rules=[ + firewall.FirewallRule(), + firewall.FirewallRule(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + appengine.ListIngressRulesResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "apps/sample1"} + + pager = client.list_ingress_rules(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, firewall.FirewallRule) for i in results) + + pages = list(client.list_ingress_rules(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.BatchUpdateIngressRulesRequest, + dict, + ], +) +def test_batch_update_ingress_rules_rest(request_type): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.BatchUpdateIngressRulesResponse() + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.BatchUpdateIngressRulesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.batch_update_ingress_rules(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, appengine.BatchUpdateIngressRulesResponse) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_batch_update_ingress_rules_rest_interceptors(null_interceptor): + transport = transports.FirewallRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), + ) + client = FirewallClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.FirewallRestInterceptor, "post_batch_update_ingress_rules" + ) as post, mock.patch.object( + transports.FirewallRestInterceptor, "pre_batch_update_ingress_rules" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.BatchUpdateIngressRulesRequest.pb( + appengine.BatchUpdateIngressRulesRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = appengine.BatchUpdateIngressRulesResponse.to_json( + appengine.BatchUpdateIngressRulesResponse() + ) + + request = appengine.BatchUpdateIngressRulesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.BatchUpdateIngressRulesResponse() + + client.batch_update_ingress_rules( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_batch_update_ingress_rules_rest_bad_request( + transport: str = "rest", request_type=appengine.BatchUpdateIngressRulesRequest +): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.batch_update_ingress_rules(request) + + +def test_batch_update_ingress_rules_rest_error(): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateIngressRuleRequest, + dict, + ], +) +def test_create_ingress_rule_rest(request_type): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request_init["rule"] = { + "priority": 898, + "action": 1, + "source_range": "source_range_value", + "description": "description_value", + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = firewall.FirewallRule( + priority=898, + action=firewall.FirewallRule.Action.ALLOW, + source_range="source_range_value", + description="description_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = firewall.FirewallRule.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.create_ingress_rule(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, firewall.FirewallRule) + assert response.priority == 898 + assert response.action == firewall.FirewallRule.Action.ALLOW + assert response.source_range == "source_range_value" + assert response.description == "description_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_ingress_rule_rest_interceptors(null_interceptor): + transport = transports.FirewallRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), + ) + client = FirewallClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.FirewallRestInterceptor, "post_create_ingress_rule" + ) as post, mock.patch.object( + transports.FirewallRestInterceptor, "pre_create_ingress_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.CreateIngressRuleRequest.pb( + appengine.CreateIngressRuleRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = firewall.FirewallRule.to_json( + firewall.FirewallRule() + ) + + request = appengine.CreateIngressRuleRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = firewall.FirewallRule() + + client.create_ingress_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_ingress_rule_rest_bad_request( + transport: str = "rest", request_type=appengine.CreateIngressRuleRequest +): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request_init["rule"] = { + "priority": 898, + "action": 1, + "source_range": "source_range_value", + "description": "description_value", + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.create_ingress_rule(request) + + +def test_create_ingress_rule_rest_error(): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetIngressRuleRequest, + dict, + ], +) +def test_get_ingress_rule_rest(request_type): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = firewall.FirewallRule( + priority=898, + action=firewall.FirewallRule.Action.ALLOW, + source_range="source_range_value", + description="description_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = firewall.FirewallRule.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_ingress_rule(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, firewall.FirewallRule) + assert response.priority == 898 + assert response.action == firewall.FirewallRule.Action.ALLOW + assert response.source_range == "source_range_value" + assert response.description == "description_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_ingress_rule_rest_interceptors(null_interceptor): + transport = transports.FirewallRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), + ) + client = FirewallClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.FirewallRestInterceptor, "post_get_ingress_rule" + ) as post, mock.patch.object( + transports.FirewallRestInterceptor, "pre_get_ingress_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.GetIngressRuleRequest.pb( + appengine.GetIngressRuleRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = firewall.FirewallRule.to_json( + firewall.FirewallRule() + ) + + request = appengine.GetIngressRuleRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = firewall.FirewallRule() + + client.get_ingress_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_ingress_rule_rest_bad_request( + transport: str = "rest", request_type=appengine.GetIngressRuleRequest +): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_ingress_rule(request) + + +def test_get_ingress_rule_rest_error(): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateIngressRuleRequest, + dict, + ], +) +def test_update_ingress_rule_rest(request_type): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} + request_init["rule"] = { + "priority": 898, + "action": 1, + "source_range": "source_range_value", + "description": "description_value", + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = firewall.FirewallRule( + priority=898, + action=firewall.FirewallRule.Action.ALLOW, + source_range="source_range_value", + description="description_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = firewall.FirewallRule.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_ingress_rule(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, firewall.FirewallRule) + assert response.priority == 898 + assert response.action == firewall.FirewallRule.Action.ALLOW + assert response.source_range == "source_range_value" + assert response.description == "description_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_ingress_rule_rest_interceptors(null_interceptor): + transport = transports.FirewallRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), + ) + client = FirewallClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.FirewallRestInterceptor, "post_update_ingress_rule" + ) as post, mock.patch.object( + transports.FirewallRestInterceptor, "pre_update_ingress_rule" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.UpdateIngressRuleRequest.pb( + appengine.UpdateIngressRuleRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = firewall.FirewallRule.to_json( + firewall.FirewallRule() + ) + + request = appengine.UpdateIngressRuleRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = firewall.FirewallRule() + + client.update_ingress_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_ingress_rule_rest_bad_request( + transport: str = "rest", request_type=appengine.UpdateIngressRuleRequest +): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} + request_init["rule"] = { + "priority": 898, + "action": 1, + "source_range": "source_range_value", + "description": "description_value", + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_ingress_rule(request) + + +def test_update_ingress_rule_rest_error(): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteIngressRuleRequest, + dict, + ], +) +def test_delete_ingress_rule_rest(request_type): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = "" + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_ingress_rule(request) + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_ingress_rule_rest_interceptors(null_interceptor): + transport = transports.FirewallRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), + ) + client = FirewallClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.FirewallRestInterceptor, "pre_delete_ingress_rule" + ) as pre: + pre.assert_not_called() + pb_message = appengine.DeleteIngressRuleRequest.pb( + appengine.DeleteIngressRuleRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + + request = appengine.DeleteIngressRuleRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + + client.delete_ingress_rule( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + + +def test_delete_ingress_rule_rest_bad_request( + transport: str = "rest", request_type=appengine.DeleteIngressRuleRequest +): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_ingress_rule(request) + + +def test_delete_ingress_rule_rest_error(): + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.FirewallGrpcTransport( @@ -1898,6 +2748,7 @@ def test_transport_get_channel(): [ transports.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport, + transports.FirewallRestTransport, ], ) def test_transport_adc(transport_class): @@ -1912,6 +2763,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -2058,6 +2910,7 @@ def test_firewall_transport_auth_adc(transport_class): [ transports.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport, + transports.FirewallRestTransport, ], ) def test_firewall_transport_auth_gdch_credentials(transport_class): @@ -2156,11 +3009,23 @@ def test_firewall_grpc_transport_client_cert_source_for_mtls(transport_class): ) +def test_firewall_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.FirewallRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_firewall_host_no_port(transport_name): @@ -2171,7 +3036,11 @@ def test_firewall_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -2179,6 +3048,7 @@ def test_firewall_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_firewall_host_with_port(transport_name): @@ -2189,7 +3059,48 @@ def test_firewall_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_firewall_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = FirewallClient( + credentials=creds1, + transport=transport_name, + ) + client2 = FirewallClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_ingress_rules._session + session2 = client2.transport.list_ingress_rules._session + assert session1 != session2 + session1 = client1.transport.batch_update_ingress_rules._session + session2 = client2.transport.batch_update_ingress_rules._session + assert session1 != session2 + session1 = client1.transport.create_ingress_rule._session + session2 = client2.transport.create_ingress_rule._session + assert session1 != session2 + session1 = client1.transport.get_ingress_rule._session + session2 = client2.transport.get_ingress_rule._session + assert session1 != session2 + session1 = client1.transport.update_ingress_rule._session + session2 = client2.transport.update_ingress_rule._session + assert session1 != session2 + session1 = client1.transport.delete_ingress_rule._session + session2 = client2.transport.delete_ingress_rule._session + assert session1 != session2 def test_firewall_grpc_transport_channel(): @@ -2452,6 +3363,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2469,6 +3381,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 9c35b1e..0b36aa7 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import ( @@ -42,12 +44,15 @@ from google.longrunning import operations_pb2 from google.oauth2 import service_account from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import json_format from google.protobuf import timestamp_pb2 # type: ignore import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.instances import ( InstancesAsyncClient, @@ -103,6 +108,7 @@ def test__get_default_mtls_endpoint(): [ (InstancesClient, "grpc"), (InstancesAsyncClient, "grpc_asyncio"), + (InstancesClient, "rest"), ], ) def test_instances_client_from_service_account_info(client_class, transport_name): @@ -116,7 +122,11 @@ def test_instances_client_from_service_account_info(client_class, transport_name assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -124,6 +134,7 @@ def test_instances_client_from_service_account_info(client_class, transport_name [ (transports.InstancesGrpcTransport, "grpc"), (transports.InstancesGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.InstancesRestTransport, "rest"), ], ) def test_instances_client_service_account_always_use_jwt( @@ -149,6 +160,7 @@ def test_instances_client_service_account_always_use_jwt( [ (InstancesClient, "grpc"), (InstancesAsyncClient, "grpc_asyncio"), + (InstancesClient, "rest"), ], ) def test_instances_client_from_service_account_file(client_class, transport_name): @@ -169,13 +181,18 @@ def test_instances_client_from_service_account_file(client_class, transport_name assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_instances_client_get_transport_class(): transport = InstancesClient.get_transport_class() available_transports = [ transports.InstancesGrpcTransport, + transports.InstancesRestTransport, ] assert transport in available_transports @@ -192,6 +209,7 @@ def test_instances_client_get_transport_class(): transports.InstancesGrpcAsyncIOTransport, "grpc_asyncio", ), + (InstancesClient, transports.InstancesRestTransport, "rest"), ], ) @mock.patch.object( @@ -333,6 +351,8 @@ def test_instances_client_client_options(client_class, transport_class, transpor "grpc_asyncio", "false", ), + (InstancesClient, transports.InstancesRestTransport, "rest", "true"), + (InstancesClient, transports.InstancesRestTransport, "rest", "false"), ], ) @mock.patch.object( @@ -526,6 +546,7 @@ def test_instances_client_get_mtls_endpoint_and_cert_source(client_class): transports.InstancesGrpcAsyncIOTransport, "grpc_asyncio", ), + (InstancesClient, transports.InstancesRestTransport, "rest"), ], ) def test_instances_client_client_options_scopes( @@ -561,6 +582,7 @@ def test_instances_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + (InstancesClient, transports.InstancesRestTransport, "rest", None), ], ) def test_instances_client_client_options_credentials_file( @@ -1504,6 +1526,587 @@ async def test_debug_instance_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListInstancesRequest, + dict, + ], +) +def test_list_instances_rest(request_type): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1/services/sample2/versions/sample3"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.ListInstancesResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.ListInstancesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_instances(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListInstancesPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_instances_rest_interceptors(null_interceptor): + transport = transports.InstancesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), + ) + client = InstancesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.InstancesRestInterceptor, "post_list_instances" + ) as post, mock.patch.object( + transports.InstancesRestInterceptor, "pre_list_instances" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.ListInstancesRequest.pb(appengine.ListInstancesRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = appengine.ListInstancesResponse.to_json( + appengine.ListInstancesResponse() + ) + + request = appengine.ListInstancesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.ListInstancesResponse() + + client.list_instances( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_instances_rest_bad_request( + transport: str = "rest", request_type=appengine.ListInstancesRequest +): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1/services/sample2/versions/sample3"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_instances(request) + + +def test_list_instances_rest_pager(transport: str = "rest"): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + appengine.ListInstancesResponse( + instances=[ + instance.Instance(), + instance.Instance(), + instance.Instance(), + ], + next_page_token="abc", + ), + appengine.ListInstancesResponse( + instances=[], + next_page_token="def", + ), + appengine.ListInstancesResponse( + instances=[ + instance.Instance(), + ], + next_page_token="ghi", + ), + appengine.ListInstancesResponse( + instances=[ + instance.Instance(), + instance.Instance(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple(appengine.ListInstancesResponse.to_json(x) for x in response) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "apps/sample1/services/sample2/versions/sample3"} + + pager = client.list_instances(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, instance.Instance) for i in results) + + pages = list(client.list_instances(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetInstanceRequest, + dict, + ], +) +def test_get_instance_rest(request_type): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = instance.Instance( + name="name_value", + id="id_value", + app_engine_release="app_engine_release_value", + availability=instance.Instance.Availability.RESIDENT, + vm_name="vm_name_value", + vm_zone_name="vm_zone_name_value", + vm_id="vm_id_value", + requests=892, + errors=669, + qps=0.34, + average_latency=1578, + memory_usage=1293, + vm_status="vm_status_value", + vm_debug_enabled=True, + vm_ip="vm_ip_value", + vm_liveness=instance.Instance.Liveness.LivenessState.UNKNOWN, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = instance.Instance.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_instance(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, instance.Instance) + assert response.name == "name_value" + assert response.id == "id_value" + assert response.app_engine_release == "app_engine_release_value" + assert response.availability == instance.Instance.Availability.RESIDENT + assert response.vm_name == "vm_name_value" + assert response.vm_zone_name == "vm_zone_name_value" + assert response.vm_id == "vm_id_value" + assert response.requests == 892 + assert response.errors == 669 + assert math.isclose(response.qps, 0.34, rel_tol=1e-6) + assert response.average_latency == 1578 + assert response.memory_usage == 1293 + assert response.vm_status == "vm_status_value" + assert response.vm_debug_enabled is True + assert response.vm_ip == "vm_ip_value" + assert response.vm_liveness == instance.Instance.Liveness.LivenessState.UNKNOWN + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_instance_rest_interceptors(null_interceptor): + transport = transports.InstancesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), + ) + client = InstancesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.InstancesRestInterceptor, "post_get_instance" + ) as post, mock.patch.object( + transports.InstancesRestInterceptor, "pre_get_instance" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.GetInstanceRequest.pb(appengine.GetInstanceRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = instance.Instance.to_json(instance.Instance()) + + request = appengine.GetInstanceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = instance.Instance() + + client.get_instance( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_instance_rest_bad_request( + transport: str = "rest", request_type=appengine.GetInstanceRequest +): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_instance(request) + + +def test_get_instance_rest_error(): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteInstanceRequest, + dict, + ], +) +def test_delete_instance_rest(request_type): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_instance(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_instance_rest_interceptors(null_interceptor): + transport = transports.InstancesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), + ) + client = InstancesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.InstancesRestInterceptor, "post_delete_instance" + ) as post, mock.patch.object( + transports.InstancesRestInterceptor, "pre_delete_instance" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.DeleteInstanceRequest.pb( + appengine.DeleteInstanceRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.DeleteInstanceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.delete_instance( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_instance_rest_bad_request( + transport: str = "rest", request_type=appengine.DeleteInstanceRequest +): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_instance(request) + + +def test_delete_instance_rest_error(): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.DebugInstanceRequest, + dict, + ], +) +def test_debug_instance_rest(request_type): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.debug_instance(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_debug_instance_rest_interceptors(null_interceptor): + transport = transports.InstancesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), + ) + client = InstancesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.InstancesRestInterceptor, "post_debug_instance" + ) as post, mock.patch.object( + transports.InstancesRestInterceptor, "pre_debug_instance" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.DebugInstanceRequest.pb(appengine.DebugInstanceRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.DebugInstanceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.debug_instance( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_debug_instance_rest_bad_request( + transport: str = "rest", request_type=appengine.DebugInstanceRequest +): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.debug_instance(request) + + +def test_debug_instance_rest_error(): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.InstancesGrpcTransport( @@ -1585,6 +2188,7 @@ def test_transport_get_channel(): [ transports.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport, + transports.InstancesRestTransport, ], ) def test_transport_adc(transport_class): @@ -1599,6 +2203,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -1748,6 +2353,7 @@ def test_instances_transport_auth_adc(transport_class): [ transports.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport, + transports.InstancesRestTransport, ], ) def test_instances_transport_auth_gdch_credentials(transport_class): @@ -1846,11 +2452,40 @@ def test_instances_grpc_transport_client_cert_source_for_mtls(transport_class): ) +def test_instances_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.InstancesRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +def test_instances_rest_lro_client(): + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.AbstractOperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_instances_host_no_port(transport_name): @@ -1861,7 +2496,11 @@ def test_instances_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -1869,6 +2508,7 @@ def test_instances_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_instances_host_with_port(transport_name): @@ -1879,7 +2519,42 @@ def test_instances_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_instances_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = InstancesClient( + credentials=creds1, + transport=transport_name, + ) + client2 = InstancesClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_instances._session + session2 = client2.transport.list_instances._session + assert session1 != session2 + session1 = client1.transport.get_instance._session + session2 = client2.transport.get_instance._session + assert session1 != session2 + session1 = client1.transport.delete_instance._session + session2 = client2.transport.delete_instance._session + assert session1 != session2 + session1 = client1.transport.debug_instance._session + session2 = client2.transport.debug_instance._session + assert session1 != session2 def test_instances_grpc_transport_channel(): @@ -2207,6 +2882,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2224,6 +2900,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index fea1894..ca6388e 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import ( @@ -43,11 +45,14 @@ from google.oauth2 import service_account from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import json_format import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.services import ( ServicesAsyncClient, @@ -104,6 +109,7 @@ def test__get_default_mtls_endpoint(): [ (ServicesClient, "grpc"), (ServicesAsyncClient, "grpc_asyncio"), + (ServicesClient, "rest"), ], ) def test_services_client_from_service_account_info(client_class, transport_name): @@ -117,7 +123,11 @@ def test_services_client_from_service_account_info(client_class, transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -125,6 +135,7 @@ def test_services_client_from_service_account_info(client_class, transport_name) [ (transports.ServicesGrpcTransport, "grpc"), (transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.ServicesRestTransport, "rest"), ], ) def test_services_client_service_account_always_use_jwt( @@ -150,6 +161,7 @@ def test_services_client_service_account_always_use_jwt( [ (ServicesClient, "grpc"), (ServicesAsyncClient, "grpc_asyncio"), + (ServicesClient, "rest"), ], ) def test_services_client_from_service_account_file(client_class, transport_name): @@ -170,13 +182,18 @@ def test_services_client_from_service_account_file(client_class, transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_services_client_get_transport_class(): transport = ServicesClient.get_transport_class() available_transports = [ transports.ServicesGrpcTransport, + transports.ServicesRestTransport, ] assert transport in available_transports @@ -189,6 +206,7 @@ def test_services_client_get_transport_class(): [ (ServicesClient, transports.ServicesGrpcTransport, "grpc"), (ServicesAsyncClient, transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), + (ServicesClient, transports.ServicesRestTransport, "rest"), ], ) @mock.patch.object( @@ -330,6 +348,8 @@ def test_services_client_client_options(client_class, transport_class, transport "grpc_asyncio", "false", ), + (ServicesClient, transports.ServicesRestTransport, "rest", "true"), + (ServicesClient, transports.ServicesRestTransport, "rest", "false"), ], ) @mock.patch.object( @@ -519,6 +539,7 @@ def test_services_client_get_mtls_endpoint_and_cert_source(client_class): [ (ServicesClient, transports.ServicesGrpcTransport, "grpc"), (ServicesAsyncClient, transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), + (ServicesClient, transports.ServicesRestTransport, "rest"), ], ) def test_services_client_client_options_scopes( @@ -554,6 +575,7 @@ def test_services_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + (ServicesClient, transports.ServicesRestTransport, "rest", None), ], ) def test_services_client_client_options_credentials_file( @@ -1441,6 +1463,559 @@ async def test_delete_service_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListServicesRequest, + dict, + ], +) +def test_list_services_rest(request_type): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.ListServicesResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.ListServicesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_services(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListServicesPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_services_rest_interceptors(null_interceptor): + transport = transports.ServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), + ) + client = ServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ServicesRestInterceptor, "post_list_services" + ) as post, mock.patch.object( + transports.ServicesRestInterceptor, "pre_list_services" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.ListServicesRequest.pb(appengine.ListServicesRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = appengine.ListServicesResponse.to_json( + appengine.ListServicesResponse() + ) + + request = appengine.ListServicesRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.ListServicesResponse() + + client.list_services( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_services_rest_bad_request( + transport: str = "rest", request_type=appengine.ListServicesRequest +): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_services(request) + + +def test_list_services_rest_pager(transport: str = "rest"): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + appengine.ListServicesResponse( + services=[ + service.Service(), + service.Service(), + service.Service(), + ], + next_page_token="abc", + ), + appengine.ListServicesResponse( + services=[], + next_page_token="def", + ), + appengine.ListServicesResponse( + services=[ + service.Service(), + ], + next_page_token="ghi", + ), + appengine.ListServicesResponse( + services=[ + service.Service(), + service.Service(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple(appengine.ListServicesResponse.to_json(x) for x in response) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "apps/sample1"} + + pager = client.list_services(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, service.Service) for i in results) + + pages = list(client.list_services(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetServiceRequest, + dict, + ], +) +def test_get_service_rest(request_type): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = service.Service( + name="name_value", + id="id_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = service.Service.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_service(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, service.Service) + assert response.name == "name_value" + assert response.id == "id_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_service_rest_interceptors(null_interceptor): + transport = transports.ServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), + ) + client = ServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ServicesRestInterceptor, "post_get_service" + ) as post, mock.patch.object( + transports.ServicesRestInterceptor, "pre_get_service" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.GetServiceRequest.pb(appengine.GetServiceRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = service.Service.to_json(service.Service()) + + request = appengine.GetServiceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = service.Service() + + client.get_service( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_service_rest_bad_request( + transport: str = "rest", request_type=appengine.GetServiceRequest +): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_service(request) + + +def test_get_service_rest_error(): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateServiceRequest, + dict, + ], +) +def test_update_service_rest(request_type): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2"} + request_init["service"] = { + "name": "name_value", + "id": "id_value", + "split": {"shard_by": 1, "allocations": {}}, + "labels": {}, + "network_settings": {"ingress_traffic_allowed": 1}, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_service(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_service_rest_interceptors(null_interceptor): + transport = transports.ServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), + ) + client = ServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.ServicesRestInterceptor, "post_update_service" + ) as post, mock.patch.object( + transports.ServicesRestInterceptor, "pre_update_service" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.UpdateServiceRequest.pb(appengine.UpdateServiceRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.UpdateServiceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.update_service( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_service_rest_bad_request( + transport: str = "rest", request_type=appengine.UpdateServiceRequest +): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2"} + request_init["service"] = { + "name": "name_value", + "id": "id_value", + "split": {"shard_by": 1, "allocations": {}}, + "labels": {}, + "network_settings": {"ingress_traffic_allowed": 1}, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_service(request) + + +def test_update_service_rest_error(): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteServiceRequest, + dict, + ], +) +def test_delete_service_rest(request_type): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_service(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_service_rest_interceptors(null_interceptor): + transport = transports.ServicesRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), + ) + client = ServicesClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.ServicesRestInterceptor, "post_delete_service" + ) as post, mock.patch.object( + transports.ServicesRestInterceptor, "pre_delete_service" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.DeleteServiceRequest.pb(appengine.DeleteServiceRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.DeleteServiceRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.delete_service( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_service_rest_bad_request( + transport: str = "rest", request_type=appengine.DeleteServiceRequest +): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_service(request) + + +def test_delete_service_rest_error(): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServicesGrpcTransport( @@ -1522,6 +2097,7 @@ def test_transport_get_channel(): [ transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport, + transports.ServicesRestTransport, ], ) def test_transport_adc(transport_class): @@ -1536,6 +2112,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -1685,6 +2262,7 @@ def test_services_transport_auth_adc(transport_class): [ transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport, + transports.ServicesRestTransport, ], ) def test_services_transport_auth_gdch_credentials(transport_class): @@ -1783,11 +2361,40 @@ def test_services_grpc_transport_client_cert_source_for_mtls(transport_class): ) +def test_services_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.ServicesRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +def test_services_rest_lro_client(): + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.AbstractOperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_services_host_no_port(transport_name): @@ -1798,7 +2405,11 @@ def test_services_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -1806,6 +2417,7 @@ def test_services_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_services_host_with_port(transport_name): @@ -1816,7 +2428,42 @@ def test_services_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_services_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = ServicesClient( + credentials=creds1, + transport=transport_name, + ) + client2 = ServicesClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_services._session + session2 = client2.transport.list_services._session + assert session1 != session2 + session1 = client1.transport.get_service._session + session2 = client2.transport.get_service._session + assert session1 != session2 + session1 = client1.transport.update_service._session + session2 = client2.transport.update_service._session + assert session1 != session2 + session1 = client1.transport.delete_service._session + session2 = client2.transport.delete_service._session + assert session1 != session2 def test_services_grpc_transport_channel(): @@ -2113,6 +2760,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2130,6 +2778,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 5cd663b..8ea3eb5 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import ( @@ -44,12 +46,15 @@ from google.protobuf import duration_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import json_format from google.protobuf import timestamp_pb2 # type: ignore import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.appengine_admin_v1.services.versions import ( VersionsAsyncClient, @@ -106,6 +111,7 @@ def test__get_default_mtls_endpoint(): [ (VersionsClient, "grpc"), (VersionsAsyncClient, "grpc_asyncio"), + (VersionsClient, "rest"), ], ) def test_versions_client_from_service_account_info(client_class, transport_name): @@ -119,7 +125,11 @@ def test_versions_client_from_service_account_info(client_class, transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -127,6 +137,7 @@ def test_versions_client_from_service_account_info(client_class, transport_name) [ (transports.VersionsGrpcTransport, "grpc"), (transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.VersionsRestTransport, "rest"), ], ) def test_versions_client_service_account_always_use_jwt( @@ -152,6 +163,7 @@ def test_versions_client_service_account_always_use_jwt( [ (VersionsClient, "grpc"), (VersionsAsyncClient, "grpc_asyncio"), + (VersionsClient, "rest"), ], ) def test_versions_client_from_service_account_file(client_class, transport_name): @@ -172,13 +184,18 @@ def test_versions_client_from_service_account_file(client_class, transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) def test_versions_client_get_transport_class(): transport = VersionsClient.get_transport_class() available_transports = [ transports.VersionsGrpcTransport, + transports.VersionsRestTransport, ] assert transport in available_transports @@ -191,6 +208,7 @@ def test_versions_client_get_transport_class(): [ (VersionsClient, transports.VersionsGrpcTransport, "grpc"), (VersionsAsyncClient, transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), + (VersionsClient, transports.VersionsRestTransport, "rest"), ], ) @mock.patch.object( @@ -332,6 +350,8 @@ def test_versions_client_client_options(client_class, transport_class, transport "grpc_asyncio", "false", ), + (VersionsClient, transports.VersionsRestTransport, "rest", "true"), + (VersionsClient, transports.VersionsRestTransport, "rest", "false"), ], ) @mock.patch.object( @@ -521,6 +541,7 @@ def test_versions_client_get_mtls_endpoint_and_cert_source(client_class): [ (VersionsClient, transports.VersionsGrpcTransport, "grpc"), (VersionsAsyncClient, transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), + (VersionsClient, transports.VersionsRestTransport, "rest"), ], ) def test_versions_client_client_options_scopes( @@ -556,6 +577,7 @@ def test_versions_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + (VersionsClient, transports.VersionsRestTransport, "rest", None), ], ) def test_versions_client_client_options_credentials_file( @@ -1662,6 +1684,1356 @@ async def test_delete_version_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListVersionsRequest, + dict, + ], +) +def test_list_versions_rest(request_type): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1/services/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = appengine.ListVersionsResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = appengine.ListVersionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_versions(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListVersionsPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_versions_rest_interceptors(null_interceptor): + transport = transports.VersionsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), + ) + client = VersionsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.VersionsRestInterceptor, "post_list_versions" + ) as post, mock.patch.object( + transports.VersionsRestInterceptor, "pre_list_versions" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.ListVersionsRequest.pb(appengine.ListVersionsRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = appengine.ListVersionsResponse.to_json( + appengine.ListVersionsResponse() + ) + + request = appengine.ListVersionsRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = appengine.ListVersionsResponse() + + client.list_versions( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_versions_rest_bad_request( + transport: str = "rest", request_type=appengine.ListVersionsRequest +): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1/services/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_versions(request) + + +def test_list_versions_rest_pager(transport: str = "rest"): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + appengine.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], + next_page_token="abc", + ), + appengine.ListVersionsResponse( + versions=[], + next_page_token="def", + ), + appengine.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + appengine.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple(appengine.ListVersionsResponse.to_json(x) for x in response) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "apps/sample1/services/sample2"} + + pager = client.list_versions(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, version.Version) for i in results) + + pages = list(client.list_versions(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetVersionRequest, + dict, + ], +) +def test_get_version_rest(request_type): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = version.Version( + name="name_value", + id="id_value", + inbound_services=[version.InboundServiceType.INBOUND_SERVICE_MAIL], + instance_class="instance_class_value", + zones=["zones_value"], + runtime="runtime_value", + runtime_channel="runtime_channel_value", + threadsafe=True, + vm=True, + app_engine_apis=True, + env="env_value", + serving_status=version.ServingStatus.SERVING, + created_by="created_by_value", + disk_usage_bytes=1701, + runtime_api_version="runtime_api_version_value", + runtime_main_executable_path="runtime_main_executable_path_value", + service_account="service_account_value", + nobuild_files_regex="nobuild_files_regex_value", + version_url="version_url_value", + automatic_scaling=version.AutomaticScaling( + cool_down_period=duration_pb2.Duration(seconds=751) + ), + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = version.Version.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_version(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, version.Version) + assert response.name == "name_value" + assert response.id == "id_value" + assert response.inbound_services == [ + version.InboundServiceType.INBOUND_SERVICE_MAIL + ] + assert response.instance_class == "instance_class_value" + assert response.zones == ["zones_value"] + assert response.runtime == "runtime_value" + assert response.runtime_channel == "runtime_channel_value" + assert response.threadsafe is True + assert response.vm is True + assert response.app_engine_apis is True + assert response.env == "env_value" + assert response.serving_status == version.ServingStatus.SERVING + assert response.created_by == "created_by_value" + assert response.disk_usage_bytes == 1701 + assert response.runtime_api_version == "runtime_api_version_value" + assert response.runtime_main_executable_path == "runtime_main_executable_path_value" + assert response.service_account == "service_account_value" + assert response.nobuild_files_regex == "nobuild_files_regex_value" + assert response.version_url == "version_url_value" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_version_rest_interceptors(null_interceptor): + transport = transports.VersionsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), + ) + client = VersionsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.VersionsRestInterceptor, "post_get_version" + ) as post, mock.patch.object( + transports.VersionsRestInterceptor, "pre_get_version" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.GetVersionRequest.pb(appengine.GetVersionRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = version.Version.to_json(version.Version()) + + request = appengine.GetVersionRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = version.Version() + + client.get_version( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_version_rest_bad_request( + transport: str = "rest", request_type=appengine.GetVersionRequest +): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_version(request) + + +def test_get_version_rest_error(): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateVersionRequest, + dict, + ], +) +def test_create_version_rest(request_type): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1/services/sample2"} + request_init["version"] = { + "name": "name_value", + "id": "id_value", + "automatic_scaling": { + "cool_down_period": {"seconds": 751, "nanos": 543}, + "cpu_utilization": { + "aggregation_window_length": {}, + "target_utilization": 0.19540000000000002, + }, + "max_concurrent_requests": 2499, + "max_idle_instances": 1898, + "max_total_instances": 2032, + "max_pending_latency": {}, + "min_idle_instances": 1896, + "min_total_instances": 2030, + "min_pending_latency": {}, + "request_utilization": { + "target_request_count_per_second": 3320, + "target_concurrent_requests": 2820, + }, + "disk_utilization": { + "target_write_bytes_per_second": 3096, + "target_write_ops_per_second": 2883, + "target_read_bytes_per_second": 2953, + "target_read_ops_per_second": 2740, + }, + "network_utilization": { + "target_sent_bytes_per_second": 2983, + "target_sent_packets_per_second": 3179, + "target_received_bytes_per_second": 3380, + "target_received_packets_per_second": 3576, + }, + "standard_scheduler_settings": { + "target_cpu_utilization": 0.23770000000000002, + "target_throughput_utilization": 0.3163, + "min_instances": 1387, + "max_instances": 1389, + }, + }, + "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, + "manual_scaling": {"instances": 968}, + "inbound_services": [1], + "instance_class": "instance_class_value", + "network": { + "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], + "instance_tag": "instance_tag_value", + "name": "name_value", + "subnetwork_name": "subnetwork_name_value", + "session_affinity": True, + }, + "zones": ["zones_value1", "zones_value2"], + "resources": { + "cpu": 0.328, + "disk_gb": 0.723, + "memory_gb": 0.961, + "volumes": [ + { + "name": "name_value", + "volume_type": "volume_type_value", + "size_gb": 0.739, + } + ], + "kms_key_reference": "kms_key_reference_value", + }, + "runtime": "runtime_value", + "runtime_channel": "runtime_channel_value", + "threadsafe": True, + "vm": True, + "app_engine_apis": True, + "beta_settings": {}, + "env": "env_value", + "serving_status": 1, + "created_by": "created_by_value", + "create_time": {"seconds": 751, "nanos": 543}, + "disk_usage_bytes": 1701, + "runtime_api_version": "runtime_api_version_value", + "runtime_main_executable_path": "runtime_main_executable_path_value", + "service_account": "service_account_value", + "handlers": [ + { + "url_regex": "url_regex_value", + "static_files": { + "path": "path_value", + "upload_path_regex": "upload_path_regex_value", + "http_headers": {}, + "mime_type": "mime_type_value", + "expiration": {}, + "require_matching_file": True, + "application_readable": True, + }, + "script": {"script_path": "script_path_value"}, + "api_endpoint": {"script_path": "script_path_value"}, + "security_level": 1, + "login": 1, + "auth_fail_action": 1, + "redirect_http_response_code": 1, + } + ], + "error_handlers": [ + { + "error_code": 1, + "static_file": "static_file_value", + "mime_type": "mime_type_value", + } + ], + "libraries": [{"name": "name_value", "version": "version_value"}], + "api_config": { + "auth_fail_action": 1, + "login": 1, + "script": "script_value", + "security_level": 1, + "url": "url_value", + }, + "env_variables": {}, + "build_env_variables": {}, + "default_expiration": {}, + "health_check": { + "disable_health_check": True, + "host": "host_value", + "healthy_threshold": 1819, + "unhealthy_threshold": 2046, + "restart_threshold": 1841, + "check_interval": {}, + "timeout": {}, + }, + "readiness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "app_start_timeout": {}, + }, + "liveness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "initial_delay": {}, + }, + "nobuild_files_regex": "nobuild_files_regex_value", + "deployment": { + "files": {}, + "container": {"image": "image_value"}, + "zip_": {"source_url": "source_url_value", "files_count": 1179}, + "cloud_build_options": { + "app_yaml_path": "app_yaml_path_value", + "cloud_build_timeout": {}, + }, + }, + "version_url": "version_url_value", + "endpoints_api_service": { + "name": "name_value", + "config_id": "config_id_value", + "rollout_strategy": 1, + "disable_trace_sampling": True, + }, + "entrypoint": {"shell": "shell_value"}, + "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.create_version(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_version_rest_interceptors(null_interceptor): + transport = transports.VersionsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), + ) + client = VersionsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.VersionsRestInterceptor, "post_create_version" + ) as post, mock.patch.object( + transports.VersionsRestInterceptor, "pre_create_version" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.CreateVersionRequest.pb(appengine.CreateVersionRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.CreateVersionRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.create_version( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_version_rest_bad_request( + transport: str = "rest", request_type=appengine.CreateVersionRequest +): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "apps/sample1/services/sample2"} + request_init["version"] = { + "name": "name_value", + "id": "id_value", + "automatic_scaling": { + "cool_down_period": {"seconds": 751, "nanos": 543}, + "cpu_utilization": { + "aggregation_window_length": {}, + "target_utilization": 0.19540000000000002, + }, + "max_concurrent_requests": 2499, + "max_idle_instances": 1898, + "max_total_instances": 2032, + "max_pending_latency": {}, + "min_idle_instances": 1896, + "min_total_instances": 2030, + "min_pending_latency": {}, + "request_utilization": { + "target_request_count_per_second": 3320, + "target_concurrent_requests": 2820, + }, + "disk_utilization": { + "target_write_bytes_per_second": 3096, + "target_write_ops_per_second": 2883, + "target_read_bytes_per_second": 2953, + "target_read_ops_per_second": 2740, + }, + "network_utilization": { + "target_sent_bytes_per_second": 2983, + "target_sent_packets_per_second": 3179, + "target_received_bytes_per_second": 3380, + "target_received_packets_per_second": 3576, + }, + "standard_scheduler_settings": { + "target_cpu_utilization": 0.23770000000000002, + "target_throughput_utilization": 0.3163, + "min_instances": 1387, + "max_instances": 1389, + }, + }, + "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, + "manual_scaling": {"instances": 968}, + "inbound_services": [1], + "instance_class": "instance_class_value", + "network": { + "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], + "instance_tag": "instance_tag_value", + "name": "name_value", + "subnetwork_name": "subnetwork_name_value", + "session_affinity": True, + }, + "zones": ["zones_value1", "zones_value2"], + "resources": { + "cpu": 0.328, + "disk_gb": 0.723, + "memory_gb": 0.961, + "volumes": [ + { + "name": "name_value", + "volume_type": "volume_type_value", + "size_gb": 0.739, + } + ], + "kms_key_reference": "kms_key_reference_value", + }, + "runtime": "runtime_value", + "runtime_channel": "runtime_channel_value", + "threadsafe": True, + "vm": True, + "app_engine_apis": True, + "beta_settings": {}, + "env": "env_value", + "serving_status": 1, + "created_by": "created_by_value", + "create_time": {"seconds": 751, "nanos": 543}, + "disk_usage_bytes": 1701, + "runtime_api_version": "runtime_api_version_value", + "runtime_main_executable_path": "runtime_main_executable_path_value", + "service_account": "service_account_value", + "handlers": [ + { + "url_regex": "url_regex_value", + "static_files": { + "path": "path_value", + "upload_path_regex": "upload_path_regex_value", + "http_headers": {}, + "mime_type": "mime_type_value", + "expiration": {}, + "require_matching_file": True, + "application_readable": True, + }, + "script": {"script_path": "script_path_value"}, + "api_endpoint": {"script_path": "script_path_value"}, + "security_level": 1, + "login": 1, + "auth_fail_action": 1, + "redirect_http_response_code": 1, + } + ], + "error_handlers": [ + { + "error_code": 1, + "static_file": "static_file_value", + "mime_type": "mime_type_value", + } + ], + "libraries": [{"name": "name_value", "version": "version_value"}], + "api_config": { + "auth_fail_action": 1, + "login": 1, + "script": "script_value", + "security_level": 1, + "url": "url_value", + }, + "env_variables": {}, + "build_env_variables": {}, + "default_expiration": {}, + "health_check": { + "disable_health_check": True, + "host": "host_value", + "healthy_threshold": 1819, + "unhealthy_threshold": 2046, + "restart_threshold": 1841, + "check_interval": {}, + "timeout": {}, + }, + "readiness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "app_start_timeout": {}, + }, + "liveness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "initial_delay": {}, + }, + "nobuild_files_regex": "nobuild_files_regex_value", + "deployment": { + "files": {}, + "container": {"image": "image_value"}, + "zip_": {"source_url": "source_url_value", "files_count": 1179}, + "cloud_build_options": { + "app_yaml_path": "app_yaml_path_value", + "cloud_build_timeout": {}, + }, + }, + "version_url": "version_url_value", + "endpoints_api_service": { + "name": "name_value", + "config_id": "config_id_value", + "rollout_strategy": 1, + "disable_trace_sampling": True, + }, + "entrypoint": {"shell": "shell_value"}, + "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.create_version(request) + + +def test_create_version_rest_error(): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateVersionRequest, + dict, + ], +) +def test_update_version_rest(request_type): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} + request_init["version"] = { + "name": "name_value", + "id": "id_value", + "automatic_scaling": { + "cool_down_period": {"seconds": 751, "nanos": 543}, + "cpu_utilization": { + "aggregation_window_length": {}, + "target_utilization": 0.19540000000000002, + }, + "max_concurrent_requests": 2499, + "max_idle_instances": 1898, + "max_total_instances": 2032, + "max_pending_latency": {}, + "min_idle_instances": 1896, + "min_total_instances": 2030, + "min_pending_latency": {}, + "request_utilization": { + "target_request_count_per_second": 3320, + "target_concurrent_requests": 2820, + }, + "disk_utilization": { + "target_write_bytes_per_second": 3096, + "target_write_ops_per_second": 2883, + "target_read_bytes_per_second": 2953, + "target_read_ops_per_second": 2740, + }, + "network_utilization": { + "target_sent_bytes_per_second": 2983, + "target_sent_packets_per_second": 3179, + "target_received_bytes_per_second": 3380, + "target_received_packets_per_second": 3576, + }, + "standard_scheduler_settings": { + "target_cpu_utilization": 0.23770000000000002, + "target_throughput_utilization": 0.3163, + "min_instances": 1387, + "max_instances": 1389, + }, + }, + "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, + "manual_scaling": {"instances": 968}, + "inbound_services": [1], + "instance_class": "instance_class_value", + "network": { + "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], + "instance_tag": "instance_tag_value", + "name": "name_value", + "subnetwork_name": "subnetwork_name_value", + "session_affinity": True, + }, + "zones": ["zones_value1", "zones_value2"], + "resources": { + "cpu": 0.328, + "disk_gb": 0.723, + "memory_gb": 0.961, + "volumes": [ + { + "name": "name_value", + "volume_type": "volume_type_value", + "size_gb": 0.739, + } + ], + "kms_key_reference": "kms_key_reference_value", + }, + "runtime": "runtime_value", + "runtime_channel": "runtime_channel_value", + "threadsafe": True, + "vm": True, + "app_engine_apis": True, + "beta_settings": {}, + "env": "env_value", + "serving_status": 1, + "created_by": "created_by_value", + "create_time": {"seconds": 751, "nanos": 543}, + "disk_usage_bytes": 1701, + "runtime_api_version": "runtime_api_version_value", + "runtime_main_executable_path": "runtime_main_executable_path_value", + "service_account": "service_account_value", + "handlers": [ + { + "url_regex": "url_regex_value", + "static_files": { + "path": "path_value", + "upload_path_regex": "upload_path_regex_value", + "http_headers": {}, + "mime_type": "mime_type_value", + "expiration": {}, + "require_matching_file": True, + "application_readable": True, + }, + "script": {"script_path": "script_path_value"}, + "api_endpoint": {"script_path": "script_path_value"}, + "security_level": 1, + "login": 1, + "auth_fail_action": 1, + "redirect_http_response_code": 1, + } + ], + "error_handlers": [ + { + "error_code": 1, + "static_file": "static_file_value", + "mime_type": "mime_type_value", + } + ], + "libraries": [{"name": "name_value", "version": "version_value"}], + "api_config": { + "auth_fail_action": 1, + "login": 1, + "script": "script_value", + "security_level": 1, + "url": "url_value", + }, + "env_variables": {}, + "build_env_variables": {}, + "default_expiration": {}, + "health_check": { + "disable_health_check": True, + "host": "host_value", + "healthy_threshold": 1819, + "unhealthy_threshold": 2046, + "restart_threshold": 1841, + "check_interval": {}, + "timeout": {}, + }, + "readiness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "app_start_timeout": {}, + }, + "liveness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "initial_delay": {}, + }, + "nobuild_files_regex": "nobuild_files_regex_value", + "deployment": { + "files": {}, + "container": {"image": "image_value"}, + "zip_": {"source_url": "source_url_value", "files_count": 1179}, + "cloud_build_options": { + "app_yaml_path": "app_yaml_path_value", + "cloud_build_timeout": {}, + }, + }, + "version_url": "version_url_value", + "endpoints_api_service": { + "name": "name_value", + "config_id": "config_id_value", + "rollout_strategy": 1, + "disable_trace_sampling": True, + }, + "entrypoint": {"shell": "shell_value"}, + "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_version(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_version_rest_interceptors(null_interceptor): + transport = transports.VersionsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), + ) + client = VersionsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.VersionsRestInterceptor, "post_update_version" + ) as post, mock.patch.object( + transports.VersionsRestInterceptor, "pre_update_version" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.UpdateVersionRequest.pb(appengine.UpdateVersionRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.UpdateVersionRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.update_version( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_version_rest_bad_request( + transport: str = "rest", request_type=appengine.UpdateVersionRequest +): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} + request_init["version"] = { + "name": "name_value", + "id": "id_value", + "automatic_scaling": { + "cool_down_period": {"seconds": 751, "nanos": 543}, + "cpu_utilization": { + "aggregation_window_length": {}, + "target_utilization": 0.19540000000000002, + }, + "max_concurrent_requests": 2499, + "max_idle_instances": 1898, + "max_total_instances": 2032, + "max_pending_latency": {}, + "min_idle_instances": 1896, + "min_total_instances": 2030, + "min_pending_latency": {}, + "request_utilization": { + "target_request_count_per_second": 3320, + "target_concurrent_requests": 2820, + }, + "disk_utilization": { + "target_write_bytes_per_second": 3096, + "target_write_ops_per_second": 2883, + "target_read_bytes_per_second": 2953, + "target_read_ops_per_second": 2740, + }, + "network_utilization": { + "target_sent_bytes_per_second": 2983, + "target_sent_packets_per_second": 3179, + "target_received_bytes_per_second": 3380, + "target_received_packets_per_second": 3576, + }, + "standard_scheduler_settings": { + "target_cpu_utilization": 0.23770000000000002, + "target_throughput_utilization": 0.3163, + "min_instances": 1387, + "max_instances": 1389, + }, + }, + "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, + "manual_scaling": {"instances": 968}, + "inbound_services": [1], + "instance_class": "instance_class_value", + "network": { + "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], + "instance_tag": "instance_tag_value", + "name": "name_value", + "subnetwork_name": "subnetwork_name_value", + "session_affinity": True, + }, + "zones": ["zones_value1", "zones_value2"], + "resources": { + "cpu": 0.328, + "disk_gb": 0.723, + "memory_gb": 0.961, + "volumes": [ + { + "name": "name_value", + "volume_type": "volume_type_value", + "size_gb": 0.739, + } + ], + "kms_key_reference": "kms_key_reference_value", + }, + "runtime": "runtime_value", + "runtime_channel": "runtime_channel_value", + "threadsafe": True, + "vm": True, + "app_engine_apis": True, + "beta_settings": {}, + "env": "env_value", + "serving_status": 1, + "created_by": "created_by_value", + "create_time": {"seconds": 751, "nanos": 543}, + "disk_usage_bytes": 1701, + "runtime_api_version": "runtime_api_version_value", + "runtime_main_executable_path": "runtime_main_executable_path_value", + "service_account": "service_account_value", + "handlers": [ + { + "url_regex": "url_regex_value", + "static_files": { + "path": "path_value", + "upload_path_regex": "upload_path_regex_value", + "http_headers": {}, + "mime_type": "mime_type_value", + "expiration": {}, + "require_matching_file": True, + "application_readable": True, + }, + "script": {"script_path": "script_path_value"}, + "api_endpoint": {"script_path": "script_path_value"}, + "security_level": 1, + "login": 1, + "auth_fail_action": 1, + "redirect_http_response_code": 1, + } + ], + "error_handlers": [ + { + "error_code": 1, + "static_file": "static_file_value", + "mime_type": "mime_type_value", + } + ], + "libraries": [{"name": "name_value", "version": "version_value"}], + "api_config": { + "auth_fail_action": 1, + "login": 1, + "script": "script_value", + "security_level": 1, + "url": "url_value", + }, + "env_variables": {}, + "build_env_variables": {}, + "default_expiration": {}, + "health_check": { + "disable_health_check": True, + "host": "host_value", + "healthy_threshold": 1819, + "unhealthy_threshold": 2046, + "restart_threshold": 1841, + "check_interval": {}, + "timeout": {}, + }, + "readiness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "app_start_timeout": {}, + }, + "liveness_check": { + "path": "path_value", + "host": "host_value", + "failure_threshold": 1812, + "success_threshold": 1829, + "check_interval": {}, + "timeout": {}, + "initial_delay": {}, + }, + "nobuild_files_regex": "nobuild_files_regex_value", + "deployment": { + "files": {}, + "container": {"image": "image_value"}, + "zip_": {"source_url": "source_url_value", "files_count": 1179}, + "cloud_build_options": { + "app_yaml_path": "app_yaml_path_value", + "cloud_build_timeout": {}, + }, + }, + "version_url": "version_url_value", + "endpoints_api_service": { + "name": "name_value", + "config_id": "config_id_value", + "rollout_strategy": 1, + "disable_trace_sampling": True, + }, + "entrypoint": {"shell": "shell_value"}, + "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_version(request) + + +def test_update_version_rest_error(): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteVersionRequest, + dict, + ], +) +def test_delete_version_rest(request_type): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = operations_pb2.Operation(name="operations/spam") + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_version(request) + + # Establish that the response is the type that we expect. + assert response.operation.name == "operations/spam" + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_version_rest_interceptors(null_interceptor): + transport = transports.VersionsRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), + ) + client = VersionsClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + operation.Operation, "_set_result_from_operation" + ), mock.patch.object( + transports.VersionsRestInterceptor, "post_delete_version" + ) as post, mock.patch.object( + transports.VersionsRestInterceptor, "pre_delete_version" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = appengine.DeleteVersionRequest.pb(appengine.DeleteVersionRequest()) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = json_format.MessageToJson( + operations_pb2.Operation() + ) + + request = appengine.DeleteVersionRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = operations_pb2.Operation() + + client.delete_version( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_delete_version_rest_bad_request( + transport: str = "rest", request_type=appengine.DeleteVersionRequest +): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_version(request) + + +def test_delete_version_rest_error(): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.VersionsGrpcTransport( @@ -1743,6 +3115,7 @@ def test_transport_get_channel(): [ transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport, + transports.VersionsRestTransport, ], ) def test_transport_adc(transport_class): @@ -1757,6 +3130,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -1907,6 +3281,7 @@ def test_versions_transport_auth_adc(transport_class): [ transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport, + transports.VersionsRestTransport, ], ) def test_versions_transport_auth_gdch_credentials(transport_class): @@ -2005,11 +3380,40 @@ def test_versions_grpc_transport_client_cert_source_for_mtls(transport_class): ) +def test_versions_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.VersionsRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + +def test_versions_rest_lro_client(): + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.AbstractOperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_versions_host_no_port(transport_name): @@ -2020,7 +3424,11 @@ def test_versions_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:443") + assert client.transport._host == ( + "appengine.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com" + ) @pytest.mark.parametrize( @@ -2028,6 +3436,7 @@ def test_versions_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_versions_host_with_port(transport_name): @@ -2038,7 +3447,45 @@ def test_versions_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("appengine.googleapis.com:8000") + assert client.transport._host == ( + "appengine.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://appengine.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_versions_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = VersionsClient( + credentials=creds1, + transport=transport_name, + ) + client2 = VersionsClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_versions._session + session2 = client2.transport.list_versions._session + assert session1 != session2 + session1 = client1.transport.get_version._session + session2 = client2.transport.get_version._session + assert session1 != session2 + session1 = client1.transport.create_version._session + session2 = client2.transport.create_version._session + assert session1 != session2 + session1 = client1.transport.update_version._session + session2 = client2.transport.update_version._session + assert session1 != session2 + session1 = client1.transport.delete_version._session + session2 = client2.transport.delete_version._session + assert session1 != session2 def test_versions_grpc_transport_channel(): @@ -2335,6 +3782,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2352,6 +3800,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: From 97df6f207cb2e928d2ab3a52cf0508bdf47f2cf6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 17 Feb 2023 08:49:00 -0500 Subject: [PATCH 44/73] chore: Add service_yaml_parameters to py_gapic_library BUILD.bazel targets (#226) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Add service_yaml_parameters to py_gapic_library BUILD.bazel targets PiperOrigin-RevId: 510187992 Source-Link: https://github.com/googleapis/googleapis/commit/5edc23561778df80d5293f20132765f8757a6b2c Source-Link: https://github.com/googleapis/googleapis-gen/commit/b0bedb72e4765a3e0b674a28c50ea0f9a9b26a89 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBiZWRiNzJlNDc2NWEzZTBiNjc0YTI4YzUwZWEwZjlhOWIyNmE4OSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../services/applications/transports/rest.py | 15 ++++++++++++++- .../services/domain_mappings/transports/rest.py | 15 ++++++++++++++- .../services/instances/transports/rest.py | 15 ++++++++++++++- .../services/services/transports/rest.py | 15 ++++++++++++++- .../services/versions/transports/rest.py | 15 ++++++++++++++- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py index 8ee3048..2472a9b 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py @@ -308,7 +308,20 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: """ # Only create a new client if we do not already have one. if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = {} + http_options: Dict[str, List[Dict[str, str]]] = { + "google.longrunning.Operations.GetOperation": [ + { + "method": "get", + "uri": "/v1/{name=apps/*/operations/*}", + }, + ], + "google.longrunning.Operations.ListOperations": [ + { + "method": "get", + "uri": "/v1/{name=apps/*}/operations", + }, + ], + } rest_transport = operations_v1.OperationsRestTransport( host=self._host, diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py index c5a1a81..cb14815 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py @@ -339,7 +339,20 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: """ # Only create a new client if we do not already have one. if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = {} + http_options: Dict[str, List[Dict[str, str]]] = { + "google.longrunning.Operations.GetOperation": [ + { + "method": "get", + "uri": "/v1/{name=apps/*/operations/*}", + }, + ], + "google.longrunning.Operations.ListOperations": [ + { + "method": "get", + "uri": "/v1/{name=apps/*}/operations", + }, + ], + } rest_transport = operations_v1.OperationsRestTransport( host=self._host, diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py index 6822b9c..eb38f47 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py @@ -304,7 +304,20 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: """ # Only create a new client if we do not already have one. if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = {} + http_options: Dict[str, List[Dict[str, str]]] = { + "google.longrunning.Operations.GetOperation": [ + { + "method": "get", + "uri": "/v1/{name=apps/*/operations/*}", + }, + ], + "google.longrunning.Operations.ListOperations": [ + { + "method": "get", + "uri": "/v1/{name=apps/*}/operations", + }, + ], + } rest_transport = operations_v1.OperationsRestTransport( host=self._host, diff --git a/google/cloud/appengine_admin_v1/services/services/transports/rest.py b/google/cloud/appengine_admin_v1/services/services/transports/rest.py index e8d3814..1489a31 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/rest.py @@ -304,7 +304,20 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: """ # Only create a new client if we do not already have one. if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = {} + http_options: Dict[str, List[Dict[str, str]]] = { + "google.longrunning.Operations.GetOperation": [ + { + "method": "get", + "uri": "/v1/{name=apps/*/operations/*}", + }, + ], + "google.longrunning.Operations.ListOperations": [ + { + "method": "get", + "uri": "/v1/{name=apps/*}/operations", + }, + ], + } rest_transport = operations_v1.OperationsRestTransport( host=self._host, diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py index fd62126..f5cf14e 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py @@ -335,7 +335,20 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: """ # Only create a new client if we do not already have one. if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = {} + http_options: Dict[str, List[Dict[str, str]]] = { + "google.longrunning.Operations.GetOperation": [ + { + "method": "get", + "uri": "/v1/{name=apps/*/operations/*}", + }, + ], + "google.longrunning.Operations.ListOperations": [ + { + "method": "get", + "uri": "/v1/{name=apps/*}/operations", + }, + ], + } rest_transport = operations_v1.OperationsRestTransport( host=self._host, From f147f45def3633002f40318767ca66caae10941e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 16:18:45 +0000 Subject: [PATCH 45/73] chore(python): upgrade gcp-releasetool in .kokoro [autoapprove] (#228) Source-Link: https://togithub.com/googleapis/synthtool/commit/5f2a6089f73abf06238fe4310f6a14d6f6d1eed3 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8555f0e37e6261408f792bfd6635102d2da5ad73f8f09bcb24f25e6afb5fac97 --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.in | 2 +- .kokoro/requirements.txt | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 894fb6b..5fc5daa 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf + digest: sha256:8555f0e37e6261408f792bfd6635102d2da5ad73f8f09bcb24f25e6afb5fac97 diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in index cbd7e77..882178c 100644 --- a/.kokoro/requirements.in +++ b/.kokoro/requirements.in @@ -1,5 +1,5 @@ gcp-docuploader -gcp-releasetool +gcp-releasetool>=1.10.5 # required for compatibility with cryptography>=39.x importlib-metadata typing-extensions twine diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 096e480..fa99c12 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -154,9 +154,9 @@ gcp-docuploader==0.6.4 \ --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf # via -r requirements.in -gcp-releasetool==1.10.0 \ - --hash=sha256:72a38ca91b59c24f7e699e9227c90cbe4dd71b789383cb0164b088abae294c83 \ - --hash=sha256:8c7c99320208383d4bb2b808c6880eb7a81424afe7cdba3c8d84b25f4f0e097d +gcp-releasetool==1.10.5 \ + --hash=sha256:174b7b102d704b254f2a26a3eda2c684fd3543320ec239baf771542a2e58e109 \ + --hash=sha256:e29d29927fe2ca493105a82958c6873bb2b90d503acac56be2c229e74de0eec9 # via -r requirements.in google-api-core==2.10.2 \ --hash=sha256:10c06f7739fe57781f87523375e8e1a3a4674bf6392cd6131a3222182b971320 \ From 72d08181693f85d601e3e1a3e80d62b3996397f6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 11:42:26 -0500 Subject: [PATCH 46/73] chore: Update gapic-generator-python to v1.8.5 (#227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.8.5 PiperOrigin-RevId: 511892190 Source-Link: https://github.com/googleapis/googleapis/commit/a45d9c09c1287ffdf938f4e8083e791046c0b23b Source-Link: https://github.com/googleapis/googleapis-gen/commit/1907294b1d8365ea24f8c5f2e059a64124c4ed3b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTkwNzI5NGIxZDgzNjVlYTI0ZjhjNWYyZTA1OWE2NDEyNGM0ZWQzYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../appengine_admin_v1/services/applications/transports/rest.py | 2 +- .../services/authorized_certificates/transports/rest.py | 2 +- .../services/authorized_domains/transports/rest.py | 2 +- .../services/domain_mappings/transports/rest.py | 2 +- .../appengine_admin_v1/services/firewall/transports/rest.py | 2 +- .../appengine_admin_v1/services/instances/transports/rest.py | 2 +- .../appengine_admin_v1/services/services/transports/rest.py | 2 +- .../appengine_admin_v1/services/versions/transports/rest.py | 2 +- google/cloud/appengine_admin_v1/types/app_yaml.py | 2 ++ google/cloud/appengine_admin_v1/types/appengine.py | 2 ++ google/cloud/appengine_admin_v1/types/application.py | 2 ++ google/cloud/appengine_admin_v1/types/audit_data.py | 2 ++ google/cloud/appengine_admin_v1/types/certificate.py | 2 ++ google/cloud/appengine_admin_v1/types/deploy.py | 2 ++ google/cloud/appengine_admin_v1/types/deployed_files.py | 2 +- google/cloud/appengine_admin_v1/types/domain.py | 2 ++ google/cloud/appengine_admin_v1/types/domain_mapping.py | 2 ++ google/cloud/appengine_admin_v1/types/firewall.py | 2 ++ google/cloud/appengine_admin_v1/types/instance.py | 2 ++ google/cloud/appengine_admin_v1/types/location.py | 2 ++ google/cloud/appengine_admin_v1/types/network_settings.py | 2 ++ google/cloud/appengine_admin_v1/types/operation.py | 2 ++ google/cloud/appengine_admin_v1/types/service.py | 2 ++ google/cloud/appengine_admin_v1/types/version.py | 2 ++ 24 files changed, 39 insertions(+), 9 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py index 2472a9b..3259f25 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import ( diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py index 31d05e8..f7f162e 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py index f5adcbf..d08506a 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py index cb14815..544e4fb 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import ( diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py index c11db17..047c980 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py index eb38f47..dd1ecf4 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import ( diff --git a/google/cloud/appengine_admin_v1/services/services/transports/rest.py b/google/cloud/appengine_admin_v1/services/services/transports/rest.py index 1489a31..d627e8a 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import ( diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py index f5cf14e..0157db5 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py @@ -17,7 +17,7 @@ import dataclasses import json # type: ignore import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings from google.api_core import ( diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 9384f6e..9387b98 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import duration_pb2 # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index 28ceb53..f5ba7d5 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import field_mask_pb2 # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index d50a6c0..f9d5c55 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import duration_pb2 # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index 06c4a06..bc937a6 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index 3424a63..db119c6 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index c17f74c..7200ff4 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import duration_pb2 # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/deployed_files.py b/google/cloud/appengine_admin_v1/types/deployed_files.py index e127548..c11a0ad 100644 --- a/google/cloud/appengine_admin_v1/types/deployed_files.py +++ b/google/cloud/appengine_admin_v1/types/deployed_files.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +import proto # type: ignore __protobuf__ = proto.module( package="google.appengine.v1", diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py index 668a5dc..c0006a9 100644 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ b/google/cloud/appengine_admin_v1/types/domain.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index 5007c5a..7af44dc 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py index 9c049dc..d22a04a 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index 37bf282..4ea61e1 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/location.py b/google/cloud/appengine_admin_v1/types/location.py index ad3c5e2..84f925e 100644 --- a/google/cloud/appengine_admin_v1/types/location.py +++ b/google/cloud/appengine_admin_v1/types/location.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/network_settings.py b/google/cloud/appengine_admin_v1/types/network_settings.py index f47ece3..47d9ad3 100644 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ b/google/cloud/appengine_admin_v1/types/network_settings.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py index 9a9a712..26baf33 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index 1da091b..6cbcff4 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 7b5946d..4841759 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import duration_pb2 # type: ignore From 180aa367aeb6fde676bf07e9a6bcc76371ed85ef Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 18:51:35 -0500 Subject: [PATCH 47/73] chore(main): release 1.9.0 (#225) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Victor Chudnovsky --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7840fde..4fcfdf7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.1" + ".": "1.9.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c9c677..6011748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.9.0](https://github.com/googleapis/python-appengine-admin/compare/v1.8.1...v1.9.0) (2023-02-27) + + +### Features + +* Enable "rest" transport in Python for services supporting numeric enums ([#224](https://github.com/googleapis/python-appengine-admin/issues/224)) ([819631a](https://github.com/googleapis/python-appengine-admin/commit/819631abc6b95d3d40d1772f74dac62300f4616f)) + ## [1.8.1](https://github.com/googleapis/python-appengine-admin/compare/v1.8.0...v1.8.1) (2023-01-20) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index 90e0293..163d151 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.1" # {x-release-please-version} +__version__ = "1.9.0" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index 90e0293..163d151 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.1" # {x-release-please-version} +__version__ = "1.9.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..ef36d09 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.9.0" }, "snippets": [ { From 8dc8396fabcbca881c6580d4a357fa9af65f08f0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 11:34:19 +0000 Subject: [PATCH 48/73] chore(deps): Update nox in .kokoro/requirements.in [autoapprove] (#229) Source-Link: https://togithub.com/googleapis/synthtool/commit/92006bb3cdc84677aa93c7f5235424ec2b157146 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2e247c7bf5154df7f98cce087a20ca7605e236340c7d6d1a14447e5c06791bd6 --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.in | 2 +- .kokoro/requirements.txt | 14 +++++--------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 5fc5daa..b8edda5 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8555f0e37e6261408f792bfd6635102d2da5ad73f8f09bcb24f25e6afb5fac97 + digest: sha256:2e247c7bf5154df7f98cce087a20ca7605e236340c7d6d1a14447e5c06791bd6 diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in index 882178c..ec867d9 100644 --- a/.kokoro/requirements.in +++ b/.kokoro/requirements.in @@ -5,6 +5,6 @@ typing-extensions twine wheel setuptools -nox +nox>=2022.11.21 # required to remove dependency on py charset-normalizer<3 click<8.1.0 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index fa99c12..66a2172 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -1,6 +1,6 @@ # -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # # pip-compile --allow-unsafe --generate-hashes requirements.in # @@ -335,9 +335,9 @@ more-itertools==9.0.0 \ --hash=sha256:250e83d7e81d0c87ca6bd942e6aeab8cc9daa6096d12c5308f3f92fa5e5c1f41 \ --hash=sha256:5a6257e40878ef0520b1803990e3e22303a41b5714006c32a3fd8304b26ea1ab # via jaraco-classes -nox==2022.8.7 \ - --hash=sha256:1b894940551dc5c389f9271d197ca5d655d40bdc6ccf93ed6880e4042760a34b \ - --hash=sha256:96cca88779e08282a699d672258ec01eb7c792d35bbbf538c723172bce23212c +nox==2022.11.21 \ + --hash=sha256:0e41a990e290e274cb205a976c4c97ee3c5234441a8132c8c3fd9ea3c22149eb \ + --hash=sha256:e21c31de0711d1274ca585a2c5fde36b1aa962005ba8e9322bf5eeed16dcd684 # via -r requirements.in packaging==21.3 \ --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ @@ -380,10 +380,6 @@ protobuf==3.20.3 \ # gcp-docuploader # gcp-releasetool # google-api-core -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via nox pyasn1==0.4.8 \ --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba From 7738bed39a867311611a57f7da9e2cd48d58f7c3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 09:18:48 -0400 Subject: [PATCH 49/73] docs: Fix formatting of request arg in docstring (#230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Fix formatting of request arg in docstring chore: Update gapic-generator-python to v1.9.1 PiperOrigin-RevId: 518604533 Source-Link: https://github.com/googleapis/googleapis/commit/8a085aeddfa010af5bcef090827aac5255383d7e Source-Link: https://github.com/googleapis/googleapis-gen/commit/b2ab4b0a0ae2907e812c209198a74e0898afcb04 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../services/applications/async_client.py | 9 +++------ .../services/applications/client.py | 9 +++------ .../services/applications/transports/rest.py | 1 - .../authorized_certificates/async_client.py | 10 +++++----- .../services/authorized_certificates/client.py | 10 +++++----- .../authorized_certificates/transports/rest.py | 5 ----- .../services/authorized_domains/async_client.py | 2 +- .../services/authorized_domains/client.py | 2 +- .../authorized_domains/transports/rest.py | 1 - .../services/domain_mappings/async_client.py | 11 +++++------ .../services/domain_mappings/client.py | 11 +++++------ .../services/domain_mappings/transports/rest.py | 4 ---- .../services/firewall/async_client.py | 17 ++++++----------- .../services/firewall/client.py | 17 ++++++----------- .../services/firewall/transports/rest.py | 1 - .../services/instances/async_client.py | 12 ++++-------- .../services/instances/client.py | 12 ++++-------- .../services/services/async_client.py | 12 ++++-------- .../services/services/client.py | 12 ++++-------- .../services/versions/async_client.py | 15 +++++---------- .../services/versions/client.py | 15 +++++---------- .../snippet_metadata_google.appengine.v1.json | 2 +- 22 files changed, 67 insertions(+), 123 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index 5e9ff63..a673a09 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -250,8 +250,7 @@ async def sample_get_application(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]]): - The request object. Request message for - `Applications.GetApplication`. + The request object. Request message for ``Applications.GetApplication``. name (:class:`str`): Name of the Application resource to get. Example: ``apps/myapp``. @@ -365,8 +364,7 @@ async def sample_create_application(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]]): - The request object. Request message for - `Applications.CreateApplication`. + The request object. Request message for ``Applications.CreateApplication``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -460,8 +458,7 @@ async def sample_update_application(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]]): - The request object. Request message for - `Applications.UpdateApplication`. + The request object. Request message for ``Applications.UpdateApplication``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 8ae55a0..f0e9657 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -461,8 +461,7 @@ def sample_get_application(): Args: request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]): - The request object. Request message for - `Applications.GetApplication`. + The request object. Request message for ``Applications.GetApplication``. name (str): Name of the Application resource to get. Example: ``apps/myapp``. @@ -576,8 +575,7 @@ def sample_create_application(): Args: request (Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]): - The request object. Request message for - `Applications.CreateApplication`. + The request object. Request message for ``Applications.CreateApplication``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -672,8 +670,7 @@ def sample_update_application(): Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]): - The request object. Request message for - `Applications.UpdateApplication`. + The request object. Request message for ``Applications.UpdateApplication``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py index 3259f25..89a7310 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py @@ -522,7 +522,6 @@ def __call__( request (~.appengine.RepairApplicationRequest): The request object. Request message for 'Applications.RepairApplication'. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index a22c82f..e339462 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -262,7 +262,7 @@ async def sample_list_authorized_certificates(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]]): The request object. Request message for - `AuthorizedCertificates.ListAuthorizedCertificates`. + ``AuthorizedCertificates.ListAuthorizedCertificates``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -355,7 +355,7 @@ async def sample_get_authorized_certificate(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]]): The request object. Request message for - `AuthorizedCertificates.GetAuthorizedCertificate`. + ``AuthorizedCertificates.GetAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -439,7 +439,7 @@ async def sample_create_authorized_certificate(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]]): The request object. Request message for - `AuthorizedCertificates.CreateAuthorizedCertificate`. + ``AuthorizedCertificates.CreateAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -528,7 +528,7 @@ async def sample_update_authorized_certificate(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]]): The request object. Request message for - `AuthorizedCertificates.UpdateAuthorizedCertificate`. + ``AuthorizedCertificates.UpdateAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -609,7 +609,7 @@ async def sample_delete_authorized_certificate(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]]): The request object. Request message for - `AuthorizedCertificates.DeleteAuthorizedCertificate`. + ``AuthorizedCertificates.DeleteAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index d6a9f17..864c7b3 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -468,7 +468,7 @@ def sample_list_authorized_certificates(): Args: request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]): The request object. Request message for - `AuthorizedCertificates.ListAuthorizedCertificates`. + ``AuthorizedCertificates.ListAuthorizedCertificates``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -564,7 +564,7 @@ def sample_get_authorized_certificate(): Args: request (Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]): The request object. Request message for - `AuthorizedCertificates.GetAuthorizedCertificate`. + ``AuthorizedCertificates.GetAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -651,7 +651,7 @@ def sample_create_authorized_certificate(): Args: request (Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]): The request object. Request message for - `AuthorizedCertificates.CreateAuthorizedCertificate`. + ``AuthorizedCertificates.CreateAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -743,7 +743,7 @@ def sample_update_authorized_certificate(): Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]): The request object. Request message for - `AuthorizedCertificates.UpdateAuthorizedCertificate`. + ``AuthorizedCertificates.UpdateAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -827,7 +827,7 @@ def sample_delete_authorized_certificate(): Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): The request object. Request message for - `AuthorizedCertificates.DeleteAuthorizedCertificate`. + ``AuthorizedCertificates.DeleteAuthorizedCertificate``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py index f7f162e..a9b6f8a 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py @@ -329,7 +329,6 @@ def __call__( request (~.appengine.CreateAuthorizedCertificateRequest): The request object. Request message for ``AuthorizedCertificates.CreateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -423,7 +422,6 @@ def __call__( request (~.appengine.DeleteAuthorizedCertificateRequest): The request object. Request message for ``AuthorizedCertificates.DeleteAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -491,7 +489,6 @@ def __call__( request (~.appengine.GetAuthorizedCertificateRequest): The request object. Request message for ``AuthorizedCertificates.GetAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -576,7 +573,6 @@ def __call__( request (~.appengine.ListAuthorizedCertificatesRequest): The request object. Request message for ``AuthorizedCertificates.ListAuthorizedCertificates``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -658,7 +654,6 @@ def __call__( request (~.appengine.UpdateAuthorizedCertificateRequest): The request object. Request message for ``AuthorizedCertificates.UpdateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 4a51a6e..46b1b38 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -255,7 +255,7 @@ async def sample_list_authorized_domains(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]]): The request object. Request message for - `AuthorizedDomains.ListAuthorizedDomains`. + ``AuthorizedDomains.ListAuthorizedDomains``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index 3a6b4ed..41fc79e 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -464,7 +464,7 @@ def sample_list_authorized_domains(): Args: request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]): The request object. Request message for - `AuthorizedDomains.ListAuthorizedDomains`. + ``AuthorizedDomains.ListAuthorizedDomains``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py index d08506a..1725792 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py @@ -217,7 +217,6 @@ def __call__( request (~.appengine.ListAuthorizedDomainsRequest): The request object. Request message for ``AuthorizedDomains.ListAuthorizedDomains``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 997c978..5506996 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -256,7 +256,7 @@ async def sample_list_domain_mappings(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]]): The request object. Request message for - `DomainMappings.ListDomainMappings`. + ``DomainMappings.ListDomainMappings``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -345,8 +345,7 @@ async def sample_get_domain_mapping(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]]): - The request object. Request message for - `DomainMappings.GetDomainMapping`. + The request object. Request message for ``DomainMappings.GetDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -432,7 +431,7 @@ async def sample_create_domain_mapping(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]]): The request object. Request message for - `DomainMappings.CreateDomainMapping`. + ``DomainMappings.CreateDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -530,7 +529,7 @@ async def sample_update_domain_mapping(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]]): The request object. Request message for - `DomainMappings.UpdateDomainMapping`. + ``DomainMappings.UpdateDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -626,7 +625,7 @@ async def sample_delete_domain_mapping(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]]): The request object. Request message for - `DomainMappings.DeleteDomainMapping`. + ``DomainMappings.DeleteDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index d2a2e17..60459b2 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -465,7 +465,7 @@ def sample_list_domain_mappings(): Args: request (Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]): The request object. Request message for - `DomainMappings.ListDomainMappings`. + ``DomainMappings.ListDomainMappings``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -555,8 +555,7 @@ def sample_get_domain_mapping(): Args: request (Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]): - The request object. Request message for - `DomainMappings.GetDomainMapping`. + The request object. Request message for ``DomainMappings.GetDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -643,7 +642,7 @@ def sample_create_domain_mapping(): Args: request (Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]): The request object. Request message for - `DomainMappings.CreateDomainMapping`. + ``DomainMappings.CreateDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -742,7 +741,7 @@ def sample_update_domain_mapping(): Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]): The request object. Request message for - `DomainMappings.UpdateDomainMapping`. + ``DomainMappings.UpdateDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -839,7 +838,7 @@ def sample_delete_domain_mapping(): Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]): The request object. Request message for - `DomainMappings.DeleteDomainMapping`. + ``DomainMappings.DeleteDomainMapping``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py index 544e4fb..8097876 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py @@ -388,7 +388,6 @@ def __call__( request (~.appengine.CreateDomainMappingRequest): The request object. Request message for ``DomainMappings.CreateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -477,7 +476,6 @@ def __call__( request (~.appengine.DeleteDomainMappingRequest): The request object. Request message for ``DomainMappings.DeleteDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -636,7 +634,6 @@ def __call__( request (~.appengine.ListDomainMappingsRequest): The request object. Request message for ``DomainMappings.ListDomainMappings``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -717,7 +714,6 @@ def __call__( request (~.appengine.UpdateDomainMappingRequest): The request object. Request message for ``DomainMappings.UpdateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index 67c3e98..46ec58d 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -253,8 +253,7 @@ async def sample_list_ingress_rules(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]]): - The request object. Request message for - `Firewall.ListIngressRules`. + The request object. Request message for ``Firewall.ListIngressRules``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -350,7 +349,7 @@ async def sample_batch_update_ingress_rules(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]]): The request object. Request message for - `Firewall.BatchUpdateIngressRules`. + ``Firewall.BatchUpdateIngressRules``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -426,8 +425,7 @@ async def sample_create_ingress_rule(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]]): - The request object. Request message for - `Firewall.CreateIngressRule`. + The request object. Request message for ``Firewall.CreateIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -507,8 +505,7 @@ async def sample_get_ingress_rule(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]]): - The request object. Request message for - `Firewall.GetIngressRule`. + The request object. Request message for ``Firewall.GetIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -588,8 +585,7 @@ async def sample_update_ingress_rule(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]]): - The request object. Request message for - `Firewall.UpdateIngressRule`. + The request object. Request message for ``Firewall.UpdateIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -666,8 +662,7 @@ async def sample_delete_ingress_rule(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]]): - The request object. Request message for - `Firewall.DeleteIngressRule`. + The request object. Request message for ``Firewall.DeleteIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 2bc056a..4cd34ec 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -468,8 +468,7 @@ def sample_list_ingress_rules(): Args: request (Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]): - The request object. Request message for - `Firewall.ListIngressRules`. + The request object. Request message for ``Firewall.ListIngressRules``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -566,7 +565,7 @@ def sample_batch_update_ingress_rules(): Args: request (Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]): The request object. Request message for - `Firewall.BatchUpdateIngressRules`. + ``Firewall.BatchUpdateIngressRules``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -645,8 +644,7 @@ def sample_create_ingress_rule(): Args: request (Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]): - The request object. Request message for - `Firewall.CreateIngressRule`. + The request object. Request message for ``Firewall.CreateIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -727,8 +725,7 @@ def sample_get_ingress_rule(): Args: request (Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]): - The request object. Request message for - `Firewall.GetIngressRule`. + The request object. Request message for ``Firewall.GetIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -809,8 +806,7 @@ def sample_update_ingress_rule(): Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]): - The request object. Request message for - `Firewall.UpdateIngressRule`. + The request object. Request message for ``Firewall.UpdateIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -888,8 +884,7 @@ def sample_delete_ingress_rule(): Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): - The request object. Request message for - `Firewall.DeleteIngressRule`. + The request object. Request message for ``Firewall.DeleteIngressRule``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py index 047c980..bb365f5 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py @@ -368,7 +368,6 @@ def __call__( request (~.appengine.BatchUpdateIngressRulesRequest): The request object. Request message for ``Firewall.BatchUpdateIngressRules``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 0d7291d..601d57a 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -256,8 +256,7 @@ async def sample_list_instances(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]]): - The request object. Request message for - `Instances.ListInstances`. + The request object. Request message for ``Instances.ListInstances``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -346,8 +345,7 @@ async def sample_get_instance(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]]): - The request object. Request message for - `Instances.GetInstance`. + The request object. Request message for ``Instances.GetInstance``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -444,8 +442,7 @@ async def sample_delete_instance(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]]): - The request object. Request message for - `Instances.DeleteInstance`. + The request object. Request message for ``Instances.DeleteInstance``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -554,8 +551,7 @@ async def sample_debug_instance(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]]): - The request object. Request message for - `Instances.DebugInstance`. + The request object. Request message for ``Instances.DebugInstance``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 7cc1120..9bf7c9f 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -491,8 +491,7 @@ def sample_list_instances(): Args: request (Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]): - The request object. Request message for - `Instances.ListInstances`. + The request object. Request message for ``Instances.ListInstances``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -582,8 +581,7 @@ def sample_get_instance(): Args: request (Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]): - The request object. Request message for - `Instances.GetInstance`. + The request object. Request message for ``Instances.GetInstance``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -681,8 +679,7 @@ def sample_delete_instance(): Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]): - The request object. Request message for - `Instances.DeleteInstance`. + The request object. Request message for ``Instances.DeleteInstance``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -792,8 +789,7 @@ def sample_debug_instance(): Args: request (Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]): - The request object. Request message for - `Instances.DebugInstance`. + The request object. Request message for ``Instances.DebugInstance``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 019c831..985ebce 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -248,8 +248,7 @@ async def sample_list_services(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]]): - The request object. Request message for - `Services.ListServices`. + The request object. Request message for ``Services.ListServices``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -339,8 +338,7 @@ async def sample_get_service(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]]): - The request object. Request message for - `Services.GetService`. + The request object. Request message for ``Services.GetService``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -432,8 +430,7 @@ async def sample_update_service(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]]): - The request object. Request message for - `Services.UpdateService`. + The request object. Request message for ``Services.UpdateService``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -533,8 +530,7 @@ async def sample_delete_service(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]]): - The request object. Request message for - `Services.DeleteService`. + The request object. Request message for ``Services.DeleteService``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 24562ea..2f8c08b 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -463,8 +463,7 @@ def sample_list_services(): Args: request (Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]): - The request object. Request message for - `Services.ListServices`. + The request object. Request message for ``Services.ListServices``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -555,8 +554,7 @@ def sample_get_service(): Args: request (Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]): - The request object. Request message for - `Services.GetService`. + The request object. Request message for ``Services.GetService``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -649,8 +647,7 @@ def sample_update_service(): Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]): - The request object. Request message for - `Services.UpdateService`. + The request object. Request message for ``Services.UpdateService``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -751,8 +748,7 @@ def sample_delete_service(): Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]): - The request object. Request message for - `Services.DeleteService`. + The request object. Request message for ``Services.DeleteService``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index 8fb0116..1459f0e 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -250,8 +250,7 @@ async def sample_list_versions(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]]): - The request object. Request message for - `Versions.ListVersions`. + The request object. Request message for ``Versions.ListVersions``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -342,8 +341,7 @@ async def sample_get_version(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]]): - The request object. Request message for - `Versions.GetVersion`. + The request object. Request message for ``Versions.GetVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -426,8 +424,7 @@ async def sample_create_version(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]]): - The request object. Request message for - `Versions.CreateVersion`. + The request object. Request message for ``Versions.CreateVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -554,8 +551,7 @@ async def sample_update_version(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]]): - The request object. Request message for - `Versions.UpdateVersion`. + The request object. Request message for ``Versions.UpdateVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -647,8 +643,7 @@ async def sample_delete_version(): Args: request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]]): - The request object. Request message for - `Versions.DeleteVersion`. + The request object. Request message for ``Versions.DeleteVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 48d71ea..287d324 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -465,8 +465,7 @@ def sample_list_versions(): Args: request (Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]): - The request object. Request message for - `Versions.ListVersions`. + The request object. Request message for ``Versions.ListVersions``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -558,8 +557,7 @@ def sample_get_version(): Args: request (Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]): - The request object. Request message for - `Versions.GetVersion`. + The request object. Request message for ``Versions.GetVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -643,8 +641,7 @@ def sample_create_version(): Args: request (Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]): - The request object. Request message for - `Versions.CreateVersion`. + The request object. Request message for ``Versions.CreateVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -772,8 +769,7 @@ def sample_update_version(): Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]): - The request object. Request message for - `Versions.UpdateVersion`. + The request object. Request message for ``Versions.UpdateVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -866,8 +862,7 @@ def sample_delete_version(): Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]): - The request object. Request message for - `Versions.DeleteVersion`. + The request object. Request message for ``Versions.DeleteVersion``. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index ef36d09..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.9.0" + "version": "0.1.0" }, "snippets": [ { From bf6c9446998457676e3a24fefee08f607613c583 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 10:52:01 -0400 Subject: [PATCH 50/73] chore(main): release 1.9.1 (#231) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4fcfdf7..2b6f978 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.0" + ".": "1.9.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6011748..10f0a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.9.1](https://github.com/googleapis/python-appengine-admin/compare/v1.9.0...v1.9.1) (2023-03-23) + + +### Documentation + +* Fix formatting of request arg in docstring ([#230](https://github.com/googleapis/python-appengine-admin/issues/230)) ([7738bed](https://github.com/googleapis/python-appengine-admin/commit/7738bed39a867311611a57f7da9e2cd48d58f7c3)) + ## [1.9.0](https://github.com/googleapis/python-appengine-admin/compare/v1.8.1...v1.9.0) (2023-02-27) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index 163d151..13f1b4a 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.0" # {x-release-please-version} +__version__ = "1.9.1" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index 163d151..13f1b4a 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.0" # {x-release-please-version} +__version__ = "1.9.1" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..0f3f3c0 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.9.1" }, "snippets": [ { From a45eff96750e74230f60e312b2ab0ad9b9933ec5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 1 Apr 2023 06:41:05 -0400 Subject: [PATCH 51/73] docs: point to Search Console for domain ownership verification (#232) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: point to Search Console for domain ownership verification PiperOrigin-RevId: 521027761 Source-Link: https://github.com/googleapis/googleapis/commit/e6b9d2d7c7ec14879efa60ef72cdfce2b1d102f3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6ae4a2cd04afc01224346b39c19a3cb4efa43fb3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmFlNGEyY2QwNGFmYzAxMjI0MzQ2YjM5YzE5YTNjYjRlZmE0M2ZiMyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- google/cloud/appengine_admin_v1/types/domain.py | 4 ++-- .../snippet_metadata_google.appengine.v1.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py index c0006a9..4e21290 100644 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ b/google/cloud/appengine_admin_v1/types/domain.py @@ -29,8 +29,8 @@ class AuthorizedDomain(proto.Message): r"""A domain that a user has been authorized to administer. To authorize - use of a domain, verify ownership via `Webmaster - Central `__. + use of a domain, verify ownership via `Search + Console `__. Attributes: name (str): diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index 0f3f3c0..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.9.1" + "version": "0.1.0" }, "snippets": [ { From 3b62a31e7e448f69def0b7b8e18edd7a94ddb542 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 09:54:07 -0400 Subject: [PATCH 52/73] chore(main): release 1.9.2 (#233) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2b6f978..00cbbb6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.1" + ".": "1.9.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 10f0a84..acaa15e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.9.2](https://github.com/googleapis/python-appengine-admin/compare/v1.9.1...v1.9.2) (2023-04-01) + + +### Documentation + +* Point to Search Console for domain ownership verification ([#232](https://github.com/googleapis/python-appengine-admin/issues/232)) ([a45eff9](https://github.com/googleapis/python-appengine-admin/commit/a45eff96750e74230f60e312b2ab0ad9b9933ec5)) + ## [1.9.1](https://github.com/googleapis/python-appengine-admin/compare/v1.9.0...v1.9.1) (2023-03-23) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index 13f1b4a..ab4e0f5 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.1" # {x-release-please-version} +__version__ = "1.9.2" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index 13f1b4a..ab4e0f5 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.1" # {x-release-please-version} +__version__ = "1.9.2" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..0ff5dce 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.9.2" }, "snippets": [ { From 6bdcaa55c87e3f45413f34b95e6d74d62bc79a18 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 25 May 2023 16:24:28 +0000 Subject: [PATCH 53/73] build(deps): bump requests to 2.31.0 [autoapprove] (#234) Source-Link: https://togithub.com/googleapis/synthtool/commit/30bd01b4ab78bf1b2a425816e15b3e7e090993dd Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:9bc5fa3b62b091f60614c08a7fb4fd1d3e1678e326f34dd66ce1eefb5dc3267b --- .github/.OwlBot.lock.yaml | 3 ++- .kokoro/requirements.txt | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b8edda5..32b3c48 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:2e247c7bf5154df7f98cce087a20ca7605e236340c7d6d1a14447e5c06791bd6 + digest: sha256:9bc5fa3b62b091f60614c08a7fb4fd1d3e1678e326f34dd66ce1eefb5dc3267b +# created: 2023-05-25T14:56:16.294623272Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 66a2172..3b8d7ee 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -419,9 +419,9 @@ readme-renderer==37.3 \ --hash=sha256:cd653186dfc73055656f090f227f5cb22a046d7f71a841dfa305f55c9a513273 \ --hash=sha256:f67a16caedfa71eef48a31b39708637a6f4664c4394801a7b0d6432d13907343 # via twine -requests==2.28.1 \ - --hash=sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983 \ - --hash=sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349 +requests==2.31.0 \ + --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ + --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 # via # gcp-releasetool # google-api-core From 4468f53ca1cbb5deb897a455d6182b3441807ef5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 3 Jun 2023 21:40:22 +0000 Subject: [PATCH 54/73] build(deps): bump cryptography to 41.0.0 [autoapprove] (#235) Source-Link: https://togithub.com/googleapis/synthtool/commit/d0f51a0c2a9a6bcca86911eabea9e484baadf64b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 42 +++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 32b3c48..02a4ded 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:9bc5fa3b62b091f60614c08a7fb4fd1d3e1678e326f34dd66ce1eefb5dc3267b -# created: 2023-05-25T14:56:16.294623272Z + digest: sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc +# created: 2023-06-03T21:25:37.968717478Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 3b8d7ee..c7929db 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,28 +113,26 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==39.0.1 \ - --hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \ - --hash=sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f \ - --hash=sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502 \ - --hash=sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41 \ - --hash=sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965 \ - --hash=sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e \ - --hash=sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc \ - --hash=sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad \ - --hash=sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505 \ - --hash=sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388 \ - --hash=sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6 \ - --hash=sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2 \ - --hash=sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac \ - --hash=sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695 \ - --hash=sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6 \ - --hash=sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336 \ - --hash=sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0 \ - --hash=sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c \ - --hash=sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106 \ - --hash=sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a \ - --hash=sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8 +cryptography==41.0.0 \ + --hash=sha256:0ddaee209d1cf1f180f1efa338a68c4621154de0afaef92b89486f5f96047c55 \ + --hash=sha256:14754bcdae909d66ff24b7b5f166d69340ccc6cb15731670435efd5719294895 \ + --hash=sha256:344c6de9f8bda3c425b3a41b319522ba3208551b70c2ae00099c205f0d9fd3be \ + --hash=sha256:34d405ea69a8b34566ba3dfb0521379b210ea5d560fafedf9f800a9a94a41928 \ + --hash=sha256:3680248309d340fda9611498a5319b0193a8dbdb73586a1acf8109d06f25b92d \ + --hash=sha256:3c5ef25d060c80d6d9f7f9892e1d41bb1c79b78ce74805b8cb4aa373cb7d5ec8 \ + --hash=sha256:4ab14d567f7bbe7f1cdff1c53d5324ed4d3fc8bd17c481b395db224fb405c237 \ + --hash=sha256:5c1f7293c31ebc72163a9a0df246f890d65f66b4a40d9ec80081969ba8c78cc9 \ + --hash=sha256:6b71f64beeea341c9b4f963b48ee3b62d62d57ba93eb120e1196b31dc1025e78 \ + --hash=sha256:7d92f0248d38faa411d17f4107fc0bce0c42cae0b0ba5415505df72d751bf62d \ + --hash=sha256:8362565b3835ceacf4dc8f3b56471a2289cf51ac80946f9087e66dc283a810e0 \ + --hash=sha256:84a165379cb9d411d58ed739e4af3396e544eac190805a54ba2e0322feb55c46 \ + --hash=sha256:88ff107f211ea696455ea8d911389f6d2b276aabf3231bf72c8853d22db755c5 \ + --hash=sha256:9f65e842cb02550fac96536edb1d17f24c0a338fd84eaf582be25926e993dde4 \ + --hash=sha256:a4fc68d1c5b951cfb72dfd54702afdbbf0fb7acdc9b7dc4301bbf2225a27714d \ + --hash=sha256:b7f2f5c525a642cecad24ee8670443ba27ac1fab81bba4cc24c7b6b41f2d0c75 \ + --hash=sha256:b846d59a8d5a9ba87e2c3d757ca019fa576793e8758174d3868aecb88d6fc8eb \ + --hash=sha256:bf8fc66012ca857d62f6a347007e166ed59c0bc150cefa49f28376ebe7d992a2 \ + --hash=sha256:f5d0bf9b252f30a31664b6f64432b4730bb7038339bd18b1fafe129cfc2be9be # via # gcp-releasetool # secretstorage From 68df2230c5cad639c9aa862a79091c178088ddc5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 13:14:26 +0000 Subject: [PATCH 55/73] chore: remove pinned Sphinx version [autoapprove] (#236) Source-Link: https://togithub.com/googleapis/synthtool/commit/909573ce9da2819eeb835909c795d29aea5c724e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ddf4551385d566771dc713090feb7b4c1164fb8a698fe52bbe7670b24236565b --- .github/.OwlBot.lock.yaml | 4 ++-- noxfile.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 02a4ded..1b3cb6c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc -# created: 2023-06-03T21:25:37.968717478Z + digest: sha256:ddf4551385d566771dc713090feb7b4c1164fb8a698fe52bbe7670b24236565b +# created: 2023-06-27T13:04:21.96690344Z diff --git a/noxfile.py b/noxfile.py index 95e58c5..6b57c24 100644 --- a/noxfile.py +++ b/noxfile.py @@ -305,10 +305,9 @@ def docfx(session): session.install("-e", ".") session.install( - "sphinx==4.0.1", + "gcp-sphinx-docfx-yaml", "alabaster", "recommonmark", - "gcp-sphinx-docfx-yaml", ) shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) From 3fe63cd01b123ad4697fb244c009a8df2af1f637 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 28 Jun 2023 17:32:39 +0000 Subject: [PATCH 56/73] chore: store artifacts in placer [autoapprove] (#237) Source-Link: https://togithub.com/googleapis/synthtool/commit/cb960373d12d20f8dc38beee2bf884d49627165e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2d816f26f728ac8b24248741e7d4c461c09764ef9f7be3684d557c9632e46dbd --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/release/common.cfg | 9 +++++++++ noxfile.py | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 1b3cb6c..98994f4 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ddf4551385d566771dc713090feb7b4c1164fb8a698fe52bbe7670b24236565b -# created: 2023-06-27T13:04:21.96690344Z + digest: sha256:2d816f26f728ac8b24248741e7d4c461c09764ef9f7be3684d557c9632e46dbd +# created: 2023-06-28T17:03:33.371210701Z diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index cf3a771..b5fc12c 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -38,3 +38,12 @@ env_vars: { key: "SECRET_MANAGER_KEYS" value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } + +# Store the packages we uploaded to PyPI. That way, we have a record of exactly +# what we published, which we can use to generate SBOMs and attestations. +action { + define_artifacts { + regex: "github/python-appengine-admin/**/*.tar.gz" + strip_prefix: "github/python-appengine-admin" + } +} diff --git a/noxfile.py b/noxfile.py index 6b57c24..7d411fe 100644 --- a/noxfile.py +++ b/noxfile.py @@ -379,6 +379,7 @@ def prerelease_deps(session): "grpcio!=1.52.0rc1", "grpcio-status", "google-api-core", + "google-auth", "proto-plus", "google-cloud-testutils", # dependencies of google-cloud-testutils" @@ -391,7 +392,6 @@ def prerelease_deps(session): # Remaining dependencies other_deps = [ "requests", - "google-auth", ] session.install(*other_deps) From 72764d13c06bdd3d6055efcb753819f67823a971 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 14:03:28 -0400 Subject: [PATCH 57/73] fix: Add async context manager return types (#238) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Add async context manager return types chore: Mock return_value should not populate oneof message fields chore: Support snippet generation for services that only support REST transport chore: Update gapic-generator-python to v1.11.0 PiperOrigin-RevId: 545430278 Source-Link: https://github.com/googleapis/googleapis/commit/601b5326107eeb74800b426d1f9933faa233258a Source-Link: https://github.com/googleapis/googleapis-gen/commit/b3f18d0f6560a855022fd058865e7620479d7af9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjNmMThkMGY2NTYwYTg1NTAyMmZkMDU4ODY1ZTc2MjA0NzlkN2FmOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../services/applications/async_client.py | 2 +- .../services/authorized_certificates/async_client.py | 2 +- .../services/authorized_domains/async_client.py | 2 +- .../services/domain_mappings/async_client.py | 2 +- .../services/firewall/async_client.py | 2 +- .../services/instances/async_client.py | 2 +- .../services/services/async_client.py | 2 +- .../services/versions/async_client.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- .../test_authorized_certificates.py | 6 ++++-- .../appengine_admin_v1/test_authorized_domains.py | 6 ++++-- .../gapic/appengine_admin_v1/test_domain_mappings.py | 6 ++++-- tests/unit/gapic/appengine_admin_v1/test_firewall.py | 6 ++++-- .../unit/gapic/appengine_admin_v1/test_instances.py | 6 ++++-- tests/unit/gapic/appengine_admin_v1/test_services.py | 6 ++++-- tests/unit/gapic/appengine_admin_v1/test_versions.py | 12 ++++-------- 16 files changed, 37 insertions(+), 29 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index a673a09..06d6712 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -612,7 +612,7 @@ async def sample_repair_application(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "ApplicationsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index e339462..b6e1a79 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -641,7 +641,7 @@ async def sample_delete_authorized_certificate(): metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "AuthorizedCertificatesAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 46b1b38..99aba9d 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -308,7 +308,7 @@ async def sample_list_authorized_domains(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "AuthorizedDomainsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 5506996..a0c2649 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -684,7 +684,7 @@ async def sample_delete_domain_mapping(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "DomainMappingsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index 46ec58d..e640bf6 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -694,7 +694,7 @@ async def sample_delete_ingress_rule(): metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "FirewallAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 601d57a..06aeea6 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -602,7 +602,7 @@ async def sample_debug_instance(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "InstancesAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 985ebce..24bb5bf 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -589,7 +589,7 @@ async def sample_delete_service(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "ServicesAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index 1459f0e..5f736b6 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -702,7 +702,7 @@ async def sample_delete_version(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "VersionsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index 0ff5dce..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.9.2" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index e37feae..dc00306 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -1103,9 +1103,11 @@ async def test_list_authorized_certificates_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_authorized_certificates(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index b4b6f36..c3956fa 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -1084,9 +1084,11 @@ async def test_list_authorized_domains_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_authorized_domains(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index ce41f03..b55b952 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -1067,9 +1067,11 @@ async def test_list_domain_mappings_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_domain_mappings(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index bf32eb1..e5f2b36 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -1020,9 +1020,11 @@ async def test_list_ingress_rules_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_ingress_rules(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 0b36aa7..4c58489 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -1022,9 +1022,11 @@ async def test_list_instances_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_instances(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index ca6388e..eeead3d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -1015,9 +1015,11 @@ async def test_list_services_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_services(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 8ea3eb5..9628a1b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -1017,9 +1017,11 @@ async def test_list_versions_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_versions(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1065,9 +1067,6 @@ def test_get_version(request_type, transport: str = "grpc"): service_account="service_account_value", nobuild_files_regex="nobuild_files_regex_value", version_url="version_url_value", - automatic_scaling=version.AutomaticScaling( - cool_down_period=duration_pb2.Duration(seconds=751) - ), ) response = client.get_version(request) @@ -1901,9 +1900,6 @@ def test_get_version_rest(request_type): service_account="service_account_value", nobuild_files_regex="nobuild_files_regex_value", version_url="version_url_value", - automatic_scaling=version.AutomaticScaling( - cool_down_period=duration_pb2.Duration(seconds=751) - ), ) # Wrap the value into a proper Response obj From 55a7a3a5d094f5cba451a78b8196298bb8b4e8ae Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:56:53 -0400 Subject: [PATCH 58/73] chore(main): release 1.9.3 (#239) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 00cbbb6..afdaa62 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.2" + ".": "1.9.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index acaa15e..325037e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.9.3](https://github.com/googleapis/python-appengine-admin/compare/v1.9.2...v1.9.3) (2023-07-04) + + +### Bug Fixes + +* Add async context manager return types ([#238](https://github.com/googleapis/python-appengine-admin/issues/238)) ([72764d1](https://github.com/googleapis/python-appengine-admin/commit/72764d13c06bdd3d6055efcb753819f67823a971)) + ## [1.9.2](https://github.com/googleapis/python-appengine-admin/compare/v1.9.1...v1.9.2) (2023-04-01) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index ab4e0f5..6ecf7e5 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.2" # {x-release-please-version} +__version__ = "1.9.3" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index ab4e0f5..6ecf7e5 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.2" # {x-release-please-version} +__version__ = "1.9.3" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..6912740 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.9.3" }, "snippets": [ { From 64e7a827bf1fc4b3619680f213c6230d7c539aae Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 08:44:46 -0400 Subject: [PATCH 59/73] chore: Update gapic-generator-python to v1.11.2 (#240) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.11.2 PiperOrigin-RevId: 546510849 Source-Link: https://github.com/googleapis/googleapis/commit/736073ad9a9763a170eceaaa54519bcc0ea55a5e Source-Link: https://github.com/googleapis/googleapis-gen/commit/deb64e8ec19d141e31089fe932b3a997ad541c4d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZGViNjRlOGVjMTlkMTQxZTMxMDg5ZmU5MzJiM2E5OTdhZDU0MWM0ZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- google/cloud/appengine_admin/__init__.py | 2 +- google/cloud/appengine_admin_v1/__init__.py | 2 +- google/cloud/appengine_admin_v1/services/__init__.py | 2 +- .../cloud/appengine_admin_v1/services/applications/__init__.py | 2 +- .../appengine_admin_v1/services/applications/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/applications/client.py | 2 +- .../services/applications/transports/__init__.py | 2 +- .../appengine_admin_v1/services/applications/transports/base.py | 2 +- .../appengine_admin_v1/services/applications/transports/grpc.py | 2 +- .../services/applications/transports/grpc_asyncio.py | 2 +- .../appengine_admin_v1/services/applications/transports/rest.py | 2 +- .../services/authorized_certificates/__init__.py | 2 +- .../services/authorized_certificates/async_client.py | 2 +- .../services/authorized_certificates/client.py | 2 +- .../services/authorized_certificates/pagers.py | 2 +- .../services/authorized_certificates/transports/__init__.py | 2 +- .../services/authorized_certificates/transports/base.py | 2 +- .../services/authorized_certificates/transports/grpc.py | 2 +- .../services/authorized_certificates/transports/grpc_asyncio.py | 2 +- .../services/authorized_certificates/transports/rest.py | 2 +- .../appengine_admin_v1/services/authorized_domains/__init__.py | 2 +- .../services/authorized_domains/async_client.py | 2 +- .../appengine_admin_v1/services/authorized_domains/client.py | 2 +- .../appengine_admin_v1/services/authorized_domains/pagers.py | 2 +- .../services/authorized_domains/transports/__init__.py | 2 +- .../services/authorized_domains/transports/base.py | 2 +- .../services/authorized_domains/transports/grpc.py | 2 +- .../services/authorized_domains/transports/grpc_asyncio.py | 2 +- .../services/authorized_domains/transports/rest.py | 2 +- .../appengine_admin_v1/services/domain_mappings/__init__.py | 2 +- .../appengine_admin_v1/services/domain_mappings/async_client.py | 2 +- .../cloud/appengine_admin_v1/services/domain_mappings/client.py | 2 +- .../cloud/appengine_admin_v1/services/domain_mappings/pagers.py | 2 +- .../services/domain_mappings/transports/__init__.py | 2 +- .../services/domain_mappings/transports/base.py | 2 +- .../services/domain_mappings/transports/grpc.py | 2 +- .../services/domain_mappings/transports/grpc_asyncio.py | 2 +- .../services/domain_mappings/transports/rest.py | 2 +- google/cloud/appengine_admin_v1/services/firewall/__init__.py | 2 +- .../cloud/appengine_admin_v1/services/firewall/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/firewall/client.py | 2 +- google/cloud/appengine_admin_v1/services/firewall/pagers.py | 2 +- .../appengine_admin_v1/services/firewall/transports/__init__.py | 2 +- .../appengine_admin_v1/services/firewall/transports/base.py | 2 +- .../appengine_admin_v1/services/firewall/transports/grpc.py | 2 +- .../services/firewall/transports/grpc_asyncio.py | 2 +- .../appengine_admin_v1/services/firewall/transports/rest.py | 2 +- google/cloud/appengine_admin_v1/services/instances/__init__.py | 2 +- .../cloud/appengine_admin_v1/services/instances/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/instances/client.py | 2 +- google/cloud/appengine_admin_v1/services/instances/pagers.py | 2 +- .../services/instances/transports/__init__.py | 2 +- .../appengine_admin_v1/services/instances/transports/base.py | 2 +- .../appengine_admin_v1/services/instances/transports/grpc.py | 2 +- .../services/instances/transports/grpc_asyncio.py | 2 +- .../appengine_admin_v1/services/instances/transports/rest.py | 2 +- google/cloud/appengine_admin_v1/services/services/__init__.py | 2 +- .../cloud/appengine_admin_v1/services/services/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/services/client.py | 2 +- google/cloud/appengine_admin_v1/services/services/pagers.py | 2 +- .../appengine_admin_v1/services/services/transports/__init__.py | 2 +- .../appengine_admin_v1/services/services/transports/base.py | 2 +- .../appengine_admin_v1/services/services/transports/grpc.py | 2 +- .../services/services/transports/grpc_asyncio.py | 2 +- .../appengine_admin_v1/services/services/transports/rest.py | 2 +- google/cloud/appengine_admin_v1/services/versions/__init__.py | 2 +- .../cloud/appengine_admin_v1/services/versions/async_client.py | 2 +- google/cloud/appengine_admin_v1/services/versions/client.py | 2 +- google/cloud/appengine_admin_v1/services/versions/pagers.py | 2 +- .../appengine_admin_v1/services/versions/transports/__init__.py | 2 +- .../appengine_admin_v1/services/versions/transports/base.py | 2 +- .../appengine_admin_v1/services/versions/transports/grpc.py | 2 +- .../services/versions/transports/grpc_asyncio.py | 2 +- .../appengine_admin_v1/services/versions/transports/rest.py | 2 +- google/cloud/appengine_admin_v1/types/__init__.py | 2 +- google/cloud/appengine_admin_v1/types/app_yaml.py | 2 +- google/cloud/appengine_admin_v1/types/appengine.py | 2 +- google/cloud/appengine_admin_v1/types/application.py | 2 +- google/cloud/appengine_admin_v1/types/audit_data.py | 2 +- google/cloud/appengine_admin_v1/types/certificate.py | 2 +- google/cloud/appengine_admin_v1/types/deploy.py | 2 +- google/cloud/appengine_admin_v1/types/deployed_files.py | 2 +- google/cloud/appengine_admin_v1/types/domain.py | 2 +- google/cloud/appengine_admin_v1/types/domain_mapping.py | 2 +- google/cloud/appengine_admin_v1/types/firewall.py | 2 +- google/cloud/appengine_admin_v1/types/instance.py | 2 +- google/cloud/appengine_admin_v1/types/location.py | 2 +- google/cloud/appengine_admin_v1/types/network_settings.py | 2 +- google/cloud/appengine_admin_v1/types/operation.py | 2 +- google/cloud/appengine_admin_v1/types/service.py | 2 +- google/cloud/appengine_admin_v1/types/version.py | 2 +- ...engine_v1_generated_applications_create_application_async.py | 2 +- ...pengine_v1_generated_applications_create_application_sync.py | 2 +- ...appengine_v1_generated_applications_get_application_async.py | 2 +- .../appengine_v1_generated_applications_get_application_sync.py | 2 +- ...engine_v1_generated_applications_repair_application_async.py | 2 +- ...pengine_v1_generated_applications_repair_application_sync.py | 2 +- ...engine_v1_generated_applications_update_application_async.py | 2 +- ...pengine_v1_generated_applications_update_application_sync.py | 2 +- ...thorized_certificates_create_authorized_certificate_async.py | 2 +- ...uthorized_certificates_create_authorized_certificate_sync.py | 2 +- ...thorized_certificates_delete_authorized_certificate_async.py | 2 +- ...uthorized_certificates_delete_authorized_certificate_sync.py | 2 +- ..._authorized_certificates_get_authorized_certificate_async.py | 2 +- ...d_authorized_certificates_get_authorized_certificate_sync.py | 2 +- ...uthorized_certificates_list_authorized_certificates_async.py | 2 +- ...authorized_certificates_list_authorized_certificates_sync.py | 2 +- ...thorized_certificates_update_authorized_certificate_async.py | 2 +- ...uthorized_certificates_update_authorized_certificate_sync.py | 2 +- ...enerated_authorized_domains_list_authorized_domains_async.py | 2 +- ...generated_authorized_domains_list_authorized_domains_sync.py | 2 +- ..._v1_generated_domain_mappings_create_domain_mapping_async.py | 2 +- ...e_v1_generated_domain_mappings_create_domain_mapping_sync.py | 2 +- ..._v1_generated_domain_mappings_delete_domain_mapping_async.py | 2 +- ...e_v1_generated_domain_mappings_delete_domain_mapping_sync.py | 2 +- ...ine_v1_generated_domain_mappings_get_domain_mapping_async.py | 2 +- ...gine_v1_generated_domain_mappings_get_domain_mapping_sync.py | 2 +- ...e_v1_generated_domain_mappings_list_domain_mappings_async.py | 2 +- ...ne_v1_generated_domain_mappings_list_domain_mappings_sync.py | 2 +- ..._v1_generated_domain_mappings_update_domain_mapping_async.py | 2 +- ...e_v1_generated_domain_mappings_update_domain_mapping_sync.py | 2 +- ...ne_v1_generated_firewall_batch_update_ingress_rules_async.py | 2 +- ...ine_v1_generated_firewall_batch_update_ingress_rules_sync.py | 2 +- ...appengine_v1_generated_firewall_create_ingress_rule_async.py | 2 +- .../appengine_v1_generated_firewall_create_ingress_rule_sync.py | 2 +- ...appengine_v1_generated_firewall_delete_ingress_rule_async.py | 2 +- .../appengine_v1_generated_firewall_delete_ingress_rule_sync.py | 2 +- .../appengine_v1_generated_firewall_get_ingress_rule_async.py | 2 +- .../appengine_v1_generated_firewall_get_ingress_rule_sync.py | 2 +- .../appengine_v1_generated_firewall_list_ingress_rules_async.py | 2 +- .../appengine_v1_generated_firewall_list_ingress_rules_sync.py | 2 +- ...appengine_v1_generated_firewall_update_ingress_rule_async.py | 2 +- .../appengine_v1_generated_firewall_update_ingress_rule_sync.py | 2 +- .../appengine_v1_generated_instances_debug_instance_async.py | 2 +- .../appengine_v1_generated_instances_debug_instance_sync.py | 2 +- .../appengine_v1_generated_instances_delete_instance_async.py | 2 +- .../appengine_v1_generated_instances_delete_instance_sync.py | 2 +- .../appengine_v1_generated_instances_get_instance_async.py | 2 +- .../appengine_v1_generated_instances_get_instance_sync.py | 2 +- .../appengine_v1_generated_instances_list_instances_async.py | 2 +- .../appengine_v1_generated_instances_list_instances_sync.py | 2 +- .../appengine_v1_generated_services_delete_service_async.py | 2 +- .../appengine_v1_generated_services_delete_service_sync.py | 2 +- .../appengine_v1_generated_services_get_service_async.py | 2 +- .../appengine_v1_generated_services_get_service_sync.py | 2 +- .../appengine_v1_generated_services_list_services_async.py | 2 +- .../appengine_v1_generated_services_list_services_sync.py | 2 +- .../appengine_v1_generated_services_update_service_async.py | 2 +- .../appengine_v1_generated_services_update_service_sync.py | 2 +- .../appengine_v1_generated_versions_create_version_async.py | 2 +- .../appengine_v1_generated_versions_create_version_sync.py | 2 +- .../appengine_v1_generated_versions_delete_version_async.py | 2 +- .../appengine_v1_generated_versions_delete_version_sync.py | 2 +- .../appengine_v1_generated_versions_get_version_async.py | 2 +- .../appengine_v1_generated_versions_get_version_sync.py | 2 +- .../appengine_v1_generated_versions_list_versions_async.py | 2 +- .../appengine_v1_generated_versions_list_versions_sync.py | 2 +- .../appengine_v1_generated_versions_update_version_async.py | 2 +- .../appengine_v1_generated_versions_update_version_sync.py | 2 +- .../generated_samples/snippet_metadata_google.appengine.v1.json | 2 +- scripts/fixup_appengine_admin_v1_keywords.py | 2 +- setup.py | 2 +- tests/__init__.py | 2 +- tests/unit/__init__.py | 2 +- tests/unit/gapic/__init__.py | 2 +- tests/unit/gapic/appengine_admin_v1/__init__.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_applications.py | 2 +- .../gapic/appengine_admin_v1/test_authorized_certificates.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_firewall.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_instances.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_services.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_versions.py | 2 +- 174 files changed, 174 insertions(+), 174 deletions(-) diff --git a/google/cloud/appengine_admin/__init__.py b/google/cloud/appengine_admin/__init__.py index 5f52a1f..b16559e 100644 --- a/google/cloud/appengine_admin/__init__.py +++ b/google/cloud/appengine_admin/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index 1b5d78c..d2e8417 100644 --- a/google/cloud/appengine_admin_v1/__init__.py +++ b/google/cloud/appengine_admin_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/__init__.py b/google/cloud/appengine_admin_v1/services/__init__.py index e8e1c38..89a37dc 100644 --- a/google/cloud/appengine_admin_v1/services/__init__.py +++ b/google/cloud/appengine_admin_v1/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/__init__.py b/google/cloud/appengine_admin_v1/services/applications/__init__.py index e2150ba..7c9e079 100644 --- a/google/cloud/appengine_admin_v1/services/applications/__init__.py +++ b/google/cloud/appengine_admin_v1/services/applications/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/async_client.py b/google/cloud/appengine_admin_v1/services/applications/async_client.py index 06d6712..8d89af2 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index f0e9657..f75c702 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py b/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py index 827f1d5..ed14eb7 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/base.py b/google/cloud/appengine_admin_v1/services/applications/transports/base.py index 96e0ed7..043a148 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py index 820cc4d..7a2e8f1 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py index 174802d..9013cf1 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py index 89a7310..ce1e18a 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py index 957935a..46a8c71 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index b6e1a79..78401e9 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py index 864c7b3..004e8ab 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py index dd6e8bc..8221fc4 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py index 24f04d2..0886758 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py index c2771e8..3987ad2 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py index f887c33..ffa2a44 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py index a76db90..0ef74c2 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py index a9b6f8a..5638415 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py index e73333e..4a2011c 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 99aba9d..c5d95d9 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py index 41fc79e..3fafd06 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py b/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py index d790841..97c4b31 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py index f2fffb0..a649173 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py index 87e51d4..292b9bd 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py index 264e6ae..861766a 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py index ae74509..292954c 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py index 1725792..da4097c 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py b/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py index e019b68..5494732 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index a0c2649..2344a23 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py index 60459b2..686d61f 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py b/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py index 6a71967..b1b6f53 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py index a17f0ae..c57349d 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py index af69105..edf6be5 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py index 1523661..4c3ca85 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py index 588ef7b..354aa54 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py index 8097876..1b5f8b0 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/__init__.py index 417aec0..60b9383 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/__init__.py +++ b/google/cloud/appengine_admin_v1/services/firewall/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index e640bf6..e492179 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 4cd34ec..dbe1d1d 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/pagers.py b/google/cloud/appengine_admin_v1/services/firewall/pagers.py index 2703da0..2cc3feb 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/pagers.py +++ b/google/cloud/appengine_admin_v1/services/firewall/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py index fa9b990..0e3e919 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py index ee78145..4789796 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py index 35fe7ce..10de397 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py index c1cabc8..bb68615 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py index bb365f5..f4a39a1 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/__init__.py b/google/cloud/appengine_admin_v1/services/instances/__init__.py index e1d8945..c006d66 100644 --- a/google/cloud/appengine_admin_v1/services/instances/__init__.py +++ b/google/cloud/appengine_admin_v1/services/instances/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 06aeea6..aaf0899 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 9bf7c9f..5de20d6 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/pagers.py b/google/cloud/appengine_admin_v1/services/instances/pagers.py index 8459277..7e52068 100644 --- a/google/cloud/appengine_admin_v1/services/instances/pagers.py +++ b/google/cloud/appengine_admin_v1/services/instances/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py b/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py index eb0bbd8..0a69646 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/base.py b/google/cloud/appengine_admin_v1/services/instances/transports/base.py index cbba79c..12469df 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py index 029a436..d04d71b 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py index c1bedd2..bd7b7a6 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py index dd1ecf4..85f1031 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/__init__.py b/google/cloud/appengine_admin_v1/services/services/__init__.py index 3916f58..274540b 100644 --- a/google/cloud/appengine_admin_v1/services/services/__init__.py +++ b/google/cloud/appengine_admin_v1/services/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 24bb5bf..d7df912 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 2f8c08b..4a4fe68 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/pagers.py b/google/cloud/appengine_admin_v1/services/services/pagers.py index 798651d..dabb002 100644 --- a/google/cloud/appengine_admin_v1/services/services/pagers.py +++ b/google/cloud/appengine_admin_v1/services/services/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py b/google/cloud/appengine_admin_v1/services/services/transports/__init__.py index 94ca3b8..75a0c0e 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/transports/base.py b/google/cloud/appengine_admin_v1/services/services/transports/base.py index 797a86b..ad65cf2 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py index ae77bde..38a408c 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py index 3013788..a6a43b4 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/services/transports/rest.py b/google/cloud/appengine_admin_v1/services/services/transports/rest.py index d627e8a..a497793 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/__init__.py b/google/cloud/appengine_admin_v1/services/versions/__init__.py index 2e962bc..1072721 100644 --- a/google/cloud/appengine_admin_v1/services/versions/__init__.py +++ b/google/cloud/appengine_admin_v1/services/versions/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index 5f736b6..04ce197 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 287d324..5cb28f2 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/pagers.py b/google/cloud/appengine_admin_v1/services/versions/pagers.py index df6f2e5..6c43d9e 100644 --- a/google/cloud/appengine_admin_v1/services/versions/pagers.py +++ b/google/cloud/appengine_admin_v1/services/versions/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py b/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py index e921ca1..a4b6bc5 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/base.py b/google/cloud/appengine_admin_v1/services/versions/transports/base.py index 4490b11..bda3ac2 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py index 95db790..3090a75 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py index f0f1e64..a8903c8 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py index 0157db5..0e59c57 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/__init__.py b/google/cloud/appengine_admin_v1/types/__init__.py index aa1134f..f81343e 100644 --- a/google/cloud/appengine_admin_v1/types/__init__.py +++ b/google/cloud/appengine_admin_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 9387b98..4c4aaae 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index f5ba7d5..bb3f4b9 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index f9d5c55..680f782 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index bc937a6..d1f9345 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index db119c6..74f6e09 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index 7200ff4..daa95b1 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/deployed_files.py b/google/cloud/appengine_admin_v1/types/deployed_files.py index c11a0ad..315511b 100644 --- a/google/cloud/appengine_admin_v1/types/deployed_files.py +++ b/google/cloud/appengine_admin_v1/types/deployed_files.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py index 4e21290..b80765f 100644 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ b/google/cloud/appengine_admin_v1/types/domain.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index 7af44dc..4041cc1 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py index d22a04a..8c7f874 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index 4ea61e1..08fb581 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/location.py b/google/cloud/appengine_admin_v1/types/location.py index 84f925e..b29e518 100644 --- a/google/cloud/appengine_admin_v1/types/location.py +++ b/google/cloud/appengine_admin_v1/types/location.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/network_settings.py b/google/cloud/appengine_admin_v1/types/network_settings.py index 47d9ad3..5516fe3 100644 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ b/google/cloud/appengine_admin_v1/types/network_settings.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py index 26baf33..410386c 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index 6cbcff4..8eb0def 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 4841759..0b8d673 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py index 8eab013..e99c685 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py index eef941d..cd6bed1 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py index 48b21b1..3f1d066 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py index 0818eb1..b0d82ce 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py index 827974a..2069686 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py index d63ad80..3ed0078 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py index 9b9e504..ce44cbd 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py index e2f1418..c67e9fc 100644 --- a/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py index 65c734f..1241846 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py index 1486259..015f74c 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py index ec479e8..add2619 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py index 0a7afaf..1b556b2 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py index c6cf45b..f862681 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py index bd754c5..492bb9a 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py index dc5e905..7707f15 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py index 824e864..895e787 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py index f28e68f..61f57f8 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py index 2574ea5..4eea019 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py index 4669118..4ddd182 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py index 8fd97e1..df8e759 100644 --- a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py index 51505e6..d82e3f0 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py index 5e114ea..67346ef 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py index 1cf7ff2..8de281b 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py index 3eb305c..d344193 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py index 83086de..023a83e 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py index 8f946e0..8eb4691 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py index cc9b583..eebf46a 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py index abeae74..65eea14 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py index 3db55b5..1305d82 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py index 3a38f47..8f8ae4a 100644 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py index b07befd..5399783 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py index 7d3e5cb..d4c8a51 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py index 500dbe7..fb0afc8 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py index 0c1c0d6..7ca87c4 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py index 6a29e91..1f68a24 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py index b9431cd..5f70011 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py index 6114f52..4f0a94f 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py index 43aa8df..d6e9e02 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py index 4995911..1dd86f2 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py index 1cf2c4d..2613e28 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py index 4f67c75..d0fe163 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py index ba09c2c..667bcd3 100644 --- a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py index 963c210..42d0ffa 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py index 5388e72..e4146de 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py index 965849c..cdca21b 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py index e8176ea..b7d7725 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py index 2b8c9fe..f3a0b9f 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py index 0b8cc9a..22f90f1 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py index 7317d3e..96beea0 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py index f0cfba8..d4ba864 100644 --- a/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py index 02b80fe..aa89f25 100644 --- a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py index 9264b35..9e852aa 100644 --- a/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_get_service_async.py b/samples/generated_samples/appengine_v1_generated_services_get_service_async.py index 978f014..f645503 100644 --- a/samples/generated_samples/appengine_v1_generated_services_get_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_get_service_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py index 5fb5629..21aa6fa 100644 --- a/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_list_services_async.py b/samples/generated_samples/appengine_v1_generated_services_list_services_async.py index ebef32d..af5f2ef 100644 --- a/samples/generated_samples/appengine_v1_generated_services_list_services_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_list_services_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py b/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py index 9267f12..28954e1 100644 --- a/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py index 99914ae..6f27d28 100644 --- a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py index 72bc871..53284de 100644 --- a/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py index 9482b6c..d942c44 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py index f4a2526..1b4fa03 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py index c69926e..27e8eee 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py index d560849..51027cc 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py index 5fbf327..c778fd8 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py index 634cb66..6229a5a 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py index 5c0a6ab..386b211 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py index 204daa9..d7b2c41 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py index 13b63b8..221717f 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py index 30fdc26..bba0d50 100644 --- a/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index 6912740..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.9.3" + "version": "0.1.0" }, "snippets": [ { diff --git a/scripts/fixup_appengine_admin_v1_keywords.py b/scripts/fixup_appengine_admin_v1_keywords.py index 576b666..afd7802 100644 --- a/scripts/fixup_appengine_admin_v1_keywords.py +++ b/scripts/fixup_appengine_admin_v1_keywords.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/setup.py b/setup.py index 3652982..7c98d2b 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/__init__.py b/tests/__init__.py index e8e1c38..89a37dc 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index e8e1c38..89a37dc 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py index e8e1c38..89a37dc 100644 --- a/tests/unit/gapic/__init__.py +++ b/tests/unit/gapic/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/__init__.py b/tests/unit/gapic/appengine_admin_v1/__init__.py index e8e1c38..89a37dc 100644 --- a/tests/unit/gapic/appengine_admin_v1/__init__.py +++ b/tests/unit/gapic/appengine_admin_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 7fb2233..c347e7f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index dc00306..dc5a049 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index c3956fa..4f31637 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index b55b952..e631be2 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index e5f2b36..42b1c2d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 4c58489..f4983f9 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index eeead3d..e5ab4fb 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 9628a1b..5045b30 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 3857f2ac95cfefa2bffb404889be9e2e433a8663 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:13:23 -0400 Subject: [PATCH 60/73] chore: Update gapic-generator-python to v1.11.4 (#241) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.11.4 PiperOrigin-RevId: 547897126 Source-Link: https://github.com/googleapis/googleapis/commit/c09c75e087d8f9a2d466b4aaad7dd2926b5ead5a Source-Link: https://github.com/googleapis/googleapis-gen/commit/45e0ec4343517cd0aa66b5ca64232a1802c2f945 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDVlMGVjNDM0MzUxN2NkMGFhNjZiNWNhNjQyMzJhMTgwMmMyZjk0NSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- google-cloud-appengine-v1-py.tar.gz | Bin 0 -> 49152 bytes .../cloud/appengine_admin_v1/types/version.py | 1 + 2 files changed, 1 insertion(+) create mode 100644 google-cloud-appengine-v1-py.tar.gz diff --git a/google-cloud-appengine-v1-py.tar.gz b/google-cloud-appengine-v1-py.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..f412a6c0e600dc61ee6a1422e7a19c87bd120fa0 GIT binary patch literal 49152 zcmZ_VV{m3o*f#3ewr$(CJ+U>hCbn%&Y}?7iwr$<9lRM`3yzj1!KfC{}>aJRKRabS_ zI1O- zz#};%Ae~GN<#PcALQdO_{7HWXi@)W+g}m<%|6_dpKi8&>m*v9ziX=md<6&!`LEXeFcC#O8BGt`F;Z0YefJT5 zJ?k}pcX{fs1@IsoyMxI)-6)&ATs0Dm+4Kjhh)^p>7N8~so# z_k`plcRLHf{$8WrCF|mQCEV-(_G65>`tJpL0ONKh`>%4|;2QSxqFYvP-!u2iC_ge3f&(tlfEbPnU=i}`Eyx{XP;PZBKT@8!@dN>}e z+1@^0|9JlReLw%2g9p)=SG;q}+kZ7lBn@WGAek0|3gQT?&OoBcg$CTw5e#)(uEGEC z-PHlMNHPapyS)+>hA^<%!wwV+(r9wRGxL+UOJzm5m2dDHv&YVzkAK#_1qkXZAeYmB z`W^iR9gcpO^1Ltev2os0ta_C4QoGP`6k{RZ?Mz~5GKD}P>A z1|0VIL92XxY(!Ao37nQ(=_C(NM70q-lRi&SyXQ`iDa)L`Y7rX~QXFt(SojZ5eV8c7 z#{y{JMpJp;i&=mC^B`eO(QL!#wF2^nbp&+v@5O#(02?U#oRAz?hWC93Pl!MG{m?80 zwMmxm>cX;)pB4EGAW0wS#JxawBSy3)U*diBxvs!MaN?ZV`|?Ie!xtt|-o%m?l4R&f z*zYIt#95QFpmX}S9pEnY00E5opy7Dwhe$lej&^IpV>^3ANia!gIDiM%bAWYzkO6=6 zPZPyz5r!hoVL6dME>?XFXFb*i8ElPYqyi+a4Ku_UXE$sS*gg_ugb-O@t0%%S3{*#2 z5hGcY`IMK_Vc1%8hpD&MPK!-^Ka4}T4u}GriU!j^kly~khz*ddjF03^IBVZ3p6XRA z*y-_{cih@&!kwPL`{Ov_Y)Dj6pGq>-kar74=sVVbkSFQSl8V%)9E1FWZiZ+OTTWB> zwjA=GI?(~84si#;r)j|3>XqXVokI6`CA<447=n@JOLJCo)9Tm=;6kGYpOgac2_)`v z__rqkGloj_wB_I{HJ5cMTXiLx_FCse^C1pH3YOVM zVoCCV&(fvRWH#8qJ~{9}tU+<862JEmANM~PpN%lT-WS74m&)*ypEU}7#{x)3#ZSTt@aqep_d zG2BqUp!?Z%0=-W|@Lb(6DIyP*(}YwF#sdms$@wP8GRH`$-XZu(wvH3sc#cZ>Tc~k` zYO8r})Iq?>35 zCVD(WXdNMn95q%ZE;94bw`nLt`d2tMoK*u{14B(4iJCy-mR7a-HK}_od&=h--MQW3 z+Av%c>2D(2L190`?9`$qxh0XQ^LMPfp19wl*hyGF+C8|ap9YRBG((;}ZKd4VHzEc) zi@oj}tGC4hNr)a4r10k=-ryQf`5HZvagXxE9Mb!O4Yu!E^VZI@IHGes`W=YBRlwHw zezR35dGQF=hta85Z_)onDdC})ddg>6#hQ~J^rs&}`@0hiA4%ppJ{k>XS`nFT!qXMa zzi2Mt#T9E^u$lrUIsvEhgF(`kGaB<~ao@B=$vJ)l*Uk*mVduM)ApH~gB_oY1VpOpX z+#F?X>!Jy&|8&Lz3gT@eeuVAR)^Y(AK0^7{axSw*&;%Dk)` z@Pl0=$S?~k^ULvdbjvV+09A4OaNv6Vo-^vw#RnRfYd#b&wZD(Q(jj@x@B<9ud$&d0rmy_Sq zgOk_i_oY;4w`)ar3=;M^0^yBUP2wzR@TfdNyPB`qExg!J2L83*P`!kzc>UnW)J$JqT8<ru82#UU5w<+3{4=1er7xM6 z1a;s~pN!R^W;E}QHzHzyYp2Z0%(EyQ+2C^jzOoYE_@8?Pohl$mZRXuD&d^L+51p~* zu+MkTX1x(NMs7TiJDXFW8W|z^j5__6idu2(Hh)%jzK?s_I;>N=sH=sj5v7DVVs|4L zO(=DvwnpOCEqr)HP+dsMxPDiM1+Zt_YudN93271lF^Rk!eCAJ-G#h#9K_S(B-av?3 zX+MP5wl5i*aF*G-By)KG?jSX~3Wj*jEumOBP*T^`9qAGzx&4bA@>knm1mHVjY`?af z`C%2&Qu~zI8v(o9owNiVtDHPwWPFtw0?eibcNAAi!B>{*jl`y`9Sr z)F(yLLx^f0hL94BP%SeQFtgV}{sWxsw2YHT+ff~&2{AEtZf2r*`o_V&u*Fv^4m8J; zIaH-IlX}p;AIMfRTPH*00pBaI z9tGQ!wr}M1ds4IblMsRIkgQ5;@3whpQ9Vc+z75}Tzobt|15ocejoOa)2BbyxC`H`l zZs7QOA-vY~Q@l09oi43<{BA4BO84SJlC$)yj+-8hYE|r%6aB6+v(fr+wLJ1VO+zqH zUmRV30}SrJnOQutWpMT1y#dBw)4sK^K|U+VVIKJ0gZhb6jOR(X=r*dl?@~mX9)z); zcXcy++A-qgzcQyjE0AXDwll9>mRhCm)ufEj%kQ zOH>gQWEy6h)FFMEFO{|!7=0<9xvZK%ISxG944lN=h&O|jcc2EeV7V&=0qITvmhB+m zN{_f|U&M|8%{@c#6`W@Yd=q8HuxPaZ!!T5zMP{pDb*z&8-sE7NB3YNdo`2ng2=*^C zo2~fF8Ip01t^V4BWy_3k$N@V#4l!h$cGuc#GHfS=@Oz(gpUYKC^P|zg%KX ze4giO$pw~$9Sqd&IFRJt>+%1nsDUzt9Ef(&ra9Evjbh3o;C9FoQ#9^e^F5`85IM{e zM})dp%p_|}*IoLN4b1je4Od@NnBG)zU%_b>E}F@AOUN<-*r`^XSg*Cvm+{Kwb!R7M zF6ObLNJTm9{SA^|x486-x6g87+34mcaVpSg2h3r&)%YRqG>(-Ik829TpcW&cc4os*h`Wr?!jQxe9(g(V~~#oSRPTMeE)E9`=) z?gvQTGayaAut11ECqxBe(&shTk_=pARBGp1w5y)~%DLz-F-X_UmC7zu=oQHM5tbF8 zAeZ-}d|evjh>mR_CVma5wj;n5YNEx4+;KToc%D~{GzwseBV5mNG=rf9Kx7us-iP9- zKzMLAy@yaaib7sQUc_x&&+;acZk~ioPXwWtk^^D$>b3l>zeqc9` zF#(3Rj@bmnK2 z`G?+{&ww$<(!>Fpno^`lxzR1yiM8^n8j{{*^|Qh-on-M*=?BFuO{{K-p8bH6SoE=L z86(9!6Rkm+g*|6bv}`NeFWYL^M}?}ib3Hvpsy}V!H>q{@>XeRbMBp=e_$Xz?rT)NJ zxGd_{Ctnf09%IlF%P8_QXa+VYd=&d`(OAK1r$AEFjnI9*W4-nxDn=&{6$TdZoit*p z$^gv$uuWRHL)Rph!3hzIgd)l%5ST9)1F|dVFEPY|QDm~I-;ExSRgPHGEYgH0=c4d% zAjXTp8`JrF_ZqE6oc<=YC#NTL@F{Hf;Bm*5*JS>K>13+8=@ezFQFij8yUjB+(3xM|zr^3t9v~v1U0CUm=7oUGIz)@sujqdF`m)P>7 z_<~#4zxbG2_nWEpGwrFWDI5Bj5=&7*t);;H^ zwUy_#nQ^*WR_kXU6Vom+(NjXVGVyHBBbA{9xqN{A^aO2(>~u6SmT{4EeB;!O1q7s(s41wjBo z*QPrsgYlkDzqcNhD6GG4*6olbrlo&BqCfu%C=t`j)lFg}{bQ85bQa(&LH(tNA&7BY z?TqzqjJpc4ow}u2CMm0-ka^&NNr@`*Acj_i`dAd#8hJ4BiQ~$Ks8aL@0~X{^y?}&I z63r}msEpoP{Y`f# zg=&RG4O{BJyZY2{qosP~KIq}v&v@gK6=o3Z)_$l}*msAJpL=pg%T3c)w)>C47iK22 zBcSP(Jl887`^*2>7$G@!2PZ2b{^Ry_4yiQp5NN{pQf{B^lZBg4T+mpbRnZ>c>(&}r z3in<=A)Fl4i*PZDY1L;Cv|8-L9(FxXIxYpnbP*3_z4iy54YA@L!KUQMvb1EYO&RZC zGPre<*PI#R+AOW{(uwU-v^(j`dhSqbJIFUn+2%?FtHiY#{H@T_)@y-y25C5U4%r*p zlJaj~u)oE5QRBZx!of%R78S!`ZN6SoVA zy7@*V_G<11v8HmB2ZFy~`kNo3t`e=Lbb1WvKB48wye@lW6WY(EUel9<-!r-F(VP43cjjKI9GZARescB zUE}Msd0oaUCQJwap_4AaL?$1I)fahaVaDj~z@`wwK`Ah7+l)lJ6-cbKMeVgG!7IPQ@B9@AcJiJ1`X@LW zcR zFUwTgCX81Et=?zN4|mq+5!rX&T~o0uO}`i}d#ro9>a5;HA@Q^mQ|@zl%o=o`JlA(X z)kVm5%`rzm5oTpn!G^@V9huc;YV!tIi}${fC>zp=PEJ9v)I+~lz34G)l`C_j&88~8 z*`#(IF33hFh4OA>I2A$&MexHQy)t1wwnWDUJMwuq4Sm~A?J_Ipv$xO5Go56#?E+(+ z%v1M|mQ0sR$Q{5k@_>#^rJ{gOiwE2)FbDK*5A(VM6q+w%%mSk@WP}<2k`fjnmm(-J zpAGgEb%kM-K>Z-{3Q|fSLCY;eJhc&1a`=^tcmG$?i=vvLt_HbduF5!F=B#cE#jx_y zG0KmcQ2gNpS}#_LO7Boc@^PZW3&L@43|cQmZfj?Z{$x>4YBUyp)=S4kw4n{G-7CY zF=0%U3`~`ht{yoajKz;|g*i348Vhs#&1|#)38t`BNWKyZsfSiP7*!?{*lVey+3|dY z4H{19E^YG=9d>u`#19xd=zu3)$iJreXc}x5VA!633 z_ctb|awaM5A``ya#@R`TG`W0XEA$dXS!oNFh=PgWRX|iN+R}Kk~?q2}pgYIaCynz?bxwA1{ku z7x8EABa+jzCMbH#Bx}UYsogVjAB-obmwTjZ`G3vxgAa155C_#Q?-SXKbj5o5qtZU# z&pnUNf8<+u_2tksC5T&g54#RS$841cQ)y_#F%D>bzdmaf;{vqRga+?6#}n@aO%&er zENzC7w=ZP+{Q9nBxs1skrpDBg2e7BCW{W5;nbH>sL@=qAoCyM8RY~(B9#e^Id_x9; z?6USL0zQr_A{sJBUN8S^$@BrOkK9c>1D5HxoM1H&ek)f^XfjmCYp~8mH>fLR8uxti z;s&sQt74IaR^YY}lCva4U=-tCEqh3^KVXAMiA7ZSIM#D2IDP_*{5dtt@_Er7B~sW{ zX^G=Ob0q$-g?wSoKY~5~vQ8vTP(CLEEBk$RfDTF&=NNqdw*_Pz3{T_>JPRqA)EiGZ zXsdrV_wUAX8rUpw+}mzBw~D0SODv&6Hw()S`P-dZ8bXBOV>wf$%Qd;fov z6K(Ow9%-K#$WsqnR}R@b_RU>>9bH?aMBS7=4Q}w-jBZ37g6mlP+l=0?33kX147zcW zwsQ=+X$x~iHIh^P-gq&ZW(%8TlGXp!-)M#Vu@NRYRRT4R#rVf~YP9I7fk8JNrIeRX zm?$P)hw3Ima*ASOwb80JxpaR)rzK19ZD>11FKykXb0b0U-OVZZ{mny^v2-$Y|cui(;_1I{ibMjo49X3KK)_^l}rEzVXCH+bdx>U>f9wGSMhZ z^{%)-7theTDZ}-ymeQ1I5Y&y$IkqCRrPmSX-6{emf+Xez{Q`mSEj~M>TAB1c{`*2E z?88^8LC`Xw&Aln~YLBsA1+>2xjEoFQwflx$z@}K7&^QQ+9oZjew3ZEp&&L=)Ur)M1 zoVcCIwkbv|7ORLop)Xs0PF-lUvTt}8sYN0@T>&c%qQN!E^4@iC)tC|;sd=z+70 zAl#BT)IbTq58#3?k_Hvv!)#m$v2F%(hsAnS;)~BA8)+xf{SDm(-~{YMgtW`>;X-@=o zT?DrL^Hi*>#9lq!wyKi?Z#cFwjsHuGmq?#NS+4o_h8kGXv12wV7jsbl$?w28?W5I_ zuK6g)h1tw|wiXP*!)fQ5BK%8vXqoxc8A@H#CR21{TM+f?D_&D#Ai?H(3p1zWi8_YZ zUb}Bn%64va#$cxU+U|$8bBz{amKHz}q+1z5dHZBu==jLdK6s$Xc5^C16k#BikuAM$C+OC>b%vL}^O@URl{89%DLGhsp z&y>jp5#h%A(4X9}^J@saRMKci33kgSiEKc2tic+6@OmCW>tZ{z7@tgLhv3UBt@Y1I zs-1ZHVm#A)@ifTJrh4D%0-U*R&K8as61 z5hSBK4DJsD;HPJ7|Y_sH} zi%=EPf7tz;T@0%;Xv>8XASHT2GtB{ncZDMQ{_KcDvznB_pUN=$2VO^0+iq?!n2OLsl2OC+E8|M@)S@>Mn-8Wk z@}w%SNu0D6=5Z+P2wFn2DtDZ$oTnBe0vL!WaRUY-*e8^Zmax{$ z{?03gP|#zU5asi5%QMpV7kh!PATuQ43`=vALF!sM=WFUwvrVf7 zIx1BKibiI-ZkS5?@$p0q_FUSxWHVcC>CUvO=C;9an_qYLI_eW1HiK1X_4C1s8y*@x zFfp7=nbAzv6o*ZgydB&Vr;E#cM>H6o=WC?i=s?8}mf-kid>p|4L{ljLpJ=K=e0%x1jam`b zWswb z6Yd#wC2PJ-*+p4+>gaVpo9!QkVnm5jhc92-OpLn?@$|qSCpr*@b`&vLuS_p2F$+X? zFx>m$nJqu9K*k8IVNfs=yjiG+Ksn44SlgUPu6px#-}6!xkuw%v6TR~)^*???G(y)>_g8_#vu-8g3mE*@5IAKRmt zgNagya;-6poKZxHw|B8i02yE9buk621Xv>_|A6N!oh|4g=uWQu_$u|+69Y{u|6IPo@>)FqS7J#^--(wvFO@zq3f^M>)4&o27)*ih@m`Vhph z>*b!DC!oT^Sz}%^W@}jp8^F4sITFVjZv_jFNxY$|s_xbC$+{d)Da~JAwMl6^GPbcb zRZaHh4(T*+v#QRZ;SNk8taPK@C?<-YOjsd?Vbk{wigPgUM{y3sS^QNGj64hTp4?KG zDIr>M2b*f8ijhx(#y`5Z0+Aj8DkxTUpw`1-yG>>l=1tNF8AHj|@}$uyf1e(QJa7Ll z`Bq=v*IuaKinGKyI!^`rz`8zkiN`EaWKa)eY~KM>E+M@!%83^I$DdQHMFeNKI%1@q z=AFdw@;uK<VNc(w|G0x#PPd+xh%!OQG;BJvjLH#y@^}j`ya_P``sxax4 zpLgs|Fz6Av{`gW9rw{1IC%7kG@D?wxr??2S#jSs+)$DcVmB^=3>M37`ED@|D{J#B! zXoIQ8IS1MOgk>JwXgv&d)FEHPk2*Bt>s|5UzmuMVRix7X=E?mdL$1CtQV=Hm!I?#~ zls?l@<|vH})_hs5EtfE2o8cnO=zAK6ViwpTxpWN!uF%Mgb=iWnkqcd71TvF}jO*8W z-Sd70O$>NLezOt)Uvxir`V2{UgMrCki4RK6x{(%rrHMF*-cn0*QL!{yz2KUtzuT6A zTn~f`?Cs;qG@|7A<;()vMm$SCU}?|8Mmqk=8fO?yCvF(EcYqQ9P=YQ*MiPCRh|E+up}#&WoEkC};cl!G1R~+)BnnQp+8zP_);KXV3JWTS48=Nn?}|4UUd$5B z5`r{m9C9$sD@C&>;J{V9MR!9MQm-?iuFE3$S*G!|d$BY=Nq9UY^0ou8>~(ItBllY; z*cwm!n>^Eia~IgkJP6KVo*Y$%MmN|UW4y&!3I%%rlbkxCjK_qnS1DYYA8;agQPT<$ z)Uc!f5@Cson7q#=v*?7;h(E{`sX0gZqXnyg*Og+_sPcSbLPTLqEE5`_hVP!xa> zDIS1)Cd@f6K>+dP^Q&ZDK{^4xg`_C(YT+gl(p0$1(6{k6ZB;<2?n~#D8IMXEBJC9v zo6oQe7o;*2#FSSA{Qh?k!r@lXYcZ5*sx)1%4yJ4@aIH96n*i0aEhCiNcps4M&7*$f zzLud*G$8jn)arridPQhD=9y%n>V#RwZ82>!0%E;x1likw4gTzi$dEKT|NLR-M&?)_}XX{M893>2s0JUB`qlAHXS-c&&DRN>Q%%`rL!I`c0@X5jX?!;FH z8RsIedf34*(AvjNac&+klp`c(L~+ezY_YSw9e)GUXTjF8pCv0W*jSUwEW=-qyVOs z18*zoeHr#6i>C%>SiAQ3)hHsEf`F@P_w%s8@Ig1^2fcUDM^U!N}v5$BSgG`lc;0U1yVc>J-c=2V}t+)xey6Yb6WW%iITV9c5EyIFi)M znDj}$v3~|DBRS?Ni8-*P6BTS~w=KVrj!1H5UHlOKc@$iuiAX4Sr*2TQH)=~Og!KUXbb)>`@Y78+fm}?gvY3SH3N$YH+^DvZw3oFn2 zH`~n%Kna(csr7;C=C$(tU44YP-CpmXo6l>>nI-A16$wAYF>o2xF?1`G5a|;$|F@IR ztLu@w&+AK%W2n!wS)(#>h1~CiE(FHb0(2Cz`BcoI+tjfozXx@ozE+OC{?-~pwh69K`_dy#4nAWVj_yG6I^M)2C_T=yY zM759CA^DGSE9ZGL1K!wR>mAu{UpMam+#(0l>}GQ_=L>|@I}SRth_Cqz8|ix z$C|-$SSlZ^u|Sn6bg0BJ9*axI;s>Q!Cdd1LEQ_yhX#MRBqxZX%CQyM_Ue><<$$_~p z*^J;SE?sl9hSxLWSyNDuzrsM>a^fCf0^@CcIq{tEb3vT&9P{_(PC5MT+!8Xe(w<>X zzTe}n-<@Hv&&S2*;pdLt>(eH`--qySKz^U!3J?qg(-qw}Y)3Gb7z&pR=l*6y{niXc z27KQOuuxCc0+M8gn~%v9`H0f1@*uLi^BHDgxB?-(hy5gS#10sA zh?+Q`sL@@;LWP{I3xiZ~!Zz4m);s@Sk~tjzF>i+Ig>oNZeqEHv9B`eI=urcsDlFTp zvQ9IN{^Na-@9DS)y8P|`d;p6-$4e`J*qm=QWkPJ4?`zr-;GN8`{=6WT5qg$!F5TTt zJlXAd4UO_5x&(K}peO*RY2i$R8;l!DOZ|$M7fXJ`5PT#Q)~rA)8;7VeinB z`M>$4XDQ?Hb+7Kc*%$I%<*7mcd=RqI>Fd%uSiSs=g{&O>g9_>={hWr)`()D_9c=pX zqMv2Kcy;4G`fNcmT+zFjKA*Oz4rD79qgr92U_lPyh;9nL=XF?U!Jk>kO2sK%eYrEH zzoGW3NYJcSMpfG#G%FYI4aSI{_CalTG2FyPYJX5??npFikiKSqLGPZ}KI^SpI8=

YuJ`$Pht5^ApEK!9AxF7{Jhk6j zO(Wx?olwCeAx(>sfL#&Rz`&$FA8j06iD4&PpQ|=kz5UK1p3bWiyAXwNVep@D-BK@A z#_)SXK3bFLWlHu!V5nCv5brcNk(TY|*y5eKvo;uM#A`)%)N|M6h0&ErTD-OF;us7( zsJ61EdV_gOq}Vg>H8mB0Y7vDnlFf5;bM?}xL~R6frdVB(6MexMF=|a)=e8B}Nod2e zB++?zneJaaZIz|H?@+Pi@q<5$ToWdGJMc%vR*8tD~^i>r%LE zHOlLU;!jEp=3we+4F6=+wlD1-^$ImbRiyiAVSDohRfP8e2{$@8X?^B4ZC2G1Ro zxE&U%UirKsNI;11Auzf;+Qfd74u5k(=BhHqO@uIZk+VmbS$hsjCg3&N-#N!dN$j_& zMdJIaz)bXXj>r~`j^VKy#+6WIsPHz@ysVlZvZpdj16I*X$~p;z_u?de`KH)+T3q&~ zYiN-Pc&{k^7ITn?rVB;T3373=lP4y`YwmmP%f^?a1yPMRvhWG)r-(x-|JjWU|gy+*+|z zDS@{gJJ!2v5pibg#XhB6A2+3We&#N}}Ex zx>n+W8lZmrZFVt127-h98Ro%od#J;22A6Q^)4V@hEhk(F)>TUiLHAtO+&F6B0qAYR zlji6tkCAeKxe?vat{40#2IP9|;gE;XScv}zU%)q~o|G_Xu85A<&00p29veC6dTvKx zP+T(JaD0d0PHl|2v*q&qlq{VZ!>u9M@szre=2v3#CLIN1_`Kun6y*}_V)7VVbqadC z|J9Oyno_-%G6I;ubQ?KBrJ!CVzTN%0Ke6+C|Mq=72W;FqVmk_*OcT&GXzHV*}p2TEyWHB3ao}zqcPvFn*3$F2ioytP_L<#ofk()p6hRqC z2XU4E+Q#0|sVD7Pzqk?ga9<>8D;2?KGu`dOsvR+2`mVouX1;CxHHlgK>cN5YHP7Nr z+!mTfVtfjt1AA1j%K-|tL;|Fl79ig9IT~-n* zkhbvup5uJ6iD7_xnzS3SoYiR;XV968+yQb7r|GpZd$L$wz+}ZxCnJLJT)mFsLvnxH z<52tEDxerjf_jTeIFVZ@%J&uuay)6;w#>7Pa5ORR-;{GG$VT=8p^h7--6+AUUrrT8 z>f$09A3h0FjFE~J1k=q=Du-CO>#b~8Wi;9eTSM4z>`bnzi=nP|SyYVF6Y(G^mPC>% zI0|FSedT*(ymd!OXBtZB9_=>IOc_?9mhqoga`jg0ZZas+ff8NDFXk3WP`#qf(U2_( zo0~5GC1H~%M99S36vb-jM=eiecrr;Ek zg{z%}?EO3}<*TeS%K-)EtL>ZPb~)NxCDj;5b9|OAt;)Zp@;nSD<~b?tV{?U>5b}gI zrI<717^1KdFS^Z9~F>dmlWK3QR*5KW7dYbW7_VJYCh%uH^>r>T&xdP<%2 zFPLj$JdTurmx~{AEjLo9oL1etxNJgc8iqe52>E#C-Kc1F^1VnUmpA%(dZQXw*V^OhC73UzNBj(UdU4JFwv!t-fIN#O<7^WY%a@f}&iXjk zTJ3~5Aj>IAY*3}BFuj1mt-Nxr%1D6s(|g+IaE5Y&z>_F0kqx9Z1~@ueP4ksT)b3U1 z5|=!@QB)6NmK})VE1@NJj>?XY`#!Ku^zPT7qRm{#e_1es$3B7Et;+JPIybVMfGtUu zaKgLD^0zEO$yuM$)sutM|77M_xQ zxV1LQblC$3c9~{xEz_lfc;}1(uno1?dlRd1s>aofVhpbB<$IfNFys}mS}MQ&Ix1^r zPfd!s&xS+PQmu0SJZ`xiG#u%aeFu)VwH05i$Q!=%-pj^d?}FG?Z0cyBj0&p+L3Nb5M$4k(e;Yo}ruUzo3j@6Tr{|*oSI-$W{io+DOf+WvW_e@|6|_19@>Huarz~j>c%Zf^BjdL=misKYL88F3@~e((or&N?)z|&KGin#| z$6I28@joE)M7q;Y2ef4)Q`TgCZU|YslK=e*U~A*1W`UU=qiD?6T!{ZHB;czxG)E2{ zc51DH%+TPw#i*?!-2{OvUEB=LwnS!I$6!*mL}ApEpnVF?>{kfQT>GU-V3mc>jEhbC z;dVq?$#Neea3?OIL8^hNDzVk`t~d`thvP^{K3~5FwjUzQ8~J+yZS#V!NgfHd>L3$K ze&tb3Hr_VtIP&Qq2Q6L@+;Um{5Jsv|p2(m7KQY(XNB|~|AUWI80EXr`$ibg)U}lJ* z;FkE{3ZVk?!r1hHE^2~;S@M`@E^-zb2M^&cCU%dYtt-g6S87e%n8fk-&1hR~0%Cf@ zK9QjrAAuPO4&6X(T9LIllQ3^dBnb8|%>)=Il@GUaR z`#!W);{$xVQU3!m*nOR>H*y*ubt`r;q*31iPlYdjD6YCLz)-w#;4?o2+~XbO5^r+F zrnJ`pDT9v-VzPbYP-=|7zk4NDq{RVeoSxwTC>+7E0u8j1OcZ2egntiwh8BlBj{)5I zc=faPNu=7(?R_i8V1m{;eRTworKSQ$rm@>WTr3JgA@`w{%S9bAlIRuE^6THj5Y1CP zSa$=LcigW1zkfZzw)=oXcJ;%r#p(N@L3VPn^+T*vr_31W zS9Y3*McV)L3Ki#Tl(`#(A+227x;G}UpIqC_CFF{WitvJ9p{$$6emXlm13Z_7AB6mP zUKX=GQ59L5)uYWOL(JYZK=04yKX%6gNu=dm35lEA2~$lVPrNR z>wS}mLB$Q6+lzFYo>slr z5Yf{k9(ykI@Qac3a+)J#er<4Zq3#_+mM8@cubs9U9!XWdZW zg8?Vl6l?NF#L3*fW|VNP2uF8Vr>~Foe+>oht2{TY}k5lWW zhP7d#PRxeXdYp``>RQ2$Fw@Imyc)@~VLrl|;1fST!dJzi2fG)bgyG*7s#TQ6si1?d z!?a3OaEjT_SvJn55{BXZ#Hf({-d8FrQm%p#((Vt2_4Fa)%m#~j*W#gG1bP0IPy4L4 zUDyB(>t4BQ%UCkokpJpoKHv(a^DvgRs@2)PQMLmZZ~+oomXZmxToeA2*rWy-pyjCP zHF?S=kRG~N%XU%JWM&b5X_nr9?QwyLETX(F#3gI&kR=JEkQHD)UO+ieC3u?|PFD{6 z_kVr47W|onS>Je-%5vIe>nY%vPzIUW!fk^s9O3RpM13Kt32~c)K9?#@Qh8gFsmR4} zpwJ*Muxp)^NVp`)3>X%+hlS`9JP8N$%$N&Pcg(ZzoJeVfyW^K4syJeN3Sgxcx%*d)v&A zpO_<)OyC$ zDR}{z*rm?*dq&tlGfuHKo!f;|0i16gSL%#s-Mfe&A9qYIg4 z0U{z3ZiHV3ZzISzcY6)-iXY!vY&b)hfjx)ph%q`dI3LNO6lkkEHsKbavBM({SM>?r zKjk|2ADrD6$c;xK$rQ0EEP6=(KU24ptlKziz6JKh0dhjm%6r{jFXj4iBZJ@t`p_Y5 zuhp)S1o^Uw@hOP~*hEez!ZsrzjftD!8hcf^v(FxXv7}L+ka)*P2>3{n+7L!48C2tx zHlZX0$dI`4h8Hz4RHB#Zi!(ZqS4h;%dUuV0Pgw|SgM#i>4Q;6ZrVM2wnlCph6v=IB zmg3x-Y?~j8)l90ck3R}0IOJmMrt|1oZ71NWo%a|_t~C7&dWd&(j3kke$>GL2v;G1t zTg@BykdfXz6`!^ur_?84{GIsyhR_iNOb7`V%%k^^p%(ArSFZ2=^XJv5MChJeSg*vE z3DryT}cfF?rf9-26Kyb zgz{#Vjv9%hqrHOoA4C=Oab*wl9BC_IAuBBoiPY|0-j$2UjvDRB{ofz$b)~Ac4sv_o zQm>xZXW8yv?dV^~4kC_c0hg9QL1Qe$eC-)S!_InR&P-b-S`JO1bdSYKji(vUUf995 zm<_TDbhRbVOqr|v$sa^APOQhT)`I#8C&q2F2zOWfq%J!vSDvms&K-`T(Slto>NrKe zYObfRd2>8UDJ{#nw2W5su$2ynbQbrI&bnP>N7H(;h_Cjh+G@922dh2goAvcg1N-YV zgnel4cJ6LtX{nblV*Q+5e{4~Od?MmC{~=1C%c`1? z1HW0W&qI{WQO?I$(~QA~{?)oI;AV~ZB+7oo(yYX8vPvGRLMo}M3J#i1houmsh1M@a zt8LXV*w6o*CYuCbpp%pY*etkAs>eBKjU0ZV@AzB)WHzO48FJ45q3oWbBx|@tU8il^ zwr#7@wr$&XrES|*rCDj)HY%Mb>-+of?tS*@arVAj5hE_vSQmj6&wM9=R*`T*h4T(B zzgG%+R$OQ^;7o2Dmtk?ix?j<)j7?lukW1RD#+Tg;O5fqXsOAH$zbGajjCYEH6wTud zyeUVu?A!d%dC>Mc5yWSCBviXbRPtihlk<5jISI6fX5fdHcl96s*+Ze_!o1{(-)ICb zfFFUzIFpSWg0fyeY4jy(16)AiXq2n6T^F7(gej8I7LR41u3O&=- z1(^Y0jJ^Gqo65kTSh*vbRe453aoDFMkdr!HI+tIFg?_%cFmv)dvK6??WcG@l|vn_CV4B>paUuP-g6ekI{~g}ZK= zL1NZ9qB8T0P2ldR<TIZeQjYi!9T*jf z`kX)MOxELcl%2P0m(rj{E7p?Sd9+)Ic*V>GKlzt9)9OlnS+nKT@6PzfouGK|6i@f# zjkXLZ0BSfp?fE*(#(%!;{3fCzdw7l`$!bKmyEgClVC~4{GB4W+nF<(y_u0`Oj-A5i zQGRNU0*2@mBFq(5KFqd@C3bbhQ6Oy{FGYeoy{ryHR)PKkn5Li-ROG5COG$ZiFjgSl zS>o)dBktEtv&X-@%I92MnJW)X#JZ5xGj?e42@@y*m1@p{Q*EV7Lt09|fa(D8kDJTe zaV(RR^0OsG&`fPYi`oNzWI#hvCL{FNIaZL1Z3&`12jZ5jcd3)-T#z;DtHWl%A#z|MB zq_b%ZsA(JxgQmq?nx3!ueN-fJW@|Tw=Ss+~XrS)Ot*3dNkHH1RJsHt_s$?S`M9HTh^lc;D;N=>6A4}CFA zY2Qwqbo>aNVWQwa11v@;+~?|MXQohJzhGGS`+iq3BH4^d7%!jUp1cBPMp{GS<0|p7 zl@tss4UfqP&y#IZOCvsVWh)eHZs8jVyA;G^leB2M+}rG-OdY+2ZF&b4(q79%rjl?+^bpcU~Mik7)P{(Zz-uzH8<$hS~pcKy3_JP)?n8=g>Q+lX0wNP z0ybMt!ZAPlWVhcFh0%3LOHBcPUf?c0Z8AfNR@+bEesM!~9m*2o%=Ns4#E5zv zR}ss>w?W$cZCKCRkYU3J9RI+t!7#mm#RgT#<-h!gVPylZ9s0Dk@i|@T)zVD|a`yq{ z5n0Jc*i=(r5DVh+2ZA-lk9d*%_=yg z{6+G)x}@d7y_*-KaU*Mu`jP`kv*W$*BG7|%@j^K^w6qwkIyX=S_kw@dK2i`p!C>h$*})qtc)e&Frm-lmG|;%D+p)IRdhFaBhq(Z z65os!EdfGH0e0EYV-Vd!{@{S_h)2^A=iJW4i~NVu&5ja#CD!SYSgj5q+eR59&PyF7 z+ZFQmfIY+d6GaJ+b{?Y?s|c(Dst25W0q6l&w4|i`6nrh(Jq1qC35C9MhIVNnn8GhV zRvEV#lUZf*M4Y5QRGu~i0G0;Kx)RcXe(JJ)PPo%&O_;4%;yw6-g4ALI2zU5-LGFbR z7~)OFj});zF^x`5$3OC;^c__(md%6OP7&_vQkg5lC0C{x<%bkA+%fme9;G6lf6O;M zYZw(-M&W=>>tJT}W9I7D&tO3<3W!VI0S!Dh%8cqQ8^OBWYctD?JMuTJZK8kxa_E8N z`<``+xErzIGBJOP)e^ou<{R1`@6qD2VkT$}A~sEPAxA*eFff}WDj4ll&NieBn=q9X zo~i`fkq{G@`riEUaBWPX3V^hK20Jj8hZ@)D-Xoz!G_fGl zP-TN;e6H*w(Rz3=sP);WTtY}qFkKk~j(<9~ySurmlUoqP4?q9Ok%LE6gNsHk3qqZw z#gM!RX^Fd&&awrsQOj1<`yV$9Piuf|)%u64W4l@fiE7ri%fQ|em_kDwd{kH7Ps*^w zUT#J`?!8*5xLj8!EpC9&1;m1#Hu_UkbFa<4PLhZ(^kntAQ6_9{r&{a2RG#Ei5DH<+ zclk`OhzEY1ElFMilD@%ve6&YjF8LG}7j25rf6(W7bUS(CW-};->1Z#fkUu9G*I9lU{{vSQ(tR~Uc9Ko@ z{sXQ8(|*HM83onRzi@Tq8?Ji%g{ysk;cA4NaxH|`e}}7jL;t|lK7{AvWy06_JJ{#{ z39ho7#+FxVG!jGiEYxfC8xHD5Fpp!LMr_^(o8ZbehR-%K^^tENqAc~LH`-f0{Q!Uh z&=8awHPmsQ-f_h*Wxh;MmtQ3{h*7sQ--|ma1vN3* zh(KkPhB)IXGM`9C1_vUMaU#a@S$5~zcK7-N~r@$w>@&jHT#8hqfkqB~Bz?nu@OTcN+k^#>B$jA$} zQww=hIj0)86H$YPx9tqel%1*oFMdiBLrc37>f%?P;5QqZn}ES;S~v5U^HUBkuFC;P<%Ief5|nyXDe1IhLn-Xh^@ zqiu3w;TopH6A~DTJa;oFysg-f5=K-I9;TQVZaQX|m0$aWhZ!ebCUY$7<0d`df)#(h z8t)ut0pe;IGA?Y*-pDv4610keKUQN@hp}IXTjbeA#`;vW5hsKG)Pn+CS3`cPsxx+> z@Yclu&NeX5%^zU1KrKc`u=^Q|PJoH3=P-fQuB(QOKVM#arJu{M`P-~P=x$_efj&mY z1ThHh^J3Y&Kt_v=JFy3s7h)1G%aD>6t=3=)r}-wET__rG53M?t7zS&wM;)e#%h(Ms z-WQN%1kdkwFTxe|u4X+kf(60No5Yl&v`5X0!*g1PYn|YiPOZfRZ*1&sV9!*Y43G zCqMSiAn*O^_QxBC*0TbqW}wZ&xU|I|Js8)%H8cZ2M|xOo0;0)w2;ntF%XkWH0qSTW zb8lhm;w@+2&-6bfjjefJlorgXM`@GfgEzsgf(fC8;W}!}f(@R(pL?YUDxRHD#S;mB z`itoiX2?IO_Ty;+)P;U35I}$M=6!J#gmM79{;3GhOON#Zun^RCT_v42I2_`0ZQn8M zrLK0$(tc~a(Gz)+B0%Eb*&Ci<0p3YM)1d*ErvIct5b)+k@Z%s7_DI^xR6!izaO3q1 zA3~HgjgsU5D&g&M7)f+Y?Ho*Tyr$lTN$n*XUEv-Kza^R|*rAfK8(-;<1T3iQg~BnQ z2fNS{pNt>w{}!Y09Ui9&0m&qU<>)hV2eE*PbnRs0ZyC@hp#}kweoxYC8L~W3?8D<)A#n#splcflcL92%1D7# z9H8sy(F8W@u-@-Y>l~f^FyQ^$9qwoxZB%grRh`5q6zeXnI~J(vbOcC&7m__t3P!?Zx(dYdN1x(5}9WCEYfu%d_BH2TN9_KB+E1KssGQL0?zfFH9}42kK~|<|=VhYM z^EH%P&Weg(;=a?woED;s9GiFqdAjh9pG(Ho)0nXx(-Ft&q5^-kMLNVD=wF3cu8)@n zU!wygS=g%5CSXHRvmMva#)W}3pT-&uz^+xNX6Tatg@LdcdQyCk?khDoM`K{{=!)cJ z0sBitA(au#L52IS$X(>IrUm@Z{zHuB{a8K}@t2xetsH-MJ4Q~o&*SIj%X(Bsi{E-T zh7YXxeQ((a3v!V>O6p-( zin!9ZgVH07-TbUGe_j0PS{$4WJlx6DFcO-vU7+yW_=_*NiC;?+>4dBOL?6?s8GJdv z?$4vp5A@s*{BpmZ&Kvc7UrtYkqV#lm-X5P*kHz_Uxj!#o8n?gOq5m@(61eIv17dtUA;<0H?eQiU2tgT^>Wo$y~5BF?t%q>_Nz6qAh?Y+EX>VK7aqT* zI$j7yQifFA|LjF&lDV!8VL)?XTJXu2!w|pUhI%;tJf5ERR{>$tlwVk){PBM}YY;-M z<Mt8kC(NMl;=A^T2$0W`o?&Mmco3Nu~i3cgDkJ zgXY`)B)k0?_hVJ7*QQG}kBqE#$Yd`ed0)@eS-f@oQkDuW$3F$u|bpsVK4d1I-{sdQkQ>J9#I@RCrkIkQR%TU#w%B}38z{< zh7=q91*Ikb0;SMM-}y~L7YU7;(;K$*cl`6&CYGvGzM+#lq`G&F0Fe4AndrN4*Mas;PX3JxSVh5J#@<)Y6<<8M%-jmP` zsC%~LskFnF0w3Dug2qYU4O$^{i{)|lgQp1!%#RQuW7%JE87o{gDFtI$V&F+dZX zXQ*1o(L@}5|Gtvvh}Df%q?@L9f5@==hN;bg4l2RBmbgNx_%rFG7`<$~AsSpsz8a9D z97U76HhcKM$CfTDe3I7777wuLiWjJ^!3H$)7WFcAeW>3DfSO{RMABg-DISFQZe9g0iCUuA&v;)40_5$K1*QY%s0Y46T8$_J>r2Sz80fiI#wPRtchk z)4AFunMj@6Sb06v`r>->mUV-J3#sJ#nu%uZ#~ldUN<=V9k;7>Wt7G)9NxBfPlTl#< z@erO?a%h@gz&Uz)7Gi{e0asd*(Frt>S)PS+c8nI+`@*+fbMrz;_XjCuV zbq+DlLEppusW=k@KT~?;^+p_k*!CaZ10?7F2vn7Oua`cle+g7RTNnmH5lGe{CWWij z(IDDV0PIFlv@r7Lv1N$#z&N9DT%guuqSBopA&IL++6%a5yyb8(3li2}V80_o+pma` zbMw79O>1)qSQigR*KA2D_A;%L=<%n`C0$7S3)z#M%>cek)t5NSVvgU(r#7zU)ds(hmjj=lPk6=2cHg!yyA%)ZJsQ$&q#fb;WMcA~Tl5 zL5GgjTSK^3K5~9Qjp)Hx7?mqMRnSf%&Jp9RHX?Dvh*x2B>`YarvmY zK|@Id*cJwIyp))TL5DM2Y>$m%-|XF`YiDaqT&D37QQDleVs7C_tah%)rr@IpykB=YU`@^mE zbL%%7cQS=TRj;hZ+@i8P9dknhiX67!PumQI+&Xw&YG{_K(N8$)sYQ?}gt`}%(Vj|g z%y0_#sXF*=Veed#ghEhFp+F{b-DT8O)pER!wacG8Zf*;Nb;Uf`_WLWns3pTXi!U{|x70st zR3-^3@7!3?zUCO+@LK&+O-QX#*!A^K_Wnc%0y5QhZkGlb>!Nk2ZQo+d4Z%*Rz)lkB!n3UgTXUOAy{juTIyaeC6Y zf=;(0KxM#TxZCc9JHx%O`$gB;ko}bu0(O{?wnbGIW9&^~C0mv;Xjmm_Vo#tOA4$Wp zkheggf}Au?I%9ojA0Ei@o#KX3JVU=o(grA$;tsdm&lo1BsMj)Bkrr*lFY{o)v<|M% z5a2u6VHTEAio^iNSmH@M@G15w!%!&{NmCpon61m9cr)2LFr;0GSV@Fjj#HW|xyin# zLuTn#cr`SN0_F;C1`A05;r;++9cK}#`B-2jVSDNDTd0yGHpRX zE|cnk&$+nKP171x)Qh;CzA2<@RKYdRfwmCVu~Bwr9k|kvWX?vuDPAF=@zoBmYTJ&j zTzKGEC>p05Bb_}iRC3ToH&w2~!2p~|l4AzVL4a&K?AlDvS1J!WbbEeC`5I1=tLMDt z!N4~MvP1?zLM~~zR*2ZSZdzm(htv*kf&F0fCwqr$gqAJ4;^n^aSSNU<+9hi?+jz3U z3FWqr?Qo+w`%|6?PMX7tFqJFrLtyzu0;l+(NACJWJ5hD1q3c}nqKf8fgS2|McGs8) z-cg3-wB{;f0VY_odS(M#$~M4417WJ$!I)qK zy6)v?i@PiM?r=Uw+UK`V($ta|4`q)D1HYzH=Imw6d?jEw+4tiaFyhi?WVQt7(B4N6 zGsUF^Y+a$gwWc&2gdCU~sn#d4uB~#*n0h5Z%8B;2fT+FfH-^eUd6V9c@9|-53r^}0 z$6{I}tpM|h*A=FAxHG)b2ECzQuS`(Lca!HRX*A#UM)P!97w5|U+czyOWzltVU9E2V z)lWKs1%`?vzT=M_H{t}*pVp`)ijJ3JX>9#Xh$YlIc++Kzk;SP=_Bi{ONFpPb)@R!d z*#3inQ*w)UOC0bad6d@tyfWFRa>i?-zhZoVlzv>5Oeu@MErL zB4dD%%_OYIRho-`%EM)=(l>w$8MbLI0?ANiyG5!lBG>?gC|cP3`q2oEX$_T1!5p4K zTae`WOGclpfAXA)8jfWuCN(-L>4WPoUOA0d1n-%Ur~;uPlA_>J_k+wF4KF${&H`r1 z4)EqzF3w=1Ii!sX?kZ^*$l{GmRI#OJImrm?l;hy5b_Pm}0I22svH{dM{j@z-bl(02 z*y!g@nHE@xJT>I7pgT5)a+mYsiaJpwVJMNAraE8*yFmsj8ED2d5Y$eNsH%5?{ERP` zVJ47Hc02?RaLTLvl&IwzpEU`r#V0zuJX5}lfJCWFg;doJJ+ZO=Ndl>g?M9HUVfI~fd>~N zS@r_FPXxqxmqSRg8{(1(n1~40Nv!|;9R6Als0_Uj4|5^;D+J6Ym8%>n0K~UrGTO(Y z8np?y7*2d3nd`kXo=&b?O%O|WT4JXdvp@rBIuXII;rSvd`(A`sy>k>#(wEYDJGh*3 zY=TJ66wP~RV@-fnCMTyszu*TF-`jT_F*xKqju;H<5bQWRJx#X=R!`Ga0ys`v zq^qB0%ET!nB!v}D{cx_+r=6>jajm!^rrSJ{;40zMJEEo-&8OQ{OM?-+T^DXxBw|q> z%5n@WRHD>VFJ_w$Xd-MO1MPAcrf{YQ>W*m>DUw8o#5MvmXpKUP`G_Ro#E0+{DMNfb4U%)F#1yeP^Ft+lIuWUgs@el@wL2XuV7X4roKUnS)Nnf_5jmy@Phcz88 zwqFcd=!ISs#*O-^*hrJqj3W*ckvgu#(5M_Fs+L);Kv;6;VK4A^f0#{lCU}F&nMsQU zvshAA0HqN`nLfPNMn(Mz6aOH-o)2@P?~Xv91!1Ny<|yHDPnJuDh=c3C_JM&QD-zMW zW$YXWJoM<#9uM5-G{7=5PV0^LFZ}T}uJ&MXKZe?ZQsHpAmHxZL70CJk4UX6l8B^Ccs<(_XWWJdLWJZ)RhI~+%z)hi!XNb zRq1yDRC2OCmAZor9%L8%GJ(nyu>}WY=&wc8=-*1rZVRh!I|Jg?^)t}9?REmDVS)sIlw!!G5xARFd+}J3>UlYIfF)g*S7Npw`)3 zw`PnBg!7wy{QQwmnN#1HI|wb)G2T?x#XZ?uAK6io9$?ph)p&Gs(Na7PQwGrkKJDb_^J7oJei|3g3wNlbSf zm{7ZiqcS6cHWz?Djr{X*fnU%p0+Av2Hil)n%fu7YGyz{HxfM(%zjTPbWG?EJ$I3It zh_>Q^T?iysESyEin0b?3$k;2gyYF|dr{C}xI)4N@^JG>c9RxSHtUK~_*YQU$0IQg< zm~eaCzNGx~VoXX7fBKH(@RudV=a*D4uKNb!JJ!l?LlK-lXz)v6!&0s`IMW$tG;;8! zuYnh$NVvFIU$5JwXc(#=0jRh*-*;FJPhM{Cw_{lqBdVBx=POZ$Wfhghzb4tbER-EB zhu{$VT+geHZi>Ih`4_e?3gZlQ?Rk56TD;j`4eQPA<-z{Ee0ZNKUc*xn zIDI5JQGKn(?eE>gd|D^_YCw{zgh2(jc?xU6{fyZ(r-Hi2uI!Lnh1G2l95J6V=~*v- z3f=Y|t*rr`UrK^7Z4F{GC7yMW0O0M!15$4g<=UC~l+g1dv3mpQv-^s-nuFF#+%@Mk zNB6VhP7gj!-3{ERz$C=S!TET)kbtM{sv8AU5Rh@V0DWA5HyhZoV$d}vDdm-4{xKVQ zRf$RFPyFc)Ly`LTo!6%Ldud4UY_K+-beN<)t~V$WMel;@QKA-!KY4$g<{vT^#T~#` zDUIOmCm)t(uZ09PvK!X3NDT&#e-YKE6A9|Z5{)~_cV`F-4_j8mCnsV>@+7DyrF@R7tstv<%WE>87^0&7bnIT2D<))d%gy+4P-Dx- z$~|RTx_ZG9VkXW#b;cd=r*qf(DPu~van*{=YYN}Ewmo6ku6sjk3xB2dDe}&{i=U4nTS-4+E+g4urj9q|g%;ZToWZjyU!tmPoMJ0I6o?>;~Gf|R;9pUm-R zlMT1@^8O95vd#ramk;&GB2Ws&NiW%##5yGA;8gwUCthZ??7pYv+U{;T>rsy%ldTXp0588?k9^~^hG~Mp?mGO@%v|%&x#efi20zeAH3jCKuVT6Y zTUmC{&H#F{iy zTWVx&)|4r~>|RE)J*@a~_hS|K?7I$mnPJE1%r4fL8v*gR>D2Fn|1nhSayy#6iQ#e; zbz+L#s4HWp9gp}f+|t(HW@{p9t@ubAh&Xd6GJ{n-h6wai=Gl8T7d?(Jnx-LW^fP3I zaO~Of@SlG3ScvbWt=zGKz4NHBY(4tO<#h}1+%$jGWr~|jS}Rd)Wdla&7pK>4lms{1 zRe>4B0E+}A_3d9G%ll1aV3HW=lP)a)5il6&B>Va~Ly%1BNE&lquvOG`PIC2zYYLf$ z7cAtaGEUk>&;T&G09b(XubQ6 zwL>pD({FyD>y+#gfz>8?#)g(eWxqv50bmg(u)lO>Wm)C(Zau1qKyb-=wk6&q^KAGa zp=#jy+iu;^tYG>$(7Xa>?WH&qLXPVzg$iSv{V{C5KTF2_dL$JKML|u@gM}JNsVAyM zk@iYY9mD-7@x^bAA@!mlDYgw{#vCP3nS|S~<*cg|spSq7(IOP7G*2+E69H6`BGYx>W!`=U%6 z+=;3=s=$0lF3cu2MG1w*n44pc=1R{4hF9A0rIxGIimpG$Teky>sFK~5oXHqTy zC`9Kl*N`@%Mhmm#8W7r9Qiz4ROgc(PVh~wa- zPnX9|7J^C^LK(3b4{}9`SR;|xhL3kn3Nj%}k%W^>Qj_tAqG$n$a0N-Ku_Wqg!jfc~ zGPOy9(p(YiJeduT!(3!};*v~`GPT0>M+V5nu@%(0`#ZShQQG~Fz*4ebN{Kt=k~c-A zzu%;8n$8g0J5tTzM*U8J9RYFK{CIS2z0t$=i*1^{S!yI#=5eC!ZuPYnN!nlPjQOiM zUYAHU#~qxf;d`W=XtSNI7N$Qqj_JmtTx8p`=Y#p{n6JR~do916lk-9KHisrexWC^z z`k3)#sqt97uS--j<&c_7LhXn}tL|89i1OFQUgT`?prD8q&DG(pjzM6EFPa8V$Zkv+ z|W<8!U<(G`GE8=tO zj52MCgUpOg73#H9saPFv|sv(M%Q&UdtqC8jB7#=Yk;Xo}k42IX1IS2eZKdjKjtYI(sBXwGgGt#`Edj(AuL4-)iPX53 z=T5>*VPZg$2l--vcD*blON^ zkU-#U)NOYhGLVG@_A-m;gS;SF0<)(akjI!hj(28o&by@o5N*DBh?D#Fs)cC!^FRkT zNGzpVLWJRz3NY@!KfzG1Ov3?l^vhQcAecar)7Ch!k>n4(;P!kVNg-$xs|VzD9Q8=f`%m!Lf7R8V4(@O?O{dCCPmF=r)_A^7vED&r&Z2f9RO4yXqWs0q5jD*StJ zqM)CZ;C=?TJ#$tl7_wUx}Swe={IxcF@KvPsd=S>EB zBa`Kontb#*6r%}PjrYYx1mnil8@$Zl>SYZNbMR+oGo3&zw0__)SAf^`4)!5@GU3-A zrG?2ytm*(D!mS)QVlk8?IB7OeMwwwUd=lhCt)m3PDfr#M1CD&5{tinbM(j2kg~)#< z^$&&#kd7dpsgmSZ=mN->0Fw+dP%w?7ZhRgduCJzC>NQKd%>>Ha%w84hpm#AcHZtY_kC!vOa1;ao?_8 zV0a+X7XpEA6yXd7nBX<@&b)&mrY*pmImLJqMt?818Ea>w=B2&P+diMtG`Oi8u6`Bg zEZZJ%Vxd4!O1qP^w8qv_No*&p>gdtn8)A+-Iz=)woH;D!O*~iDJcWY?Bag`X3}Q#L zVJ5%ma!YSikaKpk9-s7bX`OZKe5-qwZ3?v*pr%WMt%OKM;Z+WPP3Exw4=}mu;ID zZNw`^p~0cc4(FQv)SbR?`SQB|R@dx375CbO6l>%y?8v=VZ)oJ?TbDV!?Yh?{ zDxY&~ovS|nSz7m56RcoGL_nnP--|stYmjHl-h>jziwZ4vEwQ( zmYTpX!oI%8-_-cuAt~3NciGc5Gnt>kUBT!RuZ%c@mKlnUV0t)%whu77{$A>!zn7ZX zJ$om0ddGz{gZVkk73}Xxxr6;ZDF?8>CzbWP@QD_geM*675;=5cPFl@JhpL)H#hAe z=ByC^f@JEtBPw;ypMx=z{!gUxg{Y791DRd>OFO?>Q^LzR{1*BLZ}aKqUV9A63RwvU z3r|0S*n(tw%#QNTl+1eyd$|;M`Ep^c9anR!tLbsy+$N}%0BURf!@@aGvfrSh*39L> zgW8m`goeUsP`(2w1QCj=&!Kd6PkOUta{^U z1>lXAx5(7IMZLj|lH#_aM%5{pFk@5IzlAM~gv+MuI{LhD=&}ABUOmV_O9oe$g<2J} z-x6gI49DwS{@o80!Wox>GxDmnxg|LdGq253uB9B~>{Pg11AuMYjS>6K!f^f9?0*+3 z*&`|8(aob3VHJdxMRS0Y%mLfsj1-ZS3kNDeT^gXFFtW*(%ku=4Z}ed2b&NDv7RN}y z54$6E*BSgZSEAA95_a%YkZ-g{8o6wStHX0;_}M1_J4NVk)(iPs)gC?m_+S^k3LB(;yY=eY7a*v_Rv>Th2M#^($|Qh`UdRSX6=W? z)vJ<12U+HkMOZx%C?-aF(@ge}S;r-oriu%`uoOr+Z8`9~tFf?rq@Mk8-iFAy0f)O;6DBBr> zgrumZIZ~cQH^+&2A;SN=L=7E=W#}iIeBFLmt$nRlrF}((ar>CkF~Y36=elu!lcUK6 zKMc&1PA)@DpYzl*PI)ZJfWJk$G8dftRBUxOWq5(DN~?A_K!!*@G5B{4A-Mlwo9BQ% zlljm-O%DBB%4j}oA`Nvb$SRi#t|B$St$sYeJ-L;tKn{94PW<a}jqzotJg4lpOHMy)f>b`kuRMpKA;Q>E`xYNf3)p;b|0P-UI+(L1l`&A>oA z7xhV#t0Gi^kH>NA9j!hxR_7@etBXL5j6{TE1lP&p@dd0StVgZi_4Hv;y8hy5$s2mz z#-vjflyN*B>&obe@4G`S+qdv8&&2-oyFrs@3Yv{f7L-hQ-Xr~b zw;Ms|`^G_esWrC*HBh&G$R9w37|V_NQ36@~kPu%NEb6s7rHoRZ$B1fIXsYh&ReuRb z>hZS^5^iD8p|f+@yye9DCTvD|YQjmudZ?e@K~8@e@n0vqtudj6b zM#p9&#p?#`pPmFpQ`mbk7S)pPi(Ys+(e7VR$JuuXo*he_<6Cw{7l8Oca@LIe3Xin| z_4ZX6^h8_?hsB*f1-uE{-fdkWf2>Pou@G0M^UCO0t4)-;%Elu}f($E8GDtg;urOYq+t0-UCWD9M zJ{Ka!h}YTcR}GzK9ar>kz#P99q42J9W0+uBj63B>$<1zt& zXjvc61BXhFn@qM@?#^oEYWypei%nWRdWHJd2a}k$9(%d2YQO@G(Nh)dIruHRAB)2Y z&30^?sZRDcvM zi2S0uNgn9@hEPnvYH=3cQ@V2j0+9Pp|A1iz`~bKY#R)H9Y6HrZ;$OUq{V-VpN7xAi zqxgOb%GS5&o5+Au`rW#>i5=dWYsyc|b6uOwe%72_L^+TU^Y(1<;K~&Ya{XE~F#Fiy zK`L&DCIJFO4{eaaD(<~_dQdSMZC+#h5KnTuKGAm${WXaX7V$9Ap@H8KYWKep>dIdn zJL%mZEEl#voRvIUTrb3o>mTyiyArjCza!Mm-Eoz~1=0cTzw7v-(EUUrP0xV@#O1F_~I)HWaDco1W_1wVP;gEU-d<#2gh~zAP ztI#gfy`;@n>zXMXaR$t0-nWo8(mqC-IX!(iqQ*Nh3k#go3~#-sDH|PlQ{W1Y)+2Yl zjR_-GTsz;jUWW|*?0z%T!4t>h8c;f%^Wwio2kfG3|M$@W9?w&b*n)WN@C75tE3oeX zHU7T?)Ul%yBg*io=I|pfo*XsHz`!R8bf$42(TN*S_hsncJ0ZHZ>a}=7H#}Ou%;MQq zc=3K^)(@LUH!opDT?lCyakNBQ#YnhrRxuK34K<6AbVe^>{H!jp5m`*3c`1;0@Cvb& zWjru-C=pP{&&eIiD#4G0SA<@P;6>ueI^C z;|qfOdNm`(3V9^SK&E#4e&899(_b#mLe|TiINP<`utg9m_A4Y z7ypuAky)a=p8U|)xTEe*vHF+`uOvIJbW8qPSOsStX3o|Nq&2H9qa$F~3$ku-qt#IU zR)biL8pP0ub5rHL?@nCGeY#BZy8{>ePqC7Qa6xFlCo2|(6532g+3i?75L0%w`Xs!l zWrmkn&FA054zB@iqR7_}M%?xEXw)tL4pFZne21uGdS0U;@b@_pzeCj2e?!zV!ErBT ze?!z!e?!z_&lKQ?k=RPfLjMX;Tl@`CU(`}O&2BG~9an-BQvsFqoeg-9thB<4Q-J{T zm&{5l{1~OajY{ih%yoVh4;E6;7WYA8=dnoyTb!nfNu^MvuD$KdzZ62195<*TTw0MV% z*u#r68mErOMh7A9$pFC^TRQK~h7*ElDm=yspmpO2<6wx`cW2JhRgeC*u zOR3V^`pTm3ApXK2@B63i#Wsufy$ok!n9cIA*chA!j9cF(sty1)&3LsUIGo{_$k#=> zT+omtaKX4CVK{3@_3X#-aju6Q*95g7jy3c0dA^4BCka6jU*yWAE;32war9RuNI|5W znga_Y5~TS9Y5}B*v($<(G{DjfKa_EPFZct#_yPjBz?Uv6B8$>&EkAAe1f5qMcU9NQ z2pziigJa#5*F#yKRDw1b^a;7+2tawF4qXpSxylkQJgRgP5zV^} z#~Tu;^Q?!4H~&3j)E$wFV3@Ej;?^xcEk}P8%rkzhIk8;v!bSx~QHVS#l!5LsMGmyr z9hw~k{~IxXAZ+dbI#5s+5v&gLa!Bz+m!&gww-wq&G$Q{!P@viM-Jovz+n@%aEuEwd z178GwDMCRzqf^tT=<1l;syf&=mntn;Ae1}N4I=f1kTecj9E?g!EijVh<=sWJ zDGta_hw5J2a!!XFx#X?HulK2lfezb9|1lY|hmdtG{?Rs%pg+R$UinVZBWZFxk&-7{-4ws50+5)4<;+-Zlprqp-y3Z~5y zV=__H$vxJ2a55s()e~OgYNO5hX^+Cq9Vx;WgKY_EJ``O`>hK-C*Ls$gvx359@XbgQ z461IaQ1M|i+uxuKKUs@T07xl8*x|zlNG}<$@pSqcJ?v`1&QXx_} z2N>m)8Gk}zgF~c%V3{GtNqtHTS*kZI-6)Y1be*wgM~B1g#xrN{a5}c0uWRHZlbhY; z{Z+~Tefxzs=Ei>r+e;G(y; zvtA_TjGuA|#9ge@3B6o>Tu*&dLHEQD))%`rGKe{iZFpDL9_X`(PH5XtkI;FXV?m(Kwok`{t>Of%3a;WJp=CuC4Odt4iMQqHZF zsB>_qpD#_E(dg{9d}qJEGd6Uc&isra&Iffa!+VcEG-h@;SRRiTxUoIvs+BpMSH8tJ zk`V>9(GqvNROVe~)}dA4K^xA#E#Jm(VvmuY)QoF&5!b?xWMfCakK!iP=T zV?488V9#JmR~5MpDi<877xAqx6EXb)XkH*;&>Yf~Qi48SZfdVy{$w;Q6KPzgKoV8Y zZZyC}iPz`$?#D5bee5e3QCtUTk)UJbp%cuW3BVwpldKRJw&@dpzGQB)$CTr zj>zp&CsYZ!vugs;M%TxX;OVH#Tl~ipJy^QGr0eF8+|qa-Th@?HQ_5MWv%19+Vqy~q{GAngl8M*@_F(niYmW&Pa~v6zPX(K^kS zeF*a^BnS$T-5D%1FV5bl5@eK8A~^r2pt?tb5+SA|imQdW9A}E1lI*lR+v>5%cTr7t z!2p?uZ?jJ&m~Lk2Q<<;kvKTyCMN2m;1N3s6C6suyA2gx9!uNcfc5%QY44%za)Q{Lw zs${shM((t(UxT!dQnLlIbHi+!{EVLqqO3*~%$%$Cp}5W6$e8AsE_- zY4Zok??pnEIni8+L4RTDRtBgOZ5d0V&K_UGe{cyvL5+sBaK}^(_*oylaAyyaw}jgj z+1n{`$m&@9#;$QMeq-17m!H`6km?`U_4Q!zCwBdzz!FDRIu>RleLA#O3kEegbo_Rq%Z~0LYJ$$rjLs;Q+ zXfU|(--iZEgR^$iLF5vN69d!5Dj}nqu-5vW1-Ut{sjm19cO7Fi9%FY~3-X3a_m&m= z%T$C;%cl$7$;%W{anqj785cFao7bvbqZRKXs9FX}b13o*(NwXXZLSZ4skPh3FE`tT zkw(3p8f{NW3_pvyR4v9Y*-XTxJ7VEw7^Pmi&zL1HAuk#e$`x!MG8iA+{hdq|l4x~z zOf_HU)A-NyNVq+GH(hsoGP$wrw>N1_rm`&~n3Y{&Y?8$0NMIp)VEoTQ_$=L|2t!p` zl6GHZ_yycn(aYVws?s1quL_WQBz-XvJ_Vmuu=>8x>&&?n$6Kr5=6t`s^LqC*IvdIW zGJfDCXW2=r{~pn91&95WHwe=X2XrN^$Vto2s6F6Jx3m>(eOc6ZDFMi0h~E7}wGP!+ z@};w7wXToDa5d?%6@guQ;h#v8%XQ$ z{INE$Jp%X-YlBPh|GYN%0t0nr>-&#u16R(^wZZ88pKF7BE!Tfr8(b%zEOGtQ+Mu}e zb8RpfOCcAM_%CY%RH^^6Hc0DmDXwWA>;+>PE}E;ewQ#>i-{JP$Ei|PQ1I%3ElpcBF zYg_*+pQOTWcQH1wb@w!>s2%gF;(udu+RC6NCppT214dHYF)w7e+qXihk&o}WKp$J` z&c<-vb|V&0L1ChI_G+VZ`C9$W1w#T$`|;IA|5fax6bj&d4gtg&rt`~9$2t7n z@F;7IYkPbR$HVKjZv~j*c4#Gd@yY!sGL#zHSU_g6h|uDegM1ylno#()E?xlC|1wZU{jW%n>Rx7OYJfBzk?cnd1wa>FTd7>{W~~XDrTB8pF}&XB&bv4D+#w zzAIL>KO8O~;P!nALmJ;&8KwBl*ddAm61y+6H2lRHg_(C@i3fI9{qUleHXN`mMi4+2 zAL0qJVNI)XP+U)4LPV^;RS{jSut0ooJ&|ni!6{-~M5O&16M7OR%akVeG7nNe&>Wpm zYfGiHLRgIw)KC^l9ebK}&P({BfL%tLOGhx-CgnYR?aJbpuq-Fs_!YaevtCf4&V8qT z{w3zu1&{ztuIc&D4LA=LLKWm;MIABA2T3{fqGueTtBmnRSmvxiM$NBo=n3&^>&X#XRb6y2 zFufii+Hq*_m;%aBnRL50^4f=A`DhPQUUVeHUoUEY@Pm`IKcQ5&l21-D8wubRCce*nTB`M zhz|y-Mvpo?g(xQsRbOu(<{Qp6KmD&q-$P2(l(UgA{_w&E;F)NB8U{j+>|j^uAyF=e z+v{&|P9X^G%Bt(3e^~ef< zV~T>c2Jegg{V%<_@6iv(z0HXmeWAua$%%5<^0;jyg<^iffg6F@h!P^f9Xoms@xUWD ze(dp}gFky1Cx+-)@BxKW-{UKfdJkeL%_)BD&a^Y6Oa1~`8luJ)>SO*UCLqivbcFi; zVrz6BXRl0U^l}Qgq5`Yj3D!p*4GEo@y~5MODkNCM;@14K_9f~GiTh?Xk&+%Q_!i@I z$$wT~LjwhvuT#>$g|UU9>3vOW_;zWjgiZ4iO1BQV`~2It zw#1XG=B7Ge8ah;t17)ra61m4TZ(^Xmui+CXCsX0gk^4|Z^uWLH=lr=OuOy4b3rtN# zFoL(yAbFk_zJ{Q)IFv4Q&S+~S->Yfi5MdkmAxIv?u=3S%gDfAEg>Wk#B#1LI1<^bE zl`;(}0LC?L5*dv`Oa|Q7t@%f#A*zqglJqNk4HX*^$&;RaDDgU(`K#~G6H))7|5+T~sVStWOC3Wv&;k`$O>SBmStHLxJj3KE`xsO&Z=J`n^F?Y=iW zjaHh%AGkH%-*D^NKJcW;Pu$w<6SszD7>=wMQ3EcRn%%*YKNfV)U}_(zMpbymBJhzW z62K&=Nj}FSsNw9_)IOAM=ic25&Fl-sFq{xY^GgRNYYR5o`1Do1Fp0Qxv)2Z%h{<11 zgv2K^B`%3~J(-|CJV|wCMV}Vybw%rf}1BHb< z+nvOOzQh-Fg}_E+;C$HLzCJ!#4Pq7xEMOc?702;Q$^8&<7i(lQ{c&^37ZKg@U_!Zf zPV_F^HNAF15TPTE9)Agb6R(bEK9BKRUK$A1VsXEuG0x6mEtZ^M<>@d^mMJ-DZPA@MxrJz)@Q=XFV(G5u7g0P5o-Z2rB3T-%L5H+> zGcxxJU0VoUH&YzVfGeRU%qR5yy&@;&`K-v*0Do8H1XG_CxfQW8e_dt1*YB)d(doiG zmmaMp1 z`j>x&h{fY=R2cI|zBLk+5v;ISewO16(@Q8CpNTo?rSB>VmWMU%@5CGzX0u37$xft0 zA=$$$Xt;yK!k|!5Ai+%C@IRI0LZI*}K%xkcMDGK7Vi`^rUhw3b?{>JL!c>w~I^wr~ zK+7--sbY z;u-YIGHw!zsYLt$p7#er^wa{OB2tn5hInG&rI=QW2u4n&anA z+KyxUC5=`I=aFb$_3@)WaILIg)eMU99Y5A3+4ikiu&A$I-dvKf%I2|!}kjI_|1IXA5edX~Y#G%9+D11^6h2V(p z>P=`x8pz^C6rZ?73dr&_y&uz+HsbRaqz}nQ(ZG%;K`Ht=+nD*EOL2M8#1&Oy0*@4$ zz{kXE8)WH(%lag*Yn*{Ns=yx~-{M~0`v$(&UklI}M3d*|_-9;kLC6p#BeP@Zk$C@7 z0?(tu&C&jJi3si$S4@xPo%fQ`z(y1JrR-I;d`POsQNvpD&#c*~yNDy)as3@WLvf^9G;MUo(u9xb5SDP}&rm$#GZY8!{tU$t zK11JCJ!JTQoCw%i@dIbr0xAwJ`UE{qEkZB-lwbsoVjp(0Ri8}L&A6Edu5Q_ z%hF3h?L?lW&3L4^sloQ&u2JG@|18&4ClHvJVk^XP||-6gv!2XZVLzg-X2771GtVHoU2FS_WXdoAoK)*q<>oG2g`=0#qV*^PfAN^v+BhINU{S*YHxuY z9UOMU~vF$UC+8NFMO*8n_Hc`IF8uBeAgjLeZ~g8t{-zer8aO@OI-;!Yci}Q z@btsF2FkY`04yhP#FdlhZZ}Uv`gm)5b$VIfcc0905w(5gSeFl?Nz(>UMYz1Cy+j4lFOj*mMjLc!{%XDEab?Iw( zRV2O0zGZBXDtg1l=0M?++T0dE3#F@Y3#3`w+~Ja0)ez=0r1+mfqXp2)y`v7&)Ufk1 zX;x&-^b!bef@BvwC5iC*pdQj6&w=>;9AcHS;~5(iMNZ2n{9}4 zn46hvfJ~P|#)k7xUqtv~bS(hDG@Ff=RZB*)dDDDT(BO?IIg+KY22wRAtj2RtfumOi zoLsdT$gILA{z_zQ5ZYJ^=uQD0G!kcHZ#^m?SrTkhm9SvvRrVNhFt9}U^d%rWV!+oL zoX_ziYaBn;D*AiTGjhtsQDwxBrb#1USJitXvs3ZG_x0-$HSnQNl2Pj4GOn*A-$(*N^GLoiGD#gF z12UkQph`bL+}Ho29up`?Q4BH(|Cr)~)*v2ac{fKDfWtMm!_*CQM{JF8j{@k|Y>tTU zW9Rg2MB``1Vh%OH5tgCkb}d%*$|#Rxv)9uZE~3EOMFzehIvzIDcC58^c=$>$iUhh&2W)g1{qYLu!?1r?5#Uu1q$H56D<(u+~EM=Ky#=|vRfy|rkbXl); zD9zW%Is&(~lh$Mk_P$rQ2EpO>k&?WG~bza=j0 zzF~G12qX7KP%VCiKKb+lbRa0}|3Dz!+8H1HGuiro;=!0TqJO4-cmAY)lji=Qeu2ov zv$6WRhI`%+uIkSs2|S`LL@lBbwt|^crC4`&$rt$fMN&k`qw%!eJQ5(h3th^#Epfek zAowkNE7v8x8@*BldDyoaVns!e#so%jRWexcHf#)6whwyEmkmPuOS)YK4+K>m!+fYS zBm5%oN#rnu00~aLK1jRgz%T&~hirgU@UZNMb~vZ`kPtiaSlf+ri*!R>lW8sa^!%$J zQ?-`!R&BQV`OmD1Y+01f#v|mIKOkWwYHwh+g%>&tl$mK^7qyE?v#aS z`y=Ay)v)oF1KVMD?M~g9_CCMF`Z}RfXQ!Wk-Etr?U*jIeA|>7_k&JbLl$p7#qN|vM zWdDkz&`XYo``yZeNLg@@hFt(ga|>uF$U5R>XXfO_!WIsv#7}bixHM6BdA$4ym3e-o zpbSzsj(}-xaLiqwRT;;*I67PZ2Vo_5V)c59N`2fMRuYZQSIjjuD$z7ZiG#eGZ=0>b zvtdyI#)2mlsZcW^JhbZD?w<~DiuIokaNvJ;fUAG~CkGgP0Dfyy*LM8x4zT3wKRUpQ zVN6y*q51WsHhdS(fRQ80xO~!!E=tQU7Ga!Q{9B?uBsV|hKiIIL0t=rAb5i9rTUN3()0XgMf1w;MU^T)E{Hg+Z*g)JrH z?t(t{5+%QK%tQ&nL`Fm#m0IjIm0WDSHhw7rZ%+@L92S~QFF2wj)>iM&V9-Q280znD z%!Knr9q%>9Q*cx+^CQL)QHk!wIMfG3q)pmH=(0`IpbJ&{j#MzVkj^zA&9=r=nwVZl z0YJUV@JaNmX`bDzTO((AokgjN&SI*BQi5l?@P>u$IoK9yVDR;?^I0X<_FgWXS2}@d z-t&FtjpOx9q{YnT%mR~UYTEKD{gI0IyI>H|N*6#{kHLJ`Cv zCnOsY{8*qP%DM|GAk&b+0r%71z@wW&KOmYS&@y$l(k7t-ZDni{7EAJGm~!K{MSt3* z4GE!s&v7Np!YEs$^pG2r5>FlR5K3umy^o|0ROaXJlY*TeY zlS2hBv%wDe_iRvR7}hhJ!U-?eEv-tNC<}b7qUTf)G0OW$xvjzLplV(l`*N%U0Mnt7 zw56CsjopE$M%iTwYh!pliadCEWn&N&VLG3O!$>AQ*p@p)1@dyJQepG4(MbW&t_S#b z7J;Vo3bkmw@2p<`yE&~8wOb44NoIsx5!1wVsXa8$NI#8D(XnnEA>!oGuVQ4J0-M(1 zcE}@YI=9cOq!Z}rMZ46K@-UQzD4zySIKUR{CWxL1mdgXH`*kX{@tiQ6P~nD$qZX`w zhl8xfYF1QP<6pYCBYQEj@=ZFYQ3aa@Y?8+$cE2ih;7W!2#*9W-Xst|ydRyW<1}3yk zTBu`$%@b9~v@X%as$D;wkF#<{v^{u{^kLsCU+(Qa7)@r>|5D;<^rg((O~((NnioUY z>jiHB5mZ2x1kBSx_J2$S6t`xv{vrN`uMlynK#i+g5yX1cPh*%w-xJ=)M6aY^%Y6 z=N0fyOH*id!|X@6+m2pB3msPuJevTXq4hc-4hZX5A=Gpy^o_jw5#Yv{ zF=pIq#~Rl?=tk!|X&T5NCiwu2={Bc7JyR*>pEcG|Hg7Sbx!oMTq$PWn>sT&1p#&kO z03zW%ADAS-uBF-w_~jpbVcT5mBGUBwzkK0i$xmN+wDteY7Y0x;X?C;?H)5`zzFLgdw&+6yEbhAyuN_t-i&z@;t5Y9<^_sh9oRpUL7RV126fVHo?^F{MP{s#t6S?xMHDA7K9nE?P%uj%3FU?Yf!~Df!;2V_!Oed(ROq9d z(1^s--l?~bf{7W{NPKL`s{ZG*#nhH9#9GV^LSZykf$F8TUwI3SB zB{%l8P=;7>vjV*cRJIthm~431VNXU|KUUA=`%t8I?`eeYHMv8u9;C8HltkAzQ$hk% zeh-x3b|@pI>b6FL$|3qW4(wc1+BU;;y~Dg1_{tHAr(kVZi`5?At-^I7R5U|Y`1b|S z)$VSEW=g$v9A07iwPyd&vLN4_TEKG>FA^-yRWfdZ50{jvIAS);b*ar>L(M}W)%2iX zFbqo29DU2;=3`7GhG+;mO6Di|AXQ#%KDHd{bn;T*{PHK?Jj8)Z7Ra*iaZvh+PmDIn z90cFff+!P)@`HhCJYoxmpBPseNiqQ7TiVtrf8bZqK@~i?!~QC<^3F9*L;Y_Gaf);k zF|P+y!o=ux&q!!pT!Jw2*k1hBA6;T7rhg`3Z`HngAv4*i~PZ?(nbb zsHf}LSf+6Z3X^uC%J{1vw>e2|>e6+DEx5%F28HGc1w6KEv0o}jc-wn_d{6VX78|jr z+MDri5C?$Zbe7A(LJy%_bfT7$4){`67_oPhu2dEe$zP-`0jR@&J0nWPO>5YEQB~z) zAJbkp5SUvuitgJ~g5xa55h$Rv>f5R}E;M;JboKQ=8N`KN4dSlPm=R#!Ik;p~cmcd) zgRj@)Ps^*J+fS>D7b7r_)9IZOfl%<;A5EiEDUdap@ZJSw=uQP38RxN?DTO=P>c?IK z)kBpXe;LGFGuuGm7g1+-u%ohga1@hc7e%n3S~YdtTDo|XTTgfWP}j5^*PWA|&K_=d zum2DbPDXmT+<(5SzA@rd1Y<>XaMZOqMO_a{)S!BVNG&-t~LdMV?VNHM0gC>yt?GWd} z5M?<3TSwR|dg;OqbAwltrp9>5abo{xM`(~2L-@b$2!ZoyUeL$-$$Wne4&UhrKota9 zO=xAbzd1Po0Fx?kjT3Hh5`$_70om8}g(ahddxGSKy|TmY%4m@Rx{c~$UuYm20t{s& z4k#_-+|i`^Q55my3X%ebM#3IYp#oSxF;v<=PqTk4UBA0LU%l$Vtvuem?sRUrw_Lt+ zyj^bJ{_1~P7QR>qyV!4Stel{o*lhRLs%)Qa{Mdbacv@BBqy>=SW$9L0qUe3pi6Zbp zxIp3nwP20<(p77hd%-+YKA2nN-D8Udzld*zOFSEO)+ItkVN3#9s52lHC?4x$nZXlT zlsfniZJ;pwKeT~x`Tx)co*hB8Uq^ug{+ zeSyuof2f6%UUHfcRY7cj5m1ADfq&UU>g61cUDK(GT&O1&IOONv*?*%eAh|@;qB9(s z`iC^|gaCYr3YWUViGX17^zRPwiR5pG81=V9%&h`I_;AIhII`+qpEbCGw>Xi+Q zmo{-#SPiO~n35h7hq~tt`KXj3G;xS9Zt@WYzer>kz z?*1)3+IcJVu#ZWJy0crjh>E%$f2Dk5M`2|c>>O7;rx;t!^`-;K$ql4rML^Zb-ZPj3 z0U?AfwYPDj2s8fRc0af~M|_)q1}eneJW2AR_5~$&ODf4mb++(zK@NqRBM!&@ZoNv=X%gQyuLwk8d))f_Eg}#51#IaP< z`|YP_LI9ciTM?jK~g=<%RRHFGYo3A6HQjW~uE{2vQ&M0Js9n+Dw3DVV{o zoEkaUHh3h>xW@r1QleT|pUTB)D-N`&ln2Uibp)}Bw2EC62i82V2_Y`ACdcnw=)FE6QO-x|ZA&?+8z#Wv+J#waaRNu9IlE^ayAec$wHIQU5O ze%sbM{AUQ8?rlKnA;jSpXk!9cTIoY-|IIjxeSaM$G5-?Y#m3v!fw|N3yW8XO?((G- znibc99KhEqMKy-Dw7D6i8)6XT@L3PKRv4r<`1^7Lv-q_=;&FE^0yb%sgV3a=6lr6o zL--fvVamBJ!DUvzgGnJAzD99OyQ0)wm<3IK>;gplV16HKeuCDVD6GubA>9O;16J-i zG=xoNAc7{7^O*m$QDRUI94EH8hPxtrh+Z|}$+V5F$ ztCbMRoq89mz=2}$IbSq{y_w09*U;8gDhXPbs6W4gILzQTpmk4-4_Llca5hqM zpmjtJH`}#k*tqq=Gu}l@=T-Mn<|-S|whZaY;HASnkNIDsjwa*m)ZM>k6mF9=M}PPX zeiYD5H8YYzkn?1PS+&Vp?`{Uz%sfnhsAwQ(J=BAMnJ(1rp{(<>JJtii!N}{AuHv6N zNfMp=ImP#9K_&W!=}X_gw?Pb1(^Ly)5E>$m>BJQe+M;pVqaPeRpnO`wj%X1hG8oVe zV-WM+^bS^F#g*uy;XpAa_@dVbGVcno12X!Z)VooJOL8bD3EFlQi6;W4_`xR=)MiSK z5{O_fIT}^2-@b|hZ)Twk1FZ;KsI$4>$r=2N41}|ckuCn7yz)E-wRbQSo>>yT2I6K) zSv(#bsBiF&XBK##zKq_+4XeeG{l3ci(rN7X)GGv~nyqZ^vyf?{K z2xOW$5yo-R7L#ozwt~*?sgBO!Sr(@GW%dg?mnSwx=gh|mkQcW-2(RWK4g8}X;^)mU zLL_SOXdZ|nV2FQU!l$fN4+%Xs#gWZ4Wr^(LmEsqa(=Ax(i&GYw`CGD|%frjp2&meJlLH7~FPE9+sVqjIZ9|{ShQs4}W?Sl!&B&*z?;Hwu~AFg)8QBK#gS; zxoQBQ-?vgRw3uwloqcbtsWOWlqFGG9o8*`hoL4?;&?{#E|2A%EYsOlSQJ}+1mpU@L zmev}X`m=N$3u|WlIc0GWT`$`L;dDl9(ap9`57lq7oak1J)l#E{*wL7yb>aR@4v@xo zoA<>rzT(w8;wU@gjLoFdk zz7c0A(1p>9^{CB(Uu-RRdvRCg)FnH=kSfbJx-2}=7JBFg4gxOUWQ1~Q&H1#7h{i?f zKr#x;q7T9ut@574WMRIUzUm#zlVA@fZGlYNjAlGHo|%5NLAjN$Z)3t1C8&f%QiYT6 zeMU-lkX7j7@)m^uxOS#f{N}K4Ka=4qJjP*UIiDH!Ya9X^2&qr>tWcqj$depQs0_{P z3jw`)xhWuN`~JuXDEos;tl{&wMmWZ<$exI)) z1^sd;13zMRQw+cBy3z!Tze* z^3{XtX#{?jgwCMCt1p#qT;dB{$~0)mZieVWNX}FlrhOkQXbwApY~B~Di^7zkMT_2= z=&-gYtu@V2fvIJSD5_d4i5P&dC>r__FATY&KQm^XG9ePb59`~=`4 zxjv47q|!fF(r?Sk2`72ua`%il&TI3ek{ipS=TANWopo;5TedC2*W(7@BUFY`!ij+p zHAZtriS|h1LebRnboxL9=tRF8%Bpy!Wd!q|6OFGUzMLhY__Yep%d0E{W@D|6)7J^r zd^_iglDB;qCV-ks;6r-F0dYk(%Eb!`C~f9nAKF&3mqe>=eUSP-(-hp}gPLux3$eIk}k+_W4dUl2wXzARMKlV>-Id2&9c$oLH#H4A@|W3((%s(=GrSwDxfB`W#nyb*0tnR{Q`e zVSb|&4j1lkTHMGiM(uRp^+{b(td3SoN((B~j|&>I3!9>Teb}E^qd2Wne!gD>uJgyK z@_-B4CPx855O<-|(}R z*I|qst2#O$@OI{yL6P$Nz)TT|wu{6g@E@%eBW~B{+s8j|6g|2`)413~=Cb}Z*-QUy zMtTMGGlRjRCbOSE2mSIh`J-Z&SkV63@IT3)NVLl#r?1uKXz_sv`gtoFL z_gyVYC36rfA}1EQddcoS*~{xr@cEz9a`I_+q6Xc1@B+Xp!5PBiTU~^okW+A<59hIw z*car7qi^1A?LTO1(PC`=DE}JRfZ3n)^cL(|XxGxmj}b(YaY=!Rx#|^-6;)k}2mykOb z;>W;e1jrF5{6_?6eC^3ZckV%L zP1erI?she_P+woh1aj?m>uC9kR(LWp^TVMmx)+4q8a7>QxHSZmfLNyweb86rtvCZZRg3Q-} zb=o7v@0jB{k$=VKQCy27<9R#G4UAwG)wAXra6z{f+fbu)&5&*M~MlYH>gK0MX zke9i&+v}@iBbLPc-a7!!uQZjdd(H?P7E2OtJs#{6b#?r-25nY?ep})NRK)5; Date: Mon, 17 Jul 2023 15:30:29 +0000 Subject: [PATCH 61/73] build(deps): [autoapprove] bump cryptography from 41.0.0 to 41.0.2 (#242) Source-Link: https://togithub.com/googleapis/synthtool/commit/d6103f4a3540ba60f633a9e25c37ec5fe7e6286d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:39f0f3f2be02ef036e297e376fe3b6256775576da8a6ccb1d5eeb80f4c8bf8fb --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 4 +-- .github/auto-label.yaml | 2 +- .kokoro/build.sh | 2 +- .kokoro/docker/docs/Dockerfile | 2 +- .kokoro/populate-secrets.sh | 2 +- .kokoro/publish-docs.sh | 2 +- .kokoro/release.sh | 2 +- .kokoro/requirements.txt | 44 +++++++++++++++------------- .kokoro/test-samples-against-head.sh | 2 +- .kokoro/test-samples-impl.sh | 2 +- .kokoro/test-samples.sh | 2 +- .kokoro/trampoline.sh | 2 +- .kokoro/trampoline_v2.sh | 2 +- .pre-commit-config.yaml | 2 +- .trampolinerc | 4 +-- MANIFEST.in | 2 +- README.rst | 27 +++++++++-------- docs/conf.py | 2 +- noxfile.py | 3 +- scripts/decrypt-secrets.sh | 2 +- scripts/readme-gen/readme_gen.py | 18 ++++++------ setup.cfg | 2 +- 23 files changed, 69 insertions(+), 65 deletions(-) diff --git a/.flake8 b/.flake8 index 2e43874..87f6e40 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 98994f4..ae4a522 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:2d816f26f728ac8b24248741e7d4c461c09764ef9f7be3684d557c9632e46dbd -# created: 2023-06-28T17:03:33.371210701Z + digest: sha256:39f0f3f2be02ef036e297e376fe3b6256775576da8a6ccb1d5eeb80f4c8bf8fb +# created: 2023-07-17T15:20:13.819193964Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 41bff0b..b2016d1 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 2461dfc..9d8f69b 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index f8137d0..8e39a2c 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh index f525142..6f39721 100755 --- a/.kokoro/populate-secrets.sh +++ b/.kokoro/populate-secrets.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC. +# Copyright 2023 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 1c4d623..9eafe0b 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/release.sh b/.kokoro/release.sh index b1bdba1..9ffd4a7 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index c7929db..67d70a1 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,26 +113,30 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==41.0.0 \ - --hash=sha256:0ddaee209d1cf1f180f1efa338a68c4621154de0afaef92b89486f5f96047c55 \ - --hash=sha256:14754bcdae909d66ff24b7b5f166d69340ccc6cb15731670435efd5719294895 \ - --hash=sha256:344c6de9f8bda3c425b3a41b319522ba3208551b70c2ae00099c205f0d9fd3be \ - --hash=sha256:34d405ea69a8b34566ba3dfb0521379b210ea5d560fafedf9f800a9a94a41928 \ - --hash=sha256:3680248309d340fda9611498a5319b0193a8dbdb73586a1acf8109d06f25b92d \ - --hash=sha256:3c5ef25d060c80d6d9f7f9892e1d41bb1c79b78ce74805b8cb4aa373cb7d5ec8 \ - --hash=sha256:4ab14d567f7bbe7f1cdff1c53d5324ed4d3fc8bd17c481b395db224fb405c237 \ - --hash=sha256:5c1f7293c31ebc72163a9a0df246f890d65f66b4a40d9ec80081969ba8c78cc9 \ - --hash=sha256:6b71f64beeea341c9b4f963b48ee3b62d62d57ba93eb120e1196b31dc1025e78 \ - --hash=sha256:7d92f0248d38faa411d17f4107fc0bce0c42cae0b0ba5415505df72d751bf62d \ - --hash=sha256:8362565b3835ceacf4dc8f3b56471a2289cf51ac80946f9087e66dc283a810e0 \ - --hash=sha256:84a165379cb9d411d58ed739e4af3396e544eac190805a54ba2e0322feb55c46 \ - --hash=sha256:88ff107f211ea696455ea8d911389f6d2b276aabf3231bf72c8853d22db755c5 \ - --hash=sha256:9f65e842cb02550fac96536edb1d17f24c0a338fd84eaf582be25926e993dde4 \ - --hash=sha256:a4fc68d1c5b951cfb72dfd54702afdbbf0fb7acdc9b7dc4301bbf2225a27714d \ - --hash=sha256:b7f2f5c525a642cecad24ee8670443ba27ac1fab81bba4cc24c7b6b41f2d0c75 \ - --hash=sha256:b846d59a8d5a9ba87e2c3d757ca019fa576793e8758174d3868aecb88d6fc8eb \ - --hash=sha256:bf8fc66012ca857d62f6a347007e166ed59c0bc150cefa49f28376ebe7d992a2 \ - --hash=sha256:f5d0bf9b252f30a31664b6f64432b4730bb7038339bd18b1fafe129cfc2be9be +cryptography==41.0.2 \ + --hash=sha256:01f1d9e537f9a15b037d5d9ee442b8c22e3ae11ce65ea1f3316a41c78756b711 \ + --hash=sha256:079347de771f9282fbfe0e0236c716686950c19dee1b76240ab09ce1624d76d7 \ + --hash=sha256:182be4171f9332b6741ee818ec27daff9fb00349f706629f5cbf417bd50e66fd \ + --hash=sha256:192255f539d7a89f2102d07d7375b1e0a81f7478925b3bc2e0549ebf739dae0e \ + --hash=sha256:2a034bf7d9ca894720f2ec1d8b7b5832d7e363571828037f9e0c4f18c1b58a58 \ + --hash=sha256:342f3767e25876751e14f8459ad85e77e660537ca0a066e10e75df9c9e9099f0 \ + --hash=sha256:439c3cc4c0d42fa999b83ded80a9a1fb54d53c58d6e59234cfe97f241e6c781d \ + --hash=sha256:49c3222bb8f8e800aead2e376cbef687bc9e3cb9b58b29a261210456a7783d83 \ + --hash=sha256:674b669d5daa64206c38e507808aae49904c988fa0a71c935e7006a3e1e83831 \ + --hash=sha256:7a9a3bced53b7f09da251685224d6a260c3cb291768f54954e28f03ef14e3766 \ + --hash=sha256:7af244b012711a26196450d34f483357e42aeddb04128885d95a69bd8b14b69b \ + --hash=sha256:7d230bf856164de164ecb615ccc14c7fc6de6906ddd5b491f3af90d3514c925c \ + --hash=sha256:84609ade00a6ec59a89729e87a503c6e36af98ddcd566d5f3be52e29ba993182 \ + --hash=sha256:9a6673c1828db6270b76b22cc696f40cde9043eb90373da5c2f8f2158957f42f \ + --hash=sha256:9b6d717393dbae53d4e52684ef4f022444fc1cce3c48c38cb74fca29e1f08eaa \ + --hash=sha256:9c3fe6534d59d071ee82081ca3d71eed3210f76ebd0361798c74abc2bcf347d4 \ + --hash=sha256:a719399b99377b218dac6cf547b6ec54e6ef20207b6165126a280b0ce97e0d2a \ + --hash=sha256:b332cba64d99a70c1e0836902720887fb4529ea49ea7f5462cf6640e095e11d2 \ + --hash=sha256:d124682c7a23c9764e54ca9ab5b308b14b18eba02722b8659fb238546de83a76 \ + --hash=sha256:d73f419a56d74fef257955f51b18d046f3506270a5fd2ac5febbfa259d6c0fa5 \ + --hash=sha256:f0dc40e6f7aa37af01aba07277d3d64d5a03dc66d682097541ec4da03cc140ee \ + --hash=sha256:f14ad275364c8b4e525d018f6716537ae7b6d369c094805cae45300847e0894f \ + --hash=sha256:f772610fe364372de33d76edcd313636a25684edb94cee53fd790195f5989d14 # via # gcp-releasetool # secretstorage diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh index ba3a707..63ac41d 100755 --- a/.kokoro/test-samples-against-head.sh +++ b/.kokoro/test-samples-against-head.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh index 2c6500c..5a0f5fa 100755 --- a/.kokoro/test-samples-impl.sh +++ b/.kokoro/test-samples-impl.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 11c042d..50b35a4 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index f39236e..d85b1f2 100755 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2017 Google Inc. +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4af6cdc..59a7cf3 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5405cc8..9e3898f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.trampolinerc b/.trampolinerc index 0eee72a..a7dfeb4 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Template for .trampolinerc - # Add required env vars here. required_envvars+=( ) diff --git a/MANIFEST.in b/MANIFEST.in index e783f4c..e0a6670 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/README.rst b/README.rst index 37da229..2673cff 100644 --- a/README.rst +++ b/README.rst @@ -36,21 +36,24 @@ In order to use this library, you first need to go through the following steps: Installation ~~~~~~~~~~~~ -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. +Install this library in a virtual environment using `venv`_. `venv`_ is a tool that +creates isolated Python environments. These isolated environments can have separate +versions of Python packages, which allows you to isolate one project's dependencies +from the dependencies of other projects. -With `virtualenv`_, it's possible to install this library without needing system +With `venv`_, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies. -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ +.. _`venv`: https://docs.python.org/3/library/venv.html Code samples and snippets ~~~~~~~~~~~~~~~~~~~~~~~~~ -Code samples and snippets live in the `samples/` folder. +Code samples and snippets live in the `samples/`_ folder. + +.. _samples/: https://github.com/googleapis/python-appengine-admin/tree/main/samples Supported Python Versions @@ -77,10 +80,9 @@ Mac/Linux .. code-block:: console - pip install virtualenv - virtualenv + python3 -m venv source /bin/activate - /bin/pip install google-cloud-appengine-admin + pip install google-cloud-appengine-admin Windows @@ -88,10 +90,9 @@ Windows .. code-block:: console - pip install virtualenv - virtualenv - \Scripts\activate - \Scripts\pip.exe install google-cloud-appengine-admin + py -m venv + .\\Scripts\activate + pip install google-cloud-appengine-admin Next Steps ~~~~~~~~~~ diff --git a/docs/conf.py b/docs/conf.py index 5f040ab..692d6b2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/noxfile.py b/noxfile.py index 7d411fe..3773a35 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2018 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -400,6 +400,7 @@ def prerelease_deps(session): "python", "-c", "import google.protobuf; print(google.protobuf.__version__)" ) session.run("python", "-c", "import grpc; print(grpc.__version__)") + session.run("python", "-c", "import google.auth; print(google.auth.__version__)") session.run("py.test", "tests/unit") diff --git a/scripts/decrypt-secrets.sh b/scripts/decrypt-secrets.sh index 21f6d2a..0018b42 100755 --- a/scripts/decrypt-secrets.sh +++ b/scripts/decrypt-secrets.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2015 Google Inc. All rights reserved. +# Copyright 2023 Google LLC All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index 91b5967..1acc119 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2016 Google Inc +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,17 +33,17 @@ autoescape=True, ) -README_TMPL = jinja_env.get_template('README.tmpl.rst') +README_TMPL = jinja_env.get_template("README.tmpl.rst") def get_help(file): - return subprocess.check_output(['python', file, '--help']).decode() + return subprocess.check_output(["python", file, "--help"]).decode() def main(): parser = argparse.ArgumentParser() - parser.add_argument('source') - parser.add_argument('--destination', default='README.rst') + parser.add_argument("source") + parser.add_argument("--destination", default="README.rst") args = parser.parse_args() @@ -51,9 +51,9 @@ def main(): root = os.path.dirname(source) destination = os.path.join(root, args.destination) - jinja_env.globals['get_help'] = get_help + jinja_env.globals["get_help"] = get_help - with io.open(source, 'r') as f: + with io.open(source, "r") as f: config = yaml.load(f) # This allows get_help to execute in the right directory. @@ -61,9 +61,9 @@ def main(): output = README_TMPL.render(config) - with io.open(destination, 'w') as f: + with io.open(destination, "w") as f: f.write(output) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/setup.cfg b/setup.cfg index c3a2b39..0523500 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2020 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From f6193e3facd784adcac92d2c595d8119ef6f896c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 02:20:22 +0000 Subject: [PATCH 62/73] build(deps): [autoapprove] bump pygments from 2.13.0 to 2.15.0 (#243) Source-Link: https://togithub.com/googleapis/synthtool/commit/eaef28efd179e6eeb9f4e9bf697530d074a6f3b9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ae4a522..17c21d9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:39f0f3f2be02ef036e297e376fe3b6256775576da8a6ccb1d5eeb80f4c8bf8fb -# created: 2023-07-17T15:20:13.819193964Z + digest: sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e +# created: 2023-07-21T02:12:46.49799314Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 67d70a1..b563eb2 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -396,9 +396,9 @@ pycparser==2.21 \ --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \ --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206 # via cffi -pygments==2.13.0 \ - --hash=sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1 \ - --hash=sha256:f643f331ab57ba3c9d89212ee4a2dabc6e94f117cf4eefde99a0574720d14c42 +pygments==2.15.0 \ + --hash=sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094 \ + --hash=sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500 # via # readme-renderer # rich From b66d7f5a75b39e5b82cb0228fddd0ae0a72be5d3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 21:14:17 +0000 Subject: [PATCH 63/73] build(deps): [autoapprove] bump certifi from 2022.12.7 to 2023.7.22 (#244) Source-Link: https://togithub.com/googleapis/synthtool/commit/395d53adeeacfca00b73abf197f65f3c17c8f1e9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 17c21d9..0ddd0e4 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e -# created: 2023-07-21T02:12:46.49799314Z + digest: sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 +# created: 2023-07-25T21:01:10.396410762Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index b563eb2..76d9bba 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -20,9 +20,9 @@ cachetools==5.2.0 \ --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db # via google-auth -certifi==2022.12.7 \ - --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \ - --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18 +certifi==2023.7.22 \ + --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ + --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 # via requests cffi==1.15.1 \ --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ From 70cb7ecba076971c836a8a59ea377b59e522c1c2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:48:07 +0000 Subject: [PATCH 64/73] chore: [autoapprove] Pin flake8 version (#245) Source-Link: https://togithub.com/googleapis/synthtool/commit/0ddbff8012e47cde4462fe3f9feab01fbc4cdfd6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b --- .github/.OwlBot.lock.yaml | 4 ++-- .pre-commit-config.yaml | 2 +- noxfile.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0ddd0e4..d71329c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 -# created: 2023-07-25T21:01:10.396410762Z + digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b +# created: 2023-08-01T17:41:45.434027321Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e3898f..19409cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 6.1.0 hooks: - id: flake8 diff --git a/noxfile.py b/noxfile.py index 3773a35..4000733 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,6 +26,7 @@ import nox +FLAKE8_VERSION = "flake8==6.1.0" BLACK_VERSION = "black==22.3.0" ISORT_VERSION = "isort==5.10.1" LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] @@ -82,7 +83,7 @@ def lint(session): Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ - session.install("flake8", BLACK_VERSION) + session.install(FLAKE8_VERSION, BLACK_VERSION) session.run( "black", "--check", From d794135ff899d69df4df159148ddf0f536c8de54 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:00:13 +0000 Subject: [PATCH 65/73] build: [autoapprove] bump cryptography from 41.0.2 to 41.0.3 (#246) Source-Link: https://togithub.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 48 +++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d71329c..a3da1b0 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b -# created: 2023-08-01T17:41:45.434027321Z + digest: sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 +# created: 2023-08-02T10:53:29.114535628Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 76d9bba..029bd34 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,30 +113,30 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==41.0.2 \ - --hash=sha256:01f1d9e537f9a15b037d5d9ee442b8c22e3ae11ce65ea1f3316a41c78756b711 \ - --hash=sha256:079347de771f9282fbfe0e0236c716686950c19dee1b76240ab09ce1624d76d7 \ - --hash=sha256:182be4171f9332b6741ee818ec27daff9fb00349f706629f5cbf417bd50e66fd \ - --hash=sha256:192255f539d7a89f2102d07d7375b1e0a81f7478925b3bc2e0549ebf739dae0e \ - --hash=sha256:2a034bf7d9ca894720f2ec1d8b7b5832d7e363571828037f9e0c4f18c1b58a58 \ - --hash=sha256:342f3767e25876751e14f8459ad85e77e660537ca0a066e10e75df9c9e9099f0 \ - --hash=sha256:439c3cc4c0d42fa999b83ded80a9a1fb54d53c58d6e59234cfe97f241e6c781d \ - --hash=sha256:49c3222bb8f8e800aead2e376cbef687bc9e3cb9b58b29a261210456a7783d83 \ - --hash=sha256:674b669d5daa64206c38e507808aae49904c988fa0a71c935e7006a3e1e83831 \ - --hash=sha256:7a9a3bced53b7f09da251685224d6a260c3cb291768f54954e28f03ef14e3766 \ - --hash=sha256:7af244b012711a26196450d34f483357e42aeddb04128885d95a69bd8b14b69b \ - --hash=sha256:7d230bf856164de164ecb615ccc14c7fc6de6906ddd5b491f3af90d3514c925c \ - --hash=sha256:84609ade00a6ec59a89729e87a503c6e36af98ddcd566d5f3be52e29ba993182 \ - --hash=sha256:9a6673c1828db6270b76b22cc696f40cde9043eb90373da5c2f8f2158957f42f \ - --hash=sha256:9b6d717393dbae53d4e52684ef4f022444fc1cce3c48c38cb74fca29e1f08eaa \ - --hash=sha256:9c3fe6534d59d071ee82081ca3d71eed3210f76ebd0361798c74abc2bcf347d4 \ - --hash=sha256:a719399b99377b218dac6cf547b6ec54e6ef20207b6165126a280b0ce97e0d2a \ - --hash=sha256:b332cba64d99a70c1e0836902720887fb4529ea49ea7f5462cf6640e095e11d2 \ - --hash=sha256:d124682c7a23c9764e54ca9ab5b308b14b18eba02722b8659fb238546de83a76 \ - --hash=sha256:d73f419a56d74fef257955f51b18d046f3506270a5fd2ac5febbfa259d6c0fa5 \ - --hash=sha256:f0dc40e6f7aa37af01aba07277d3d64d5a03dc66d682097541ec4da03cc140ee \ - --hash=sha256:f14ad275364c8b4e525d018f6716537ae7b6d369c094805cae45300847e0894f \ - --hash=sha256:f772610fe364372de33d76edcd313636a25684edb94cee53fd790195f5989d14 +cryptography==41.0.3 \ + --hash=sha256:0d09fb5356f975974dbcb595ad2d178305e5050656affb7890a1583f5e02a306 \ + --hash=sha256:23c2d778cf829f7d0ae180600b17e9fceea3c2ef8b31a99e3c694cbbf3a24b84 \ + --hash=sha256:3fb248989b6363906827284cd20cca63bb1a757e0a2864d4c1682a985e3dca47 \ + --hash=sha256:41d7aa7cdfded09b3d73a47f429c298e80796c8e825ddfadc84c8a7f12df212d \ + --hash=sha256:42cb413e01a5d36da9929baa9d70ca90d90b969269e5a12d39c1e0d475010116 \ + --hash=sha256:4c2f0d35703d61002a2bbdcf15548ebb701cfdd83cdc12471d2bae80878a4207 \ + --hash=sha256:4fd871184321100fb400d759ad0cddddf284c4b696568204d281c902fc7b0d81 \ + --hash=sha256:5259cb659aa43005eb55a0e4ff2c825ca111a0da1814202c64d28a985d33b087 \ + --hash=sha256:57a51b89f954f216a81c9d057bf1a24e2f36e764a1ca9a501a6964eb4a6800dd \ + --hash=sha256:652627a055cb52a84f8c448185922241dd5217443ca194d5739b44612c5e6507 \ + --hash=sha256:67e120e9a577c64fe1f611e53b30b3e69744e5910ff3b6e97e935aeb96005858 \ + --hash=sha256:6af1c6387c531cd364b72c28daa29232162010d952ceb7e5ca8e2827526aceae \ + --hash=sha256:6d192741113ef5e30d89dcb5b956ef4e1578f304708701b8b73d38e3e1461f34 \ + --hash=sha256:7efe8041897fe7a50863e51b77789b657a133c75c3b094e51b5e4b5cec7bf906 \ + --hash=sha256:84537453d57f55a50a5b6835622ee405816999a7113267739a1b4581f83535bd \ + --hash=sha256:8f09daa483aedea50d249ef98ed500569841d6498aa9c9f4b0531b9964658922 \ + --hash=sha256:95dd7f261bb76948b52a5330ba5202b91a26fbac13ad0e9fc8a3ac04752058c7 \ + --hash=sha256:a74fbcdb2a0d46fe00504f571a2a540532f4c188e6ccf26f1f178480117b33c4 \ + --hash=sha256:a983e441a00a9d57a4d7c91b3116a37ae602907a7618b882c8013b5762e80574 \ + --hash=sha256:ab8de0d091acbf778f74286f4989cf3d1528336af1b59f3e5d2ebca8b5fe49e1 \ + --hash=sha256:aeb57c421b34af8f9fe830e1955bf493a86a7996cc1338fe41b30047d16e962c \ + --hash=sha256:ce785cf81a7bdade534297ef9e490ddff800d956625020ab2ec2780a556c313e \ + --hash=sha256:d0d651aa754ef58d75cec6edfbd21259d93810b73f6ec246436a21b7841908de # via # gcp-releasetool # secretstorage From 7de9b52ce89849f49ca067690a8725d3d9239f09 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 20:38:14 +0000 Subject: [PATCH 66/73] docs: Minor formatting (#249) - [ ] Regenerate this pull request now. chore: Update gapic-generator-python to v1.11.5 build: Update rules_python to 0.24.0 PiperOrigin-RevId: 563436317 Source-Link: https://togithub.com/googleapis/googleapis/commit/42fd37b18d706f6f51f52f209973b3b2c28f509a Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/280264ca02fb9316b4237a96d0af1a2343a81a56 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjgwMjY0Y2EwMmZiOTMxNmI0MjM3YTk2ZDBhZjFhMjM0M2E4MWE1NiJ9 --- .../appengine_admin_v1/services/firewall/async_client.py | 1 + google/cloud/appengine_admin_v1/services/firewall/client.py | 1 + .../appengine_admin_v1/services/firewall/transports/grpc.py | 1 + .../services/firewall/transports/grpc_asyncio.py | 1 + .../appengine_admin_v1/services/firewall/transports/rest.py | 1 + google/cloud/appengine_admin_v1/types/appengine.py | 1 + google/cloud/appengine_admin_v1/types/application.py | 2 ++ google/cloud/appengine_admin_v1/types/certificate.py | 1 + google/cloud/appengine_admin_v1/types/deploy.py | 2 ++ google/cloud/appengine_admin_v1/types/domain_mapping.py | 1 + google/cloud/appengine_admin_v1/types/operation.py | 3 +++ google/cloud/appengine_admin_v1/types/service.py | 1 + google/cloud/appengine_admin_v1/types/version.py | 4 ++++ tests/unit/gapic/appengine_admin_v1/test_applications.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_instances.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_services.py | 2 +- tests/unit/gapic/appengine_admin_v1/test_versions.py | 2 +- 18 files changed, 25 insertions(+), 5 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index e492179..8eb483c 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -56,6 +56,7 @@ class FirewallAsyncClient: position which specifies the rule's order in the sequence of rules, an IP range to be matched against requests, and an action to take upon matching requests. + Every request is evaluated against the Firewall rules in priority order. Processesing stops at the first rule which matches the request's IP address. A final rule always specifies diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index dbe1d1d..4acd108 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -96,6 +96,7 @@ class FirewallClient(metaclass=FirewallClientMeta): position which specifies the rule's order in the sequence of rules, an IP range to be matched against requests, and an action to take upon matching requests. + Every request is evaluated against the Firewall rules in priority order. Processesing stops at the first rule which matches the request's IP address. A final rule always specifies diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py index 10de397..eb28eed 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -36,6 +36,7 @@ class FirewallGrpcTransport(FirewallTransport): position which specifies the rule's order in the sequence of rules, an IP range to be matched against requests, and an action to take upon matching requests. + Every request is evaluated against the Firewall rules in priority order. Processesing stops at the first rule which matches the request's IP address. A final rule always specifies diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py index bb68615..595906f 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py @@ -37,6 +37,7 @@ class FirewallGrpcAsyncIOTransport(FirewallTransport): position which specifies the rule's order in the sequence of rules, an IP range to be matched against requests, and an action to take upon matching requests. + Every request is evaluated against the Firewall rules in priority order. Processesing stops at the first rule which matches the request's IP address. A final rule always specifies diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py index f4a39a1..f217721 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py @@ -258,6 +258,7 @@ class FirewallRestTransport(FirewallTransport): position which specifies the rule's order in the sequence of rules, an IP range to be matched against requests, and an action to take upon matching requests. + Every request is evaluated against the Firewall rules in priority order. Processesing stops at the first rule which matches the request's IP address. A final rule always specifies diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index bb3f4b9..2d7f0ab 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -729,6 +729,7 @@ class CreateIngressRuleRequest(proto.Message): new rule. Example: ``apps/myapp/firewall/ingressRules``. rule (google.cloud.appengine_admin_v1.types.FirewallRule): A FirewallRule containing the new resource. + The user may optionally provide a position at which the new rule will be placed. The positions define a sequential list starting at 1. If a diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index 680f782..1863614 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -53,6 +53,7 @@ class Application(proto.Message): Google Apps authentication domain that controls which users can access this application. + Defaults to open access for any Google Account. location_id (str): Location from which this application runs. Application @@ -70,6 +71,7 @@ class Application(proto.Message): application. This bucket is associated with the application and can be used by the gcloud deployment commands. + @OutputOnly default_cookie_expiration (google.protobuf.duration_pb2.Duration): Cookie expiration policy for this diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index 74f6e09..bd4df73 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -252,6 +252,7 @@ class ManagedCertificate(proto.Message): Status of certificate management. Refers to the most recent certificate acquisition or renewal attempt. + @OutputOnly """ diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index daa95b1..1e60343 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -96,6 +96,7 @@ class FileInfo(proto.Message): The SHA1 hash of the file, in hex. mime_type (str): The MIME type of the file. + Defaults to the value from Google Cloud Storage. """ @@ -142,6 +143,7 @@ class CloudBuildOptions(proto.Message): app_yaml_path (str): Path to the yaml file used in deployment, used to determine runtime configuration details. + Required for flexible environment builds. See diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index 4041cc1..a69702f 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -50,6 +50,7 @@ class DomainMapping(proto.Message): this domain mapping. These records must be added to the domain's DNS configuration in order to serve the application via this domain mapping. + @OutputOnly """ diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py index 410386c..58e0524 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -44,12 +44,15 @@ class OperationMetadataV1(proto.Message): @OutputOnly insert_time (google.protobuf.timestamp_pb2.Timestamp): Time that this operation was created. + @OutputOnly end_time (google.protobuf.timestamp_pb2.Timestamp): Time that this operation completed. + @OutputOnly user (str): User who requested this operation. + @OutputOnly target (str): Name of the resource that this operation is acting on. diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index 8eb0def..1b58295 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -68,6 +68,7 @@ class Service(proto.Message): using labels is to tag resources belonging to different environments (e.g., "env=prod", "env=qa"). +

Label keys and values can be no longer than 63 characters and can only contain lowercase letters, numeric characters, underscores, diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index e8409db..ec93455 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -214,11 +214,13 @@ class Version(proto.Message): @OutputOnly create_time (google.protobuf.timestamp_pb2.Timestamp): Time that this version was created. + @OutputOnly disk_usage_bytes (int): Total size in bytes of all the files that are included in this version and currently hosted on the App Engine disk. + @OutputOnly runtime_api_version (str): The version of the API in the given runtime @@ -299,6 +301,7 @@ class Version(proto.Message): Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com" + @OutputOnly endpoints_api_service (google.cloud.appengine_admin_v1.types.EndpointsApiService): Cloud Endpoints configuration. @@ -595,6 +598,7 @@ class AutomaticScaling(proto.Message): Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. + Defaults to a runtime-specific value. max_idle_instances (int): Maximum number of idle instances that should diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index c347e7f..4b357a0 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -41,7 +41,7 @@ import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index e631be2..523099b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -41,7 +41,7 @@ import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index f4983f9..43e5114 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -41,7 +41,7 @@ import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account from google.protobuf import empty_pb2 # type: ignore from google.protobuf import json_format diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index e5ab4fb..4119c69 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -41,7 +41,7 @@ import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 5045b30..09437e0 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -41,7 +41,7 @@ import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore From b3e00ebdc8f231d2e022e1fed451bb755f3b5391 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 21:40:17 +0000 Subject: [PATCH 67/73] chore: [autoapprove] bump cryptography from 41.0.3 to 41.0.4 (#252) Source-Link: https://togithub.com/googleapis/synthtool/commit/dede53ff326079b457cfb1aae5bbdc82cbb51dc3 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:fac304457974bb530cc5396abd4ab25d26a469cd3bc97cbfb18c8d4324c584eb --- .github/.OwlBot.lock.yaml | 4 ++-- .gitignore | 1 + .kokoro/requirements.txt | 49 ++++++++++++++++++++------------------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index a3da1b0..a9bdb1b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 -# created: 2023-08-02T10:53:29.114535628Z + digest: sha256:fac304457974bb530cc5396abd4ab25d26a469cd3bc97cbfb18c8d4324c584eb +# created: 2023-10-02T21:31:03.517640371Z diff --git a/.gitignore b/.gitignore index b4243ce..d083ea1 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ docs.metadata # Virtual environment env/ +venv/ # Test logs coverage.xml diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 029bd34..96d593c 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,30 +113,30 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==41.0.3 \ - --hash=sha256:0d09fb5356f975974dbcb595ad2d178305e5050656affb7890a1583f5e02a306 \ - --hash=sha256:23c2d778cf829f7d0ae180600b17e9fceea3c2ef8b31a99e3c694cbbf3a24b84 \ - --hash=sha256:3fb248989b6363906827284cd20cca63bb1a757e0a2864d4c1682a985e3dca47 \ - --hash=sha256:41d7aa7cdfded09b3d73a47f429c298e80796c8e825ddfadc84c8a7f12df212d \ - --hash=sha256:42cb413e01a5d36da9929baa9d70ca90d90b969269e5a12d39c1e0d475010116 \ - --hash=sha256:4c2f0d35703d61002a2bbdcf15548ebb701cfdd83cdc12471d2bae80878a4207 \ - --hash=sha256:4fd871184321100fb400d759ad0cddddf284c4b696568204d281c902fc7b0d81 \ - --hash=sha256:5259cb659aa43005eb55a0e4ff2c825ca111a0da1814202c64d28a985d33b087 \ - --hash=sha256:57a51b89f954f216a81c9d057bf1a24e2f36e764a1ca9a501a6964eb4a6800dd \ - --hash=sha256:652627a055cb52a84f8c448185922241dd5217443ca194d5739b44612c5e6507 \ - --hash=sha256:67e120e9a577c64fe1f611e53b30b3e69744e5910ff3b6e97e935aeb96005858 \ - --hash=sha256:6af1c6387c531cd364b72c28daa29232162010d952ceb7e5ca8e2827526aceae \ - --hash=sha256:6d192741113ef5e30d89dcb5b956ef4e1578f304708701b8b73d38e3e1461f34 \ - --hash=sha256:7efe8041897fe7a50863e51b77789b657a133c75c3b094e51b5e4b5cec7bf906 \ - --hash=sha256:84537453d57f55a50a5b6835622ee405816999a7113267739a1b4581f83535bd \ - --hash=sha256:8f09daa483aedea50d249ef98ed500569841d6498aa9c9f4b0531b9964658922 \ - --hash=sha256:95dd7f261bb76948b52a5330ba5202b91a26fbac13ad0e9fc8a3ac04752058c7 \ - --hash=sha256:a74fbcdb2a0d46fe00504f571a2a540532f4c188e6ccf26f1f178480117b33c4 \ - --hash=sha256:a983e441a00a9d57a4d7c91b3116a37ae602907a7618b882c8013b5762e80574 \ - --hash=sha256:ab8de0d091acbf778f74286f4989cf3d1528336af1b59f3e5d2ebca8b5fe49e1 \ - --hash=sha256:aeb57c421b34af8f9fe830e1955bf493a86a7996cc1338fe41b30047d16e962c \ - --hash=sha256:ce785cf81a7bdade534297ef9e490ddff800d956625020ab2ec2780a556c313e \ - --hash=sha256:d0d651aa754ef58d75cec6edfbd21259d93810b73f6ec246436a21b7841908de +cryptography==41.0.4 \ + --hash=sha256:004b6ccc95943f6a9ad3142cfabcc769d7ee38a3f60fb0dddbfb431f818c3a67 \ + --hash=sha256:047c4603aeb4bbd8db2756e38f5b8bd7e94318c047cfe4efeb5d715e08b49311 \ + --hash=sha256:0d9409894f495d465fe6fda92cb70e8323e9648af912d5b9141d616df40a87b8 \ + --hash=sha256:23a25c09dfd0d9f28da2352503b23e086f8e78096b9fd585d1d14eca01613e13 \ + --hash=sha256:2ed09183922d66c4ec5fdaa59b4d14e105c084dd0febd27452de8f6f74704143 \ + --hash=sha256:35c00f637cd0b9d5b6c6bd11b6c3359194a8eba9c46d4e875a3660e3b400005f \ + --hash=sha256:37480760ae08065437e6573d14be973112c9e6dcaf5f11d00147ee74f37a3829 \ + --hash=sha256:3b224890962a2d7b57cf5eeb16ccaafba6083f7b811829f00476309bce2fe0fd \ + --hash=sha256:5a0f09cefded00e648a127048119f77bc2b2ec61e736660b5789e638f43cc397 \ + --hash=sha256:5b72205a360f3b6176485a333256b9bcd48700fc755fef51c8e7e67c4b63e3ac \ + --hash=sha256:7e53db173370dea832190870e975a1e09c86a879b613948f09eb49324218c14d \ + --hash=sha256:7febc3094125fc126a7f6fb1f420d0da639f3f32cb15c8ff0dc3997c4549f51a \ + --hash=sha256:80907d3faa55dc5434a16579952ac6da800935cd98d14dbd62f6f042c7f5e839 \ + --hash=sha256:86defa8d248c3fa029da68ce61fe735432b047e32179883bdb1e79ed9bb8195e \ + --hash=sha256:8ac4f9ead4bbd0bc8ab2d318f97d85147167a488be0e08814a37eb2f439d5cf6 \ + --hash=sha256:93530900d14c37a46ce3d6c9e6fd35dbe5f5601bf6b3a5c325c7bffc030344d9 \ + --hash=sha256:9eeb77214afae972a00dee47382d2591abe77bdae166bda672fb1e24702a3860 \ + --hash=sha256:b5f4dfe950ff0479f1f00eda09c18798d4f49b98f4e2006d644b3301682ebdca \ + --hash=sha256:c3391bd8e6de35f6f1140e50aaeb3e2b3d6a9012536ca23ab0d9c35ec18c8a91 \ + --hash=sha256:c880eba5175f4307129784eca96f4e70b88e57aa3f680aeba3bab0e980b0f37d \ + --hash=sha256:cecfefa17042941f94ab54f769c8ce0fe14beff2694e9ac684176a2535bf9714 \ + --hash=sha256:e40211b4923ba5a6dc9769eab704bdb3fbb58d56c5b336d30996c24fcf12aadb \ + --hash=sha256:efc8ad4e6fc4f1752ebfb58aefece8b4e3c4cae940b0994d43649bdfce8d0d4f # via # gcp-releasetool # secretstorage @@ -382,6 +382,7 @@ protobuf==3.20.3 \ # gcp-docuploader # gcp-releasetool # google-api-core + # googleapis-common-protos pyasn1==0.4.8 \ --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba From 8d6869cd517191b91b6941f46ac66a2a4de29495 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:18:17 +0000 Subject: [PATCH 68/73] chore: [autoapprove] Update `black` and `isort` to latest versions (#254) Source-Link: https://togithub.com/googleapis/synthtool/commit/0c7b0333f44b2b7075447f43a121a12d15a7b76a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:08e34975760f002746b1d8c86fdc90660be45945ee6d9db914d1508acdf9a547 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 6 +++--- .pre-commit-config.yaml | 2 +- noxfile.py | 35 ++++++++++++++++++----------------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index a9bdb1b..dd98abb 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:fac304457974bb530cc5396abd4ab25d26a469cd3bc97cbfb18c8d4324c584eb -# created: 2023-10-02T21:31:03.517640371Z + digest: sha256:08e34975760f002746b1d8c86fdc90660be45945ee6d9db914d1508acdf9a547 +# created: 2023-10-09T14:06:13.397766266Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 96d593c..0332d32 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -467,9 +467,9 @@ typing-extensions==4.4.0 \ --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e # via -r requirements.in -urllib3==1.26.12 \ - --hash=sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e \ - --hash=sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997 +urllib3==1.26.17 \ + --hash=sha256:24d6a242c28d29af46c3fae832c36db3bbebcc533dd1bb549172cd739c82df21 \ + --hash=sha256:94a757d178c9be92ef5539b8840d48dc9cf1b2709c9d6b588232a055c524458b # via # requests # twine diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 19409cb..6a8e169 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 diff --git a/noxfile.py b/noxfile.py index 4000733..54abbaa 100644 --- a/noxfile.py +++ b/noxfile.py @@ -22,18 +22,19 @@ import pathlib import re import shutil +from typing import Dict, List import warnings import nox FLAKE8_VERSION = "flake8==6.1.0" -BLACK_VERSION = "black==22.3.0" -ISORT_VERSION = "isort==5.10.1" +BLACK_VERSION = "black[jupyter]==23.7.0" +ISORT_VERSION = "isort==5.11.0" LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"] +UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.7", "3.8", "3.9", "3.10", "3.11"] UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", "asyncmock", @@ -41,23 +42,23 @@ "pytest-cov", "pytest-asyncio", ] -UNIT_TEST_EXTERNAL_DEPENDENCIES = [] -UNIT_TEST_LOCAL_DEPENDENCIES = [] -UNIT_TEST_DEPENDENCIES = [] -UNIT_TEST_EXTRAS = [] -UNIT_TEST_EXTRAS_BY_PYTHON = {} - -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] -SYSTEM_TEST_STANDARD_DEPENDENCIES = [ +UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = [] +UNIT_TEST_LOCAL_DEPENDENCIES: List[str] = [] +UNIT_TEST_DEPENDENCIES: List[str] = [] +UNIT_TEST_EXTRAS: List[str] = [] +UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} + +SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [ "mock", "pytest", "google-cloud-testutils", ] -SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] -SYSTEM_TEST_LOCAL_DEPENDENCIES = [] -SYSTEM_TEST_DEPENDENCIES = [] -SYSTEM_TEST_EXTRAS = [] -SYSTEM_TEST_EXTRAS_BY_PYTHON = {} +SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List[str] = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = [] +SYSTEM_TEST_DEPENDENCIES: List[str] = [] +SYSTEM_TEST_EXTRAS: List[str] = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -70,6 +71,7 @@ "lint_setup_py", "blacken", "docs", + "format", ] # Error if a python version is missing @@ -188,7 +190,6 @@ def unit(session): def install_systemtest_dependencies(session, *constraints): - # Use pre-release gRPC for system tests. # Exclude version 1.52.0rc1 which has a known issue. # See https://github.com/grpc/grpc/issues/32163 From 4a143ea87e6ca7e9202e7280d1d30a841274061b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 07:46:24 -0400 Subject: [PATCH 69/73] chore(main): release 1.9.4 (#250) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/cloud/appengine_admin/gapic_version.py | 2 +- google/cloud/appengine_admin_v1/gapic_version.py | 2 +- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index afdaa62..d8a026d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.9.3" + ".": "1.9.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 325037e..1cc3724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.9.4](https://github.com/googleapis/python-appengine-admin/compare/v1.9.3...v1.9.4) (2023-10-09) + + +### Documentation + +* Minor formatting ([#249](https://github.com/googleapis/python-appengine-admin/issues/249)) ([7de9b52](https://github.com/googleapis/python-appengine-admin/commit/7de9b52ce89849f49ca067690a8725d3d9239f09)) + ## [1.9.3](https://github.com/googleapis/python-appengine-admin/compare/v1.9.2...v1.9.3) (2023-07-04) diff --git a/google/cloud/appengine_admin/gapic_version.py b/google/cloud/appengine_admin/gapic_version.py index 6ecf7e5..0b16b08 100644 --- a/google/cloud/appengine_admin/gapic_version.py +++ b/google/cloud/appengine_admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.3" # {x-release-please-version} +__version__ = "1.9.4" # {x-release-please-version} diff --git a/google/cloud/appengine_admin_v1/gapic_version.py b/google/cloud/appengine_admin_v1/gapic_version.py index 6ecf7e5..0b16b08 100644 --- a/google/cloud/appengine_admin_v1/gapic_version.py +++ b/google/cloud/appengine_admin_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.3" # {x-release-please-version} +__version__ = "1.9.4" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index fb8cbf5..1bd95dd 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "0.1.0" + "version": "1.9.4" }, "snippets": [ { From ef32f287c9e1c9e5211bcdefbdac2351dfcfbbed Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:34:35 -0400 Subject: [PATCH 70/73] chore: Update gapic-generator-python to v1.11.8 (#255) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.11.7 PiperOrigin-RevId: 573230664 Source-Link: https://github.com/googleapis/googleapis/commit/93beed334607e70709cc60e6145be65fdc8ec386 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f4a4edaa8057639fcf6adf9179872280d1a8f651 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjRhNGVkYWE4MDU3NjM5ZmNmNmFkZjkxNzk4NzIyODBkMWE4ZjY1MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.11.8 PiperOrigin-RevId: 574178735 Source-Link: https://github.com/googleapis/googleapis/commit/7307199008ee2d57a4337066de29f9cd8c444bc6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ce3af21b7c559a87c2befc076be0e3aeda3a26f0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2UzYWYyMWI3YzU1OWE4N2MyYmVmYzA3NmJlMGUzYWVkYTNhMjZmMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../appengine_admin_v1/test_applications.py | 198 +++++--- .../test_authorized_certificates.py | 188 +++++-- .../test_authorized_domains.py | 5 +- .../test_domain_mappings.py | 168 +++++-- .../gapic/appengine_admin_v1/test_firewall.py | 171 ++++++- .../appengine_admin_v1/test_instances.py | 10 +- .../gapic/appengine_admin_v1/test_services.py | 84 +++- .../gapic/appengine_admin_v1/test_versions.py | 470 ++++++------------ 8 files changed, 797 insertions(+), 497 deletions(-) diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 4b357a0..e68ba7c 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -1415,8 +1415,9 @@ def test_get_application_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = application.Application.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = application.Application.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1543,8 +1544,9 @@ def test_get_application_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = application.Application.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = application.Application.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1622,6 +1624,73 @@ def test_create_application_rest(request_type): "use_container_optimized_os": True, }, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.CreateApplicationRequest.meta.fields["application"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["application"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["application"][field])): + del request_init["application"][field][i][subfield] + else: + del request_init["application"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -1711,33 +1780,6 @@ def test_create_application_rest_bad_request( # send a request that will satisfy transcoding request_init = {} - request_init["application"] = { - "name": "name_value", - "id": "id_value", - "dispatch_rules": [ - {"domain": "domain_value", "path": "path_value", "service": "service_value"} - ], - "auth_domain": "auth_domain_value", - "location_id": "location_id_value", - "code_bucket": "code_bucket_value", - "default_cookie_expiration": {"seconds": 751, "nanos": 543}, - "serving_status": 1, - "default_hostname": "default_hostname_value", - "default_bucket": "default_bucket_value", - "service_account": "service_account_value", - "iap": { - "enabled": True, - "oauth2_client_id": "oauth2_client_id_value", - "oauth2_client_secret": "oauth2_client_secret_value", - "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", - }, - "gcr_domain": "gcr_domain_value", - "database_type": 1, - "feature_settings": { - "split_health_checks": True, - "use_container_optimized_os": True, - }, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -1800,6 +1842,73 @@ def test_update_application_rest(request_type): "use_container_optimized_os": True, }, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.UpdateApplicationRequest.meta.fields["application"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["application"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["application"][field])): + del request_init["application"][field][i][subfield] + else: + del request_init["application"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -1889,33 +1998,6 @@ def test_update_application_rest_bad_request( # send a request that will satisfy transcoding request_init = {"name": "apps/sample1"} - request_init["application"] = { - "name": "name_value", - "id": "id_value", - "dispatch_rules": [ - {"domain": "domain_value", "path": "path_value", "service": "service_value"} - ], - "auth_domain": "auth_domain_value", - "location_id": "location_id_value", - "code_bucket": "code_bucket_value", - "default_cookie_expiration": {"seconds": 751, "nanos": 543}, - "serving_status": 1, - "default_hostname": "default_hostname_value", - "default_bucket": "default_bucket_value", - "service_account": "service_account_value", - "iap": { - "enabled": True, - "oauth2_client_id": "oauth2_client_id_value", - "oauth2_client_secret": "oauth2_client_secret_value", - "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", - }, - "gcr_domain": "gcr_domain_value", - "database_type": 1, - "feature_settings": { - "split_health_checks": True, - "use_container_optimized_os": True, - }, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index dc5a049..16099a0 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -1834,8 +1834,9 @@ def test_list_authorized_certificates_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.ListAuthorizedCertificatesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.ListAuthorizedCertificatesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2026,8 +2027,9 @@ def test_get_authorized_certificate_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = certificate.AuthorizedCertificate.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = certificate.AuthorizedCertificate.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2164,6 +2166,73 @@ def test_create_authorized_certificate_rest(request_type): ], "domain_mappings_count": 2238, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.CreateAuthorizedCertificateRequest.meta.fields["certificate"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["certificate"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["certificate"][field])): + del request_init["certificate"][field][i][subfield] + else: + del request_init["certificate"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2181,8 +2250,9 @@ def test_create_authorized_certificate_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = certificate.AuthorizedCertificate.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = certificate.AuthorizedCertificate.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2267,23 +2337,6 @@ def test_create_authorized_certificate_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "apps/sample1"} - request_init["certificate"] = { - "name": "name_value", - "id": "id_value", - "display_name": "display_name_value", - "domain_names": ["domain_names_value1", "domain_names_value2"], - "expire_time": {"seconds": 751, "nanos": 543}, - "certificate_raw_data": { - "public_certificate": "public_certificate_value", - "private_key": "private_key_value", - }, - "managed_certificate": {"last_renewal_time": {}, "status": 1}, - "visible_domain_mappings": [ - "visible_domain_mappings_value1", - "visible_domain_mappings_value2", - ], - "domain_mappings_count": 2238, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -2336,6 +2389,73 @@ def test_update_authorized_certificate_rest(request_type): ], "domain_mappings_count": 2238, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.UpdateAuthorizedCertificateRequest.meta.fields["certificate"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["certificate"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["certificate"][field])): + del request_init["certificate"][field][i][subfield] + else: + del request_init["certificate"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2353,8 +2473,9 @@ def test_update_authorized_certificate_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = certificate.AuthorizedCertificate.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = certificate.AuthorizedCertificate.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2439,23 +2560,6 @@ def test_update_authorized_certificate_rest_bad_request( # send a request that will satisfy transcoding request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} - request_init["certificate"] = { - "name": "name_value", - "id": "id_value", - "display_name": "display_name_value", - "domain_names": ["domain_names_value1", "domain_names_value2"], - "expire_time": {"seconds": 751, "nanos": 543}, - "certificate_raw_data": { - "public_certificate": "public_certificate_value", - "private_key": "private_key_value", - }, - "managed_certificate": {"last_renewal_time": {}, "status": 1}, - "visible_domain_mappings": [ - "visible_domain_mappings_value1", - "visible_domain_mappings_value2", - ], - "domain_mappings_count": 2238, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index 4f31637..044ec94 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -1121,8 +1121,9 @@ def test_list_authorized_domains_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.ListAuthorizedDomainsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.ListAuthorizedDomainsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index 523099b..5e2ff40 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -1730,8 +1730,9 @@ def test_list_domain_mappings_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.ListDomainMappingsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.ListDomainMappingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1914,8 +1915,9 @@ def test_get_domain_mapping_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = domain_mapping.DomainMapping.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = domain_mapping.DomainMapping.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2041,6 +2043,73 @@ def test_create_domain_mapping_rest(request_type): {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} ], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.CreateDomainMappingRequest.meta.fields["domain_mapping"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["domain_mapping"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["domain_mapping"][field])): + del request_init["domain_mapping"][field][i][subfield] + else: + del request_init["domain_mapping"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2130,18 +2199,6 @@ def test_create_domain_mapping_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "apps/sample1"} - request_init["domain_mapping"] = { - "name": "name_value", - "id": "id_value", - "ssl_settings": { - "certificate_id": "certificate_id_value", - "ssl_management_type": 1, - "pending_managed_certificate_id": "pending_managed_certificate_id_value", - }, - "resource_records": [ - {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} - ], - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -2189,6 +2246,73 @@ def test_update_domain_mapping_rest(request_type): {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} ], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.UpdateDomainMappingRequest.meta.fields["domain_mapping"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["domain_mapping"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["domain_mapping"][field])): + del request_init["domain_mapping"][field][i][subfield] + else: + del request_init["domain_mapping"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2278,18 +2402,6 @@ def test_update_domain_mapping_rest_bad_request( # send a request that will satisfy transcoding request_init = {"name": "apps/sample1/domainMappings/sample2"} - request_init["domain_mapping"] = { - "name": "name_value", - "id": "id_value", - "ssl_settings": { - "certificate_id": "certificate_id_value", - "ssl_management_type": 1, - "pending_managed_certificate_id": "pending_managed_certificate_id_value", - }, - "resource_records": [ - {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} - ], - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 42b1c2d..ba7381b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -1868,8 +1868,9 @@ def test_list_ingress_rules_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.ListIngressRulesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.ListIngressRulesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2047,8 +2048,9 @@ def test_batch_update_ingress_rules_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.BatchUpdateIngressRulesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.BatchUpdateIngressRulesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2164,6 +2166,73 @@ def test_create_ingress_rule_rest(request_type): "source_range": "source_range_value", "description": "description_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.CreateIngressRuleRequest.meta.fields["rule"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["rule"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["rule"][field])): + del request_init["rule"][field][i][subfield] + else: + del request_init["rule"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2179,8 +2248,9 @@ def test_create_ingress_rule_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = firewall.FirewallRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = firewall.FirewallRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2259,12 +2329,6 @@ def test_create_ingress_rule_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "apps/sample1"} - request_init["rule"] = { - "priority": 898, - "action": 1, - "source_range": "source_range_value", - "description": "description_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -2315,8 +2379,9 @@ def test_get_ingress_rule_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = firewall.FirewallRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = firewall.FirewallRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2436,6 +2501,73 @@ def test_update_ingress_rule_rest(request_type): "source_range": "source_range_value", "description": "description_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.UpdateIngressRuleRequest.meta.fields["rule"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["rule"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["rule"][field])): + del request_init["rule"][field][i][subfield] + else: + del request_init["rule"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2451,8 +2583,9 @@ def test_update_ingress_rule_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = firewall.FirewallRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = firewall.FirewallRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2531,12 +2664,6 @@ def test_update_ingress_rule_rest_bad_request( # send a request that will satisfy transcoding request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} - request_init["rule"] = { - "priority": 898, - "action": 1, - "source_range": "source_range_value", - "description": "description_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 43e5114..4a001e7 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -1555,8 +1555,9 @@ def test_list_instances_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.ListInstancesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.ListInstancesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1749,8 +1750,9 @@ def test_get_instance_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = instance.Instance.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = instance.Instance.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 4119c69..6b4b665 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -1492,8 +1492,9 @@ def test_list_services_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.ListServicesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.ListServicesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1670,8 +1671,9 @@ def test_get_service_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = service.Service.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = service.Service.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1786,6 +1788,73 @@ def test_update_service_rest(request_type): "labels": {}, "network_settings": {"ingress_traffic_allowed": 1}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.UpdateServiceRequest.meta.fields["service"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["service"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["service"][field])): + del request_init["service"][field][i][subfield] + else: + del request_init["service"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -1871,13 +1940,6 @@ def test_update_service_rest_bad_request( # send a request that will satisfy transcoding request_init = {"name": "apps/sample1/services/sample2"} - request_init["service"] = { - "name": "name_value", - "id": "id_value", - "split": {"shard_by": 1, "allocations": {}}, - "labels": {}, - "network_settings": {"ingress_traffic_allowed": 1}, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 09437e0..131e505 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -1710,8 +1710,9 @@ def test_list_versions_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = appengine.ListVersionsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = appengine.ListVersionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -1905,8 +1906,9 @@ def test_get_version_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = version.Version.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = version.Version.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -2196,6 +2198,73 @@ def test_create_version_rest(request_type): "entrypoint": {"shell": "shell_value"}, "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.CreateVersionRequest.meta.fields["version"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["version"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["version"][field])): + del request_init["version"][field][i][subfield] + else: + del request_init["version"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2281,169 +2350,6 @@ def test_create_version_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "apps/sample1/services/sample2"} - request_init["version"] = { - "name": "name_value", - "id": "id_value", - "automatic_scaling": { - "cool_down_period": {"seconds": 751, "nanos": 543}, - "cpu_utilization": { - "aggregation_window_length": {}, - "target_utilization": 0.19540000000000002, - }, - "max_concurrent_requests": 2499, - "max_idle_instances": 1898, - "max_total_instances": 2032, - "max_pending_latency": {}, - "min_idle_instances": 1896, - "min_total_instances": 2030, - "min_pending_latency": {}, - "request_utilization": { - "target_request_count_per_second": 3320, - "target_concurrent_requests": 2820, - }, - "disk_utilization": { - "target_write_bytes_per_second": 3096, - "target_write_ops_per_second": 2883, - "target_read_bytes_per_second": 2953, - "target_read_ops_per_second": 2740, - }, - "network_utilization": { - "target_sent_bytes_per_second": 2983, - "target_sent_packets_per_second": 3179, - "target_received_bytes_per_second": 3380, - "target_received_packets_per_second": 3576, - }, - "standard_scheduler_settings": { - "target_cpu_utilization": 0.23770000000000002, - "target_throughput_utilization": 0.3163, - "min_instances": 1387, - "max_instances": 1389, - }, - }, - "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, - "manual_scaling": {"instances": 968}, - "inbound_services": [1], - "instance_class": "instance_class_value", - "network": { - "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], - "instance_tag": "instance_tag_value", - "name": "name_value", - "subnetwork_name": "subnetwork_name_value", - "session_affinity": True, - }, - "zones": ["zones_value1", "zones_value2"], - "resources": { - "cpu": 0.328, - "disk_gb": 0.723, - "memory_gb": 0.961, - "volumes": [ - { - "name": "name_value", - "volume_type": "volume_type_value", - "size_gb": 0.739, - } - ], - "kms_key_reference": "kms_key_reference_value", - }, - "runtime": "runtime_value", - "runtime_channel": "runtime_channel_value", - "threadsafe": True, - "vm": True, - "app_engine_apis": True, - "beta_settings": {}, - "env": "env_value", - "serving_status": 1, - "created_by": "created_by_value", - "create_time": {"seconds": 751, "nanos": 543}, - "disk_usage_bytes": 1701, - "runtime_api_version": "runtime_api_version_value", - "runtime_main_executable_path": "runtime_main_executable_path_value", - "service_account": "service_account_value", - "handlers": [ - { - "url_regex": "url_regex_value", - "static_files": { - "path": "path_value", - "upload_path_regex": "upload_path_regex_value", - "http_headers": {}, - "mime_type": "mime_type_value", - "expiration": {}, - "require_matching_file": True, - "application_readable": True, - }, - "script": {"script_path": "script_path_value"}, - "api_endpoint": {"script_path": "script_path_value"}, - "security_level": 1, - "login": 1, - "auth_fail_action": 1, - "redirect_http_response_code": 1, - } - ], - "error_handlers": [ - { - "error_code": 1, - "static_file": "static_file_value", - "mime_type": "mime_type_value", - } - ], - "libraries": [{"name": "name_value", "version": "version_value"}], - "api_config": { - "auth_fail_action": 1, - "login": 1, - "script": "script_value", - "security_level": 1, - "url": "url_value", - }, - "env_variables": {}, - "build_env_variables": {}, - "default_expiration": {}, - "health_check": { - "disable_health_check": True, - "host": "host_value", - "healthy_threshold": 1819, - "unhealthy_threshold": 2046, - "restart_threshold": 1841, - "check_interval": {}, - "timeout": {}, - }, - "readiness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "app_start_timeout": {}, - }, - "liveness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "initial_delay": {}, - }, - "nobuild_files_regex": "nobuild_files_regex_value", - "deployment": { - "files": {}, - "container": {"image": "image_value"}, - "zip_": {"source_url": "source_url_value", "files_count": 1179}, - "cloud_build_options": { - "app_yaml_path": "app_yaml_path_value", - "cloud_build_timeout": {}, - }, - }, - "version_url": "version_url_value", - "endpoints_api_service": { - "name": "name_value", - "config_id": "config_id_value", - "rollout_strategy": 1, - "disable_trace_sampling": True, - }, - "entrypoint": {"shell": "shell_value"}, - "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -2642,6 +2548,73 @@ def test_update_version_rest(request_type): "entrypoint": {"shell": "shell_value"}, "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = appengine.UpdateVersionRequest.meta.fields["version"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["version"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["version"][field])): + del request_init["version"][field][i][subfield] + else: + del request_init["version"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -2727,169 +2700,6 @@ def test_update_version_rest_bad_request( # send a request that will satisfy transcoding request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} - request_init["version"] = { - "name": "name_value", - "id": "id_value", - "automatic_scaling": { - "cool_down_period": {"seconds": 751, "nanos": 543}, - "cpu_utilization": { - "aggregation_window_length": {}, - "target_utilization": 0.19540000000000002, - }, - "max_concurrent_requests": 2499, - "max_idle_instances": 1898, - "max_total_instances": 2032, - "max_pending_latency": {}, - "min_idle_instances": 1896, - "min_total_instances": 2030, - "min_pending_latency": {}, - "request_utilization": { - "target_request_count_per_second": 3320, - "target_concurrent_requests": 2820, - }, - "disk_utilization": { - "target_write_bytes_per_second": 3096, - "target_write_ops_per_second": 2883, - "target_read_bytes_per_second": 2953, - "target_read_ops_per_second": 2740, - }, - "network_utilization": { - "target_sent_bytes_per_second": 2983, - "target_sent_packets_per_second": 3179, - "target_received_bytes_per_second": 3380, - "target_received_packets_per_second": 3576, - }, - "standard_scheduler_settings": { - "target_cpu_utilization": 0.23770000000000002, - "target_throughput_utilization": 0.3163, - "min_instances": 1387, - "max_instances": 1389, - }, - }, - "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, - "manual_scaling": {"instances": 968}, - "inbound_services": [1], - "instance_class": "instance_class_value", - "network": { - "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], - "instance_tag": "instance_tag_value", - "name": "name_value", - "subnetwork_name": "subnetwork_name_value", - "session_affinity": True, - }, - "zones": ["zones_value1", "zones_value2"], - "resources": { - "cpu": 0.328, - "disk_gb": 0.723, - "memory_gb": 0.961, - "volumes": [ - { - "name": "name_value", - "volume_type": "volume_type_value", - "size_gb": 0.739, - } - ], - "kms_key_reference": "kms_key_reference_value", - }, - "runtime": "runtime_value", - "runtime_channel": "runtime_channel_value", - "threadsafe": True, - "vm": True, - "app_engine_apis": True, - "beta_settings": {}, - "env": "env_value", - "serving_status": 1, - "created_by": "created_by_value", - "create_time": {"seconds": 751, "nanos": 543}, - "disk_usage_bytes": 1701, - "runtime_api_version": "runtime_api_version_value", - "runtime_main_executable_path": "runtime_main_executable_path_value", - "service_account": "service_account_value", - "handlers": [ - { - "url_regex": "url_regex_value", - "static_files": { - "path": "path_value", - "upload_path_regex": "upload_path_regex_value", - "http_headers": {}, - "mime_type": "mime_type_value", - "expiration": {}, - "require_matching_file": True, - "application_readable": True, - }, - "script": {"script_path": "script_path_value"}, - "api_endpoint": {"script_path": "script_path_value"}, - "security_level": 1, - "login": 1, - "auth_fail_action": 1, - "redirect_http_response_code": 1, - } - ], - "error_handlers": [ - { - "error_code": 1, - "static_file": "static_file_value", - "mime_type": "mime_type_value", - } - ], - "libraries": [{"name": "name_value", "version": "version_value"}], - "api_config": { - "auth_fail_action": 1, - "login": 1, - "script": "script_value", - "security_level": 1, - "url": "url_value", - }, - "env_variables": {}, - "build_env_variables": {}, - "default_expiration": {}, - "health_check": { - "disable_health_check": True, - "host": "host_value", - "healthy_threshold": 1819, - "unhealthy_threshold": 2046, - "restart_threshold": 1841, - "check_interval": {}, - "timeout": {}, - }, - "readiness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "app_start_timeout": {}, - }, - "liveness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "initial_delay": {}, - }, - "nobuild_files_regex": "nobuild_files_regex_value", - "deployment": { - "files": {}, - "container": {"image": "image_value"}, - "zip_": {"source_url": "source_url_value", "files_count": 1179}, - "cloud_build_options": { - "app_yaml_path": "app_yaml_path_value", - "cloud_build_timeout": {}, - }, - }, - "version_url": "version_url_value", - "endpoints_api_service": { - "name": "name_value", - "config_id": "config_id_value", - "rollout_strategy": 1, - "disable_trace_sampling": True, - }, - "entrypoint": {"shell": "shell_value"}, - "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. From 41b20c4c8f1330cacb53ae78ce4c88e3027fef04 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:35:01 -0400 Subject: [PATCH 71/73] chore: rename rst files to avoid conflict with service names (#257) Source-Link: https://github.com/googleapis/synthtool/commit/d52e638b37b091054c869bfa6f5a9fedaba9e0dd Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:4f9b3b106ad0beafc2c8a415e3f62c1a0cc23cabea115dbe841b848f581cfe99 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index dd98abb..7f291db 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:08e34975760f002746b1d8c86fdc90660be45945ee6d9db914d1508acdf9a547 -# created: 2023-10-09T14:06:13.397766266Z + digest: sha256:4f9b3b106ad0beafc2c8a415e3f62c1a0cc23cabea115dbe841b848f581cfe99 +# created: 2023-10-18T20:26:37.410353675Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 0332d32..16170d0 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -467,9 +467,9 @@ typing-extensions==4.4.0 \ --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e # via -r requirements.in -urllib3==1.26.17 \ - --hash=sha256:24d6a242c28d29af46c3fae832c36db3bbebcc533dd1bb549172cd739c82df21 \ - --hash=sha256:94a757d178c9be92ef5539b8840d48dc9cf1b2709c9d6b588232a055c524458b +urllib3==1.26.18 \ + --hash=sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07 \ + --hash=sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0 # via # requests # twine From 9fe5bcbbc100c0a6280a096f6a5bf408a04a119c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:48:37 -0400 Subject: [PATCH 72/73] chore: Update gapic-generator-python to v1.11.9 (#258) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.11.9 PiperOrigin-RevId: 574520922 Source-Link: https://github.com/googleapis/googleapis/commit/5183984d611beb41e90f65f08609b9d926f779bd Source-Link: https://github.com/googleapis/googleapis-gen/commit/a59af19d4ac6509faedf1cc39029141b6a5b8968 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTU5YWYxOWQ0YWM2NTA5ZmFlZGYxY2MzOTAyOTE0MWI2YTViODk2OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * migrate to standard owlbot.py * remove unused file * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- docs/appengine_admin_v1/services_.rst | 2 +- docs/appengine_admin_v1/{types.rst => types_.rst} | 0 docs/index.rst | 8 +++++--- owlbot.py | 9 ++------- .../snippet_metadata_google.appengine.v1.json | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) rename docs/appengine_admin_v1/{types.rst => types_.rst} (100%) diff --git a/docs/appengine_admin_v1/services_.rst b/docs/appengine_admin_v1/services_.rst index 3351d1e..ebe1b56 100644 --- a/docs/appengine_admin_v1/services_.rst +++ b/docs/appengine_admin_v1/services_.rst @@ -1,4 +1,4 @@ -Services for Google Cloud Appengine-admin v1 API +Services for Google Cloud Appengine Admin v1 API ================================================ .. toctree:: :maxdepth: 2 diff --git a/docs/appengine_admin_v1/types.rst b/docs/appengine_admin_v1/types_.rst similarity index 100% rename from docs/appengine_admin_v1/types.rst rename to docs/appengine_admin_v1/types_.rst diff --git a/docs/index.rst b/docs/index.rst index ffda3bb..3b7d117 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,13 +2,15 @@ .. include:: multiprocessing.rst + API Reference ------------- .. toctree:: :maxdepth: 2 appengine_admin_v1/services_ - appengine_admin_v1/types + appengine_admin_v1/types_ + Changelog --------- @@ -16,6 +18,6 @@ Changelog For a list of all ``google-cloud-appengine-admin`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog + changelog diff --git a/owlbot.py b/owlbot.py index 13fffb7..ce738f0 100644 --- a/owlbot.py +++ b/owlbot.py @@ -35,13 +35,7 @@ if clean_up_generated_samples: shutil.rmtree("samples/generated_samples", ignore_errors=True) clean_up_generated_samples = False - - excludes=["**/gapic_version.py"] - - # See https://github.com/googleapis/gapic-generator-python/issues/825 - excludes.extend(["docs/appengine_admin_v1/services.rst", "docs/index.rst"]) - - s.move([library], excludes=excludes) + s.move([library], excludes=["**/gapic_version.py"]) s.remove_staging_dirs() # ---------------------------------------------------------------------------- @@ -51,6 +45,7 @@ templated_files = gcp.CommonTemplates().py_library( cov_level=100, microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), ) s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json index 1bd95dd..fb8cbf5 100644 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ b/samples/generated_samples/snippet_metadata_google.appengine.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-appengine-admin", - "version": "1.9.4" + "version": "0.1.0" }, "snippets": [ { From 6ec4b37f4d41872d2c4f3a77508d8336287130e9 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 31 Oct 2023 16:02:32 -0400 Subject: [PATCH 73/73] build: update README to indicate that source has moved and delete all files (#260) --- .coveragerc | 13 - .flake8 | 33 - .github/.OwlBot.lock.yaml | 17 - .github/.OwlBot.yaml | 26 - .github/CODEOWNERS | 12 - .github/CONTRIBUTING.md | 28 - .github/ISSUE_TEMPLATE/bug_report.md | 43 - .github/ISSUE_TEMPLATE/feature_request.md | 18 - .github/ISSUE_TEMPLATE/support_request.md | 7 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/auto-approve.yml | 3 - .github/auto-label.yaml | 15 - .github/header-checker-lint.yml | 15 - .github/release-please.yml | 3 - .github/release-trigger.yml | 1 - .github/snippet-bot.yml | 0 .github/workflows/docs.yml | 38 - .github/workflows/lint.yml | 25 - .github/workflows/unittest.yml | 57 - .gitignore | 64 - .kokoro/build.sh | 59 - .kokoro/continuous/common.cfg | 27 - .kokoro/continuous/continuous.cfg | 1 - .kokoro/continuous/prerelease-deps.cfg | 7 - .kokoro/docker/docs/Dockerfile | 83 - .kokoro/docs/common.cfg | 66 - .kokoro/docs/docs-presubmit.cfg | 28 - .kokoro/docs/docs.cfg | 1 - .kokoro/populate-secrets.sh | 43 - .kokoro/presubmit/common.cfg | 27 - .kokoro/presubmit/prerelease-deps.cfg | 7 - .kokoro/presubmit/presubmit.cfg | 1 - .kokoro/publish-docs.sh | 62 - .kokoro/release.sh | 29 - .kokoro/release/common.cfg | 49 - .kokoro/release/release.cfg | 1 - .kokoro/requirements.in | 10 - .kokoro/requirements.txt | 497 -- .kokoro/samples/lint/common.cfg | 34 - .kokoro/samples/lint/continuous.cfg | 6 - .kokoro/samples/lint/periodic.cfg | 6 - .kokoro/samples/lint/presubmit.cfg | 6 - .kokoro/samples/python3.10/common.cfg | 40 - .kokoro/samples/python3.10/continuous.cfg | 6 - .kokoro/samples/python3.10/periodic-head.cfg | 11 - .kokoro/samples/python3.10/periodic.cfg | 6 - .kokoro/samples/python3.10/presubmit.cfg | 6 - .kokoro/samples/python3.11/common.cfg | 40 - .kokoro/samples/python3.11/continuous.cfg | 6 - .kokoro/samples/python3.11/periodic-head.cfg | 11 - .kokoro/samples/python3.11/periodic.cfg | 6 - .kokoro/samples/python3.11/presubmit.cfg | 6 - .kokoro/samples/python3.7/common.cfg | 40 - .kokoro/samples/python3.7/continuous.cfg | 6 - .kokoro/samples/python3.7/periodic-head.cfg | 11 - .kokoro/samples/python3.7/periodic.cfg | 6 - .kokoro/samples/python3.7/presubmit.cfg | 6 - .kokoro/samples/python3.8/common.cfg | 40 - .kokoro/samples/python3.8/continuous.cfg | 6 - .kokoro/samples/python3.8/periodic-head.cfg | 11 - .kokoro/samples/python3.8/periodic.cfg | 6 - .kokoro/samples/python3.8/presubmit.cfg | 6 - .kokoro/samples/python3.9/common.cfg | 40 - .kokoro/samples/python3.9/continuous.cfg | 6 - .kokoro/samples/python3.9/periodic-head.cfg | 11 - .kokoro/samples/python3.9/periodic.cfg | 6 - .kokoro/samples/python3.9/presubmit.cfg | 6 - .kokoro/test-samples-against-head.sh | 26 - .kokoro/test-samples-impl.sh | 102 - .kokoro/test-samples.sh | 44 - .kokoro/trampoline.sh | 28 - .kokoro/trampoline_v2.sh | 487 -- .pre-commit-config.yaml | 31 - .release-please-manifest.json | 3 - .trampolinerc | 61 - CHANGELOG.md | 310 - CODE_OF_CONDUCT.md | 95 - CONTRIBUTING.rst | 281 - MANIFEST.in | 25 - README.rst | 5 + docs/README.rst | 82 - docs/_static/custom.css | 20 - docs/_templates/layout.html | 50 - docs/appengine_admin_v1/applications.rst | 6 - .../authorized_certificates.rst | 10 - .../appengine_admin_v1/authorized_domains.rst | 10 - docs/appengine_admin_v1/domain_mappings.rst | 10 - docs/appengine_admin_v1/firewall.rst | 10 - docs/appengine_admin_v1/instances.rst | 10 - docs/appengine_admin_v1/services.rst | 11 - docs/appengine_admin_v1/services_.rst | 13 - docs/appengine_admin_v1/types_.rst | 6 - docs/appengine_admin_v1/versions.rst | 10 - docs/changelog.md | 1 - docs/conf.py | 384 -- docs/index.rst | 23 - docs/multiprocessing.rst | 7 - google-cloud-appengine-v1-py.tar.gz | Bin 49152 -> 0 bytes google/cloud/appengine_admin/__init__.py | 298 - google/cloud/appengine_admin/gapic_version.py | 16 - google/cloud/appengine_admin/py.typed | 2 - google/cloud/appengine_admin_v1/__init__.py | 258 - .../appengine_admin_v1/gapic_metadata.json | 671 --- .../cloud/appengine_admin_v1/gapic_version.py | 16 - google/cloud/appengine_admin_v1/py.typed | 2 - .../appengine_admin_v1/services/__init__.py | 15 - .../services/applications/__init__.py | 22 - .../services/applications/async_client.py | 627 -- .../services/applications/client.py | 848 --- .../applications/transports/__init__.py | 36 - .../services/applications/transports/base.py | 207 - .../services/applications/transports/grpc.py | 387 -- .../applications/transports/grpc_asyncio.py | 396 -- .../services/applications/transports/rest.py | 722 --- .../authorized_certificates/__init__.py | 22 - .../authorized_certificates/async_client.py | 656 --- .../authorized_certificates/client.py | 884 --- .../authorized_certificates/pagers.py | 157 - .../transports/__init__.py | 41 - .../transports/base.py | 228 - .../transports/grpc.py | 395 -- .../transports/grpc_asyncio.py | 397 -- .../transports/rest.py | 790 --- .../services/authorized_domains/__init__.py | 22 - .../authorized_domains/async_client.py | 323 - .../services/authorized_domains/client.py | 540 -- .../services/authorized_domains/pagers.py | 155 - .../authorized_domains/transports/__init__.py | 36 - .../authorized_domains/transports/base.py | 162 - .../authorized_domains/transports/grpc.py | 271 - .../transports/grpc_asyncio.py | 270 - .../authorized_domains/transports/rest.py | 301 - .../services/domain_mappings/__init__.py | 22 - .../services/domain_mappings/async_client.py | 699 --- .../services/domain_mappings/client.py | 920 --- .../services/domain_mappings/pagers.py | 155 - .../domain_mappings/transports/__init__.py | 36 - .../domain_mappings/transports/base.py | 224 - .../domain_mappings/transports/grpc.py | 396 -- .../transports/grpc_asyncio.py | 406 -- .../domain_mappings/transports/rest.py | 837 --- .../services/firewall/__init__.py | 22 - .../services/firewall/async_client.py | 710 --- .../services/firewall/client.py | 940 --- .../services/firewall/pagers.py | 155 - .../services/firewall/transports/__init__.py | 36 - .../services/firewall/transports/base.py | 236 - .../services/firewall/transports/grpc.py | 418 -- .../firewall/transports/grpc_asyncio.py | 422 -- .../services/firewall/transports/rest.py | 905 --- .../services/instances/__init__.py | 22 - .../services/instances/async_client.py | 617 -- .../services/instances/client.py | 863 --- .../services/instances/pagers.py | 155 - .../services/instances/transports/__init__.py | 36 - .../services/instances/transports/base.py | 209 - .../services/instances/transports/grpc.py | 386 -- .../instances/transports/grpc_asyncio.py | 393 -- .../services/instances/transports/rest.py | 692 --- .../services/services/__init__.py | 22 - .../services/services/async_client.py | 604 -- .../services/services/client.py | 830 --- .../services/services/pagers.py | 155 - .../services/services/transports/__init__.py | 36 - .../services/services/transports/base.py | 209 - .../services/services/transports/grpc.py | 359 -- .../services/transports/grpc_asyncio.py | 368 -- .../services/services/transports/rest.py | 699 --- .../services/versions/__init__.py | 22 - .../services/versions/async_client.py | 717 --- .../services/versions/client.py | 944 --- .../services/versions/pagers.py | 155 - .../services/versions/transports/__init__.py | 36 - .../services/versions/transports/base.py | 223 - .../services/versions/transports/grpc.py | 420 -- .../versions/transports/grpc_asyncio.py | 431 -- .../services/versions/transports/rest.py | 814 --- .../appengine_admin_v1/types/__init__.py | 217 - .../appengine_admin_v1/types/app_yaml.py | 639 -- .../appengine_admin_v1/types/appengine.py | 1183 ---- .../appengine_admin_v1/types/application.py | 321 - .../appengine_admin_v1/types/audit_data.py | 101 - .../appengine_admin_v1/types/certificate.py | 271 - .../cloud/appengine_admin_v1/types/deploy.py | 196 - .../types/deployed_files.py | 24 - .../cloud/appengine_admin_v1/types/domain.py | 56 - .../types/domain_mapping.py | 198 - .../appengine_admin_v1/types/firewall.py | 99 - .../appengine_admin_v1/types/instance.py | 225 - .../appengine_admin_v1/types/location.py | 63 - .../types/network_settings.py | 67 - .../appengine_admin_v1/types/operation.py | 129 - .../cloud/appengine_admin_v1/types/service.py | 169 - .../cloud/appengine_admin_v1/types/version.py | 1089 ---- mypy.ini | 3 - noxfile.py | 428 -- owlbot.py | 56 - release-please-config.json | 24 - renovate.json | 12 - ...d_applications_create_application_async.py | 55 - ...ed_applications_create_application_sync.py | 55 - ...ated_applications_get_application_async.py | 51 - ...rated_applications_get_application_sync.py | 51 - ...d_applications_repair_application_async.py | 55 - ...ed_applications_repair_application_sync.py | 55 - ...d_applications_update_application_async.py | 55 - ...ed_applications_update_application_sync.py | 55 - ...tes_create_authorized_certificate_async.py | 51 - ...ates_create_authorized_certificate_sync.py | 51 - ...tes_delete_authorized_certificate_async.py | 49 - ...ates_delete_authorized_certificate_sync.py | 49 - ...icates_get_authorized_certificate_async.py | 51 - ...ficates_get_authorized_certificate_sync.py | 51 - ...ates_list_authorized_certificates_async.py | 52 - ...cates_list_authorized_certificates_sync.py | 52 - ...tes_update_authorized_certificate_async.py | 51 - ...ates_update_authorized_certificate_sync.py | 51 - ...d_domains_list_authorized_domains_async.py | 52 - ...ed_domains_list_authorized_domains_sync.py | 52 - ...in_mappings_create_domain_mapping_async.py | 55 - ...ain_mappings_create_domain_mapping_sync.py | 55 - ...in_mappings_delete_domain_mapping_async.py | 55 - ...ain_mappings_delete_domain_mapping_sync.py | 55 - ...omain_mappings_get_domain_mapping_async.py | 51 - ...domain_mappings_get_domain_mapping_sync.py | 51 - ...ain_mappings_list_domain_mappings_async.py | 52 - ...main_mappings_list_domain_mappings_sync.py | 52 - ...in_mappings_update_domain_mapping_async.py | 55 - ...ain_mappings_update_domain_mapping_sync.py | 55 - ...rewall_batch_update_ingress_rules_async.py | 51 - ...irewall_batch_update_ingress_rules_sync.py | 51 - ...ated_firewall_create_ingress_rule_async.py | 51 - ...rated_firewall_create_ingress_rule_sync.py | 51 - ...ated_firewall_delete_ingress_rule_async.py | 49 - ...rated_firewall_delete_ingress_rule_sync.py | 49 - ...nerated_firewall_get_ingress_rule_async.py | 51 - ...enerated_firewall_get_ingress_rule_sync.py | 51 - ...rated_firewall_list_ingress_rules_async.py | 52 - ...erated_firewall_list_ingress_rules_sync.py | 52 - ...ated_firewall_update_ingress_rule_async.py | 51 - ...rated_firewall_update_ingress_rule_sync.py | 51 - ...enerated_instances_debug_instance_async.py | 55 - ...generated_instances_debug_instance_sync.py | 55 - ...nerated_instances_delete_instance_async.py | 55 - ...enerated_instances_delete_instance_sync.py | 55 - ..._generated_instances_get_instance_async.py | 51 - ...1_generated_instances_get_instance_sync.py | 51 - ...enerated_instances_list_instances_async.py | 52 - ...generated_instances_list_instances_sync.py | 52 - ...generated_services_delete_service_async.py | 55 - ..._generated_services_delete_service_sync.py | 55 - ...v1_generated_services_get_service_async.py | 51 - ..._v1_generated_services_get_service_sync.py | 51 - ..._generated_services_list_services_async.py | 52 - ...1_generated_services_list_services_sync.py | 52 - ...generated_services_update_service_async.py | 55 - ..._generated_services_update_service_sync.py | 55 - ...generated_versions_create_version_async.py | 55 - ..._generated_versions_create_version_sync.py | 55 - ...generated_versions_delete_version_async.py | 55 - ..._generated_versions_delete_version_sync.py | 55 - ...v1_generated_versions_get_version_async.py | 51 - ..._v1_generated_versions_get_version_sync.py | 51 - ..._generated_versions_list_versions_async.py | 52 - ...1_generated_versions_list_versions_sync.py | 52 - ...generated_versions_update_version_async.py | 55 - ..._generated_versions_update_version_sync.py | 55 - .../snippet_metadata_google.appengine.v1.json | 5213 ----------------- scripts/decrypt-secrets.sh | 46 - scripts/fixup_appengine_admin_v1_keywords.py | 209 - scripts/readme-gen/readme_gen.py | 69 - scripts/readme-gen/templates/README.tmpl.rst | 87 - scripts/readme-gen/templates/auth.tmpl.rst | 9 - .../templates/auth_api_key.tmpl.rst | 14 - .../templates/install_deps.tmpl.rst | 29 - .../templates/install_portaudio.tmpl.rst | 35 - setup.cfg | 19 - setup.py | 92 - testing/.gitignore | 3 - testing/constraints-3.10.txt | 6 - testing/constraints-3.11.txt | 6 - testing/constraints-3.12.txt | 6 - testing/constraints-3.7.txt | 9 - testing/constraints-3.8.txt | 6 - testing/constraints-3.9.txt | 6 - tests/__init__.py | 15 - tests/unit/__init__.py | 15 - tests/unit/gapic/__init__.py | 15 - .../unit/gapic/appengine_admin_v1/__init__.py | 15 - .../appengine_admin_v1/test_applications.py | 2950 ---------- .../test_authorized_certificates.py | 3469 ----------- .../test_authorized_domains.py | 2030 ------- .../test_domain_mappings.py | 3369 ----------- .../gapic/appengine_admin_v1/test_firewall.py | 3556 ----------- .../appengine_admin_v1/test_instances.py | 2950 ---------- .../gapic/appengine_admin_v1/test_services.py | 2888 --------- .../gapic/appengine_admin_v1/test_versions.py | 3652 ------------ 297 files changed, 5 insertions(+), 72041 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .flake8 delete mode 100644 .github/.OwlBot.lock.yaml delete mode 100644 .github/.OwlBot.yaml delete mode 100644 .github/CODEOWNERS delete mode 100644 .github/CONTRIBUTING.md delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/support_request.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/auto-approve.yml delete mode 100644 .github/auto-label.yaml delete mode 100644 .github/header-checker-lint.yml delete mode 100644 .github/release-please.yml delete mode 100644 .github/release-trigger.yml delete mode 100644 .github/snippet-bot.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/unittest.yml delete mode 100644 .gitignore delete mode 100755 .kokoro/build.sh delete mode 100644 .kokoro/continuous/common.cfg delete mode 100644 .kokoro/continuous/continuous.cfg delete mode 100644 .kokoro/continuous/prerelease-deps.cfg delete mode 100644 .kokoro/docker/docs/Dockerfile delete mode 100644 .kokoro/docs/common.cfg delete mode 100644 .kokoro/docs/docs-presubmit.cfg delete mode 100644 .kokoro/docs/docs.cfg delete mode 100755 .kokoro/populate-secrets.sh delete mode 100644 .kokoro/presubmit/common.cfg delete mode 100644 .kokoro/presubmit/prerelease-deps.cfg delete mode 100644 .kokoro/presubmit/presubmit.cfg delete mode 100755 .kokoro/publish-docs.sh delete mode 100755 .kokoro/release.sh delete mode 100644 .kokoro/release/common.cfg delete mode 100644 .kokoro/release/release.cfg delete mode 100644 .kokoro/requirements.in delete mode 100644 .kokoro/requirements.txt delete mode 100644 .kokoro/samples/lint/common.cfg delete mode 100644 .kokoro/samples/lint/continuous.cfg delete mode 100644 .kokoro/samples/lint/periodic.cfg delete mode 100644 .kokoro/samples/lint/presubmit.cfg delete mode 100644 .kokoro/samples/python3.10/common.cfg delete mode 100644 .kokoro/samples/python3.10/continuous.cfg delete mode 100644 .kokoro/samples/python3.10/periodic-head.cfg delete mode 100644 .kokoro/samples/python3.10/periodic.cfg delete mode 100644 .kokoro/samples/python3.10/presubmit.cfg delete mode 100644 .kokoro/samples/python3.11/common.cfg delete mode 100644 .kokoro/samples/python3.11/continuous.cfg delete mode 100644 .kokoro/samples/python3.11/periodic-head.cfg delete mode 100644 .kokoro/samples/python3.11/periodic.cfg delete mode 100644 .kokoro/samples/python3.11/presubmit.cfg delete mode 100644 .kokoro/samples/python3.7/common.cfg delete mode 100644 .kokoro/samples/python3.7/continuous.cfg delete mode 100644 .kokoro/samples/python3.7/periodic-head.cfg delete mode 100644 .kokoro/samples/python3.7/periodic.cfg delete mode 100644 .kokoro/samples/python3.7/presubmit.cfg delete mode 100644 .kokoro/samples/python3.8/common.cfg delete mode 100644 .kokoro/samples/python3.8/continuous.cfg delete mode 100644 .kokoro/samples/python3.8/periodic-head.cfg delete mode 100644 .kokoro/samples/python3.8/periodic.cfg delete mode 100644 .kokoro/samples/python3.8/presubmit.cfg delete mode 100644 .kokoro/samples/python3.9/common.cfg delete mode 100644 .kokoro/samples/python3.9/continuous.cfg delete mode 100644 .kokoro/samples/python3.9/periodic-head.cfg delete mode 100644 .kokoro/samples/python3.9/periodic.cfg delete mode 100644 .kokoro/samples/python3.9/presubmit.cfg delete mode 100755 .kokoro/test-samples-against-head.sh delete mode 100755 .kokoro/test-samples-impl.sh delete mode 100755 .kokoro/test-samples.sh delete mode 100755 .kokoro/trampoline.sh delete mode 100755 .kokoro/trampoline_v2.sh delete mode 100644 .pre-commit-config.yaml delete mode 100644 .release-please-manifest.json delete mode 100644 .trampolinerc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.rst delete mode 100644 MANIFEST.in delete mode 100644 docs/README.rst delete mode 100644 docs/_static/custom.css delete mode 100644 docs/_templates/layout.html delete mode 100644 docs/appengine_admin_v1/applications.rst delete mode 100644 docs/appengine_admin_v1/authorized_certificates.rst delete mode 100644 docs/appengine_admin_v1/authorized_domains.rst delete mode 100644 docs/appengine_admin_v1/domain_mappings.rst delete mode 100644 docs/appengine_admin_v1/firewall.rst delete mode 100644 docs/appengine_admin_v1/instances.rst delete mode 100644 docs/appengine_admin_v1/services.rst delete mode 100644 docs/appengine_admin_v1/services_.rst delete mode 100644 docs/appengine_admin_v1/types_.rst delete mode 100644 docs/appengine_admin_v1/versions.rst delete mode 120000 docs/changelog.md delete mode 100644 docs/conf.py delete mode 100644 docs/index.rst delete mode 100644 docs/multiprocessing.rst delete mode 100644 google-cloud-appengine-v1-py.tar.gz delete mode 100644 google/cloud/appengine_admin/__init__.py delete mode 100644 google/cloud/appengine_admin/gapic_version.py delete mode 100644 google/cloud/appengine_admin/py.typed delete mode 100644 google/cloud/appengine_admin_v1/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/gapic_metadata.json delete mode 100644 google/cloud/appengine_admin_v1/gapic_version.py delete mode 100644 google/cloud/appengine_admin_v1/py.typed delete mode 100644 google/cloud/appengine_admin_v1/services/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/applications/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/pagers.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/firewall/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/pagers.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/instances/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/pagers.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/services/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/async_client.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/client.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/pagers.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/transports/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/transports/base.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/transports/grpc.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py delete mode 100644 google/cloud/appengine_admin_v1/services/versions/transports/rest.py delete mode 100644 google/cloud/appengine_admin_v1/types/__init__.py delete mode 100644 google/cloud/appengine_admin_v1/types/app_yaml.py delete mode 100644 google/cloud/appengine_admin_v1/types/appengine.py delete mode 100644 google/cloud/appengine_admin_v1/types/application.py delete mode 100644 google/cloud/appengine_admin_v1/types/audit_data.py delete mode 100644 google/cloud/appengine_admin_v1/types/certificate.py delete mode 100644 google/cloud/appengine_admin_v1/types/deploy.py delete mode 100644 google/cloud/appengine_admin_v1/types/deployed_files.py delete mode 100644 google/cloud/appengine_admin_v1/types/domain.py delete mode 100644 google/cloud/appengine_admin_v1/types/domain_mapping.py delete mode 100644 google/cloud/appengine_admin_v1/types/firewall.py delete mode 100644 google/cloud/appengine_admin_v1/types/instance.py delete mode 100644 google/cloud/appengine_admin_v1/types/location.py delete mode 100644 google/cloud/appengine_admin_v1/types/network_settings.py delete mode 100644 google/cloud/appengine_admin_v1/types/operation.py delete mode 100644 google/cloud/appengine_admin_v1/types/service.py delete mode 100644 google/cloud/appengine_admin_v1/types/version.py delete mode 100644 mypy.ini delete mode 100644 noxfile.py delete mode 100644 owlbot.py delete mode 100644 release-please-config.json delete mode 100644 renovate.json delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_create_application_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_get_application_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_update_application_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_delete_service_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_get_service_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_get_service_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_list_services_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_list_services_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_update_service_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_services_update_service_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_create_version_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_get_version_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_update_version_async.py delete mode 100644 samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py delete mode 100644 samples/generated_samples/snippet_metadata_google.appengine.v1.json delete mode 100755 scripts/decrypt-secrets.sh delete mode 100644 scripts/fixup_appengine_admin_v1_keywords.py delete mode 100644 scripts/readme-gen/readme_gen.py delete mode 100644 scripts/readme-gen/templates/README.tmpl.rst delete mode 100644 scripts/readme-gen/templates/auth.tmpl.rst delete mode 100644 scripts/readme-gen/templates/auth_api_key.tmpl.rst delete mode 100644 scripts/readme-gen/templates/install_deps.tmpl.rst delete mode 100644 scripts/readme-gen/templates/install_portaudio.tmpl.rst delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 testing/.gitignore delete mode 100644 testing/constraints-3.10.txt delete mode 100644 testing/constraints-3.11.txt delete mode 100644 testing/constraints-3.12.txt delete mode 100644 testing/constraints-3.7.txt delete mode 100644 testing/constraints-3.8.txt delete mode 100644 testing/constraints-3.9.txt delete mode 100644 tests/__init__.py delete mode 100644 tests/unit/__init__.py delete mode 100644 tests/unit/gapic/__init__.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/__init__.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_applications.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_firewall.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_instances.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_services.py delete mode 100644 tests/unit/gapic/appengine_admin_v1/test_versions.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index d1bb5ee..0000000 --- a/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/appengine_admin/__init__.py - google/cloud/appengine_admin/gapic_version.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 87f6e40..0000000 --- a/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2023 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! -[flake8] -ignore = E203, E231, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml deleted file mode 100644 index 7f291db..0000000 --- a/.github/.OwlBot.lock.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2023 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. -docker: - image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4f9b3b106ad0beafc2c8a415e3f62c1a0cc23cabea115dbe841b848f581cfe99 -# created: 2023-10-18T20:26:37.410353675Z diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml deleted file mode 100644 index c28d356..0000000 --- a/.github/.OwlBot.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -docker: - image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - -deep-remove-regex: - - /owl-bot-staging - -deep-copy-regex: - - source: /google/appengine/(v.*)/.*-py/(.*) - dest: /owl-bot-staging/$1/$2 - -begin-after-commit-hash: 5f1b96948e61e31e6bb4b586238ad79d6c24cdc3 - diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 63a84c3..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,12 +0,0 @@ -# Code owners file. -# This file controls who is tagged for review for any given pull request. -# -# For syntax help see: -# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax -# Note: This file is autogenerated. To make changes to the codeowner team, please update .repo-metadata.json. - -# @googleapis/yoshi-python @googleapis/aap-dpes are the default owners for changes in this repo -* @googleapis/yoshi-python @googleapis/aap-dpes - -# @googleapis/python-samples-reviewers @googleapis/aap-dpes are the default owners for samples changes -/samples/ @googleapis/python-samples-reviewers @googleapis/aap-dpes diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 939e534..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,28 +0,0 @@ -# How to Contribute - -We'd love to accept your patches and contributions to this project. There are -just a few small guidelines you need to follow. - -## Contributor License Agreement - -Contributions to this project must be accompanied by a Contributor License -Agreement. You (or your employer) retain the copyright to your contribution; -this simply gives us permission to use and redistribute your contributions as -part of the project. Head over to to see -your current agreements on file or to sign a new one. - -You generally only need to submit a CLA once, so if you've already submitted one -(even if it was for a different project), you probably don't need to do it -again. - -## Code reviews - -All submissions, including submissions by project members, require review. We -use GitHub pull requests for this purpose. Consult -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more -information on using pull requests. - -## Community Guidelines - -This project follows [Google's Open Source Community -Guidelines](https://opensource.google.com/conduct/). diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index bc8a15f..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -Thanks for stopping by to let us know something could be better! - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. - -Please run down the following list and make sure you've tried the usual "quick fixes": - - - Search the issues already opened: https://github.com/googleapis/python-appengine-admin/issues - - Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python - -If you are still having issues, please be sure to include as much information as possible: - -#### Environment details - - - OS type and version: - - Python version: `python --version` - - pip version: `pip --version` - - `google-cloud-appengine-admin` version: `pip show google-cloud-appengine-admin` - -#### Steps to reproduce - - 1. ? - 2. ? - -#### Code example - -```python -# example -``` - -#### Stack trace -``` -# example -``` - -Making sure to follow these steps will guarantee the quickest resolution possible. - -Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 6365857..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this library - ---- - -Thanks for stopping by to let us know something could be better! - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. - - **Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - **Describe the solution you'd like** -A clear and concise description of what you want to happen. - **Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - **Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md deleted file mode 100644 index 9958690..0000000 --- a/.github/ISSUE_TEMPLATE/support_request.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: Support request -about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. - ---- - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f1f8c5a..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ -Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: -- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-appengine-admin/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea -- [ ] Ensure the tests and linter pass -- [ ] Code coverage does not decrease (if any source code was changed) -- [ ] Appropriate docs were updated (if necessary) - -Fixes # 🦕 diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml deleted file mode 100644 index 311ebbb..0000000 --- a/.github/auto-approve.yml +++ /dev/null @@ -1,3 +0,0 @@ -# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve -processes: - - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml deleted file mode 100644 index b2016d1..0000000 --- a/.github/auto-label.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2023 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. -requestsize: - enabled: true diff --git a/.github/header-checker-lint.yml b/.github/header-checker-lint.yml deleted file mode 100644 index 6fe78aa..0000000 --- a/.github/header-checker-lint.yml +++ /dev/null @@ -1,15 +0,0 @@ -{"allowedCopyrightHolders": ["Google LLC"], - "allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"], - "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"], - "sourceFileExtensions": [ - "ts", - "js", - "java", - "sh", - "Dockerfile", - "yaml", - "py", - "html", - "txt" - ] -} \ No newline at end of file diff --git a/.github/release-please.yml b/.github/release-please.yml deleted file mode 100644 index 9c4ba94..0000000 --- a/.github/release-please.yml +++ /dev/null @@ -1,3 +0,0 @@ -releaseType: python -manifest: true -handleGHRelease: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml deleted file mode 100644 index d4ca941..0000000 --- a/.github/release-trigger.yml +++ /dev/null @@ -1 +0,0 @@ -enabled: true diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index e97d89e..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,38 +0,0 @@ -on: - pull_request: - branches: - - main -name: docs -jobs: - docs: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - name: Install nox - run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox - - name: Run docs - run: | - nox -s docs - docfx: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - name: Install nox - run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox - - name: Run docfx - run: | - nox -s docfx diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 16d5a9e..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,25 +0,0 @@ -on: - pull_request: - branches: - - main -name: lint -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install nox - run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox - - name: Run lint - run: | - nox -s lint - - name: Run lint_setup_py - run: | - nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml deleted file mode 100644 index 8057a76..0000000 --- a/.github/workflows/unittest.yml +++ /dev/null @@ -1,57 +0,0 @@ -on: - pull_request: - branches: - - main -name: unittest -jobs: - unit: - runs-on: ubuntu-latest - strategy: - matrix: - python: ['3.7', '3.8', '3.9', '3.10', '3.11'] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install nox - run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox - - name: Run unit tests - env: - COVERAGE_FILE: .coverage-${{ matrix.python }} - run: | - nox -s unit-${{ matrix.python }} - - name: Upload coverage results - uses: actions/upload-artifact@v3 - with: - name: coverage-artifacts - path: .coverage-${{ matrix.python }} - - cover: - runs-on: ubuntu-latest - needs: - - unit - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: Install coverage - run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install coverage - - name: Download coverage results - uses: actions/download-artifact@v3 - with: - name: coverage-artifacts - path: .coverage-results/ - - name: Report coverage results - run: | - coverage combine .coverage-results/.coverage* - coverage report --show-missing --fail-under=100 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d083ea1..0000000 --- a/.gitignore +++ /dev/null @@ -1,64 +0,0 @@ -*.py[cod] -*.sw[op] - -# C extensions -*.so - -# Packages -*.egg -*.egg-info -dist -build -eggs -.eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 -__pycache__ - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.nox -.cache -.pytest_cache - - -# Mac -.DS_Store - -# JetBrains -.idea - -# VS Code -.vscode - -# emacs -*~ - -# Built documentation -docs/_build -bigquery/docs/generated -docs.metadata - -# Virtual environment -env/ -venv/ - -# Test logs -coverage.xml -*sponge_log.xml - -# System test environment variables. -system_tests/local_test_setup - -# Make sure a generated file isn't accidentally committed. -pylintrc -pylintrc.test diff --git a/.kokoro/build.sh b/.kokoro/build.sh deleted file mode 100755 index 9d8f69b..0000000 --- a/.kokoro/build.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# Copyright 2023 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. - -set -eo pipefail - -if [[ -z "${PROJECT_ROOT:-}" ]]; then - PROJECT_ROOT="github/python-appengine-admin" -fi - -cd "${PROJECT_ROOT}" - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -# Debug: show build environment -env | grep KOKORO - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json - -# Setup project id. -export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json") - -# Remove old nox -python3 -m pip uninstall --yes --quiet nox-automation - -# Install nox -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/main/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 -m nox -s ${NOX_SESSION:-} -else - python3 -m nox -fi diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg deleted file mode 100644 index c68ecec..0000000 --- a/.kokoro/continuous/common.cfg +++ /dev/null @@ -1,27 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-python" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/build.sh" -} diff --git a/.kokoro/continuous/continuous.cfg b/.kokoro/continuous/continuous.cfg deleted file mode 100644 index 8f43917..0000000 --- a/.kokoro/continuous/continuous.cfg +++ /dev/null @@ -1 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto \ No newline at end of file diff --git a/.kokoro/continuous/prerelease-deps.cfg b/.kokoro/continuous/prerelease-deps.cfg deleted file mode 100644 index 3595fb4..0000000 --- a/.kokoro/continuous/prerelease-deps.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Only run this nox session. -env_vars: { - key: "NOX_SESSION" - value: "prerelease_deps" -} diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile deleted file mode 100644 index 8e39a2c..0000000 --- a/.kokoro/docker/docs/Dockerfile +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 2023 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. - -from ubuntu:22.04 - -ENV DEBIAN_FRONTEND noninteractive - -# Ensure local Python is preferred over distribution Python. -ENV PATH /usr/local/bin:$PATH - -# Install dependencies. -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-transport-https \ - build-essential \ - ca-certificates \ - curl \ - dirmngr \ - git \ - gpg-agent \ - graphviz \ - libbz2-dev \ - libdb5.3-dev \ - libexpat1-dev \ - libffi-dev \ - liblzma-dev \ - libreadline-dev \ - libsnappy-dev \ - libssl-dev \ - libsqlite3-dev \ - portaudio19-dev \ - python3-distutils \ - redis-server \ - software-properties-common \ - ssh \ - sudo \ - tcl \ - tcl-dev \ - tk \ - tk-dev \ - uuid-dev \ - wget \ - zlib1g-dev \ - && add-apt-repository universe \ - && apt-get update \ - && apt-get -y install jq \ - && apt-get clean autoclean \ - && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* \ - && rm -f /var/cache/apt/archives/*.deb - -###################### Install python 3.9.13 - -# Download python 3.9.13 -RUN wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz - -# Extract files -RUN tar -xvf Python-3.9.13.tgz - -# Install python 3.9.13 -RUN ./Python-3.9.13/configure --enable-optimizations -RUN make altinstall - -###################### Install pip -RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3 /tmp/get-pip.py \ - && rm /tmp/get-pip.py - -# Test pip -RUN python3 -m pip - -CMD ["python3.8"] diff --git a/.kokoro/docs/common.cfg b/.kokoro/docs/common.cfg deleted file mode 100644 index 7437bef..0000000 --- a/.kokoro/docs/common.cfg +++ /dev/null @@ -1,66 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-lib-docs" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/publish-docs.sh" -} - -env_vars: { - key: "STAGING_BUCKET" - value: "docs-staging" -} - -env_vars: { - key: "V2_STAGING_BUCKET" - # Push google cloud library docs to the Cloud RAD bucket `docs-staging-v2` - value: "docs-staging-v2" -} - -# It will upload the docker image after successful builds. -env_vars: { - key: "TRAMPOLINE_IMAGE_UPLOAD" - value: "true" -} - -# It will always build the docker image. -env_vars: { - key: "TRAMPOLINE_DOCKERFILE" - value: ".kokoro/docker/docs/Dockerfile" -} - -# Fetch the token needed for reporting release status to GitHub -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} \ No newline at end of file diff --git a/.kokoro/docs/docs-presubmit.cfg b/.kokoro/docs/docs-presubmit.cfg deleted file mode 100644 index c69de41..0000000 --- a/.kokoro/docs/docs-presubmit.cfg +++ /dev/null @@ -1,28 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "STAGING_BUCKET" - value: "gcloud-python-test" -} - -env_vars: { - key: "V2_STAGING_BUCKET" - value: "gcloud-python-test" -} - -# We only upload the image in the main `docs` build. -env_vars: { - key: "TRAMPOLINE_IMAGE_UPLOAD" - value: "false" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/build.sh" -} - -# Only run this nox session. -env_vars: { - key: "NOX_SESSION" - value: "docs docfx" -} diff --git a/.kokoro/docs/docs.cfg b/.kokoro/docs/docs.cfg deleted file mode 100644 index 8f43917..0000000 --- a/.kokoro/docs/docs.cfg +++ /dev/null @@ -1 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto \ No newline at end of file diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh deleted file mode 100755 index 6f39721..0000000 --- a/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# Copyright 2023 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. - -set -eo pipefail - -function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} -function msg { println "$*" >&2 ;} -function println { printf '%s\n' "$(now) $*" ;} - - -# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: -# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com -SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" -msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" -mkdir -p ${SECRET_LOCATION} -for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") -do - msg "Retrieving secret ${key}" - docker run --entrypoint=gcloud \ - --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ - gcr.io/google.com/cloudsdktool/cloud-sdk \ - secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ - --secret ${key} > \ - "${SECRET_LOCATION}/${key}" - if [[ $? == 0 ]]; then - msg "Secret written to ${SECRET_LOCATION}/${key}" - else - msg "Error retrieving secret ${key}" - fi -done diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg deleted file mode 100644 index c68ecec..0000000 --- a/.kokoro/presubmit/common.cfg +++ /dev/null @@ -1,27 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-python" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/build.sh" -} diff --git a/.kokoro/presubmit/prerelease-deps.cfg b/.kokoro/presubmit/prerelease-deps.cfg deleted file mode 100644 index 3595fb4..0000000 --- a/.kokoro/presubmit/prerelease-deps.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Only run this nox session. -env_vars: { - key: "NOX_SESSION" - value: "prerelease_deps" -} diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg deleted file mode 100644 index 8f43917..0000000 --- a/.kokoro/presubmit/presubmit.cfg +++ /dev/null @@ -1 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto \ No newline at end of file diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh deleted file mode 100755 index 9eafe0b..0000000 --- a/.kokoro/publish-docs.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# Copyright 2023 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. - -set -eo pipefail - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -export PATH="${HOME}/.local/bin:${PATH}" - -# Install nox -python3 -m pip install --require-hashes -r .kokoro/requirements.txt -python3 -m nox --version - -# build docs -nox -s docs - -# create metadata -python3 -m docuploader create-metadata \ - --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \ - --version=$(python3 setup.py --version) \ - --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \ - --distribution-name=$(python3 setup.py --name) \ - --product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \ - --github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \ - --issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json) - -cat docs.metadata - -# upload docs -python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket "${STAGING_BUCKET}" - - -# docfx yaml files -nox -s docfx - -# create metadata. -python3 -m docuploader create-metadata \ - --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \ - --version=$(python3 setup.py --version) \ - --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \ - --distribution-name=$(python3 setup.py --name) \ - --product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \ - --github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \ - --issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json) - -cat docs.metadata - -# upload docs -python3 -m docuploader upload docs/_build/html/docfx_yaml --metadata-file docs.metadata --destination-prefix docfx --staging-bucket "${V2_STAGING_BUCKET}" diff --git a/.kokoro/release.sh b/.kokoro/release.sh deleted file mode 100755 index 9ffd4a7..0000000 --- a/.kokoro/release.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright 2023 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. - -set -eo pipefail - -# Start the releasetool reporter -python3 -m pip install --require-hashes -r github/python-appengine-admin/.kokoro/requirements.txt -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -# Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") -cd github/python-appengine-admin -python3 setup.py sdist bdist_wheel -twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg deleted file mode 100644 index b5fc12c..0000000 --- a/.kokoro/release/common.cfg +++ /dev/null @@ -1,49 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/release.sh" -} - -# Fetch PyPI password -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google-cloud-pypi-token-keystore-1" - } - } -} - -# Tokens needed to report release status back to GitHub -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} - -# Store the packages we uploaded to PyPI. That way, we have a record of exactly -# what we published, which we can use to generate SBOMs and attestations. -action { - define_artifacts { - regex: "github/python-appengine-admin/**/*.tar.gz" - strip_prefix: "github/python-appengine-admin" - } -} diff --git a/.kokoro/release/release.cfg b/.kokoro/release/release.cfg deleted file mode 100644 index 8f43917..0000000 --- a/.kokoro/release/release.cfg +++ /dev/null @@ -1 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto \ No newline at end of file diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in deleted file mode 100644 index ec867d9..0000000 --- a/.kokoro/requirements.in +++ /dev/null @@ -1,10 +0,0 @@ -gcp-docuploader -gcp-releasetool>=1.10.5 # required for compatibility with cryptography>=39.x -importlib-metadata -typing-extensions -twine -wheel -setuptools -nox>=2022.11.21 # required to remove dependency on py -charset-normalizer<3 -click<8.1.0 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt deleted file mode 100644 index 16170d0..0000000 --- a/.kokoro/requirements.txt +++ /dev/null @@ -1,497 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# pip-compile --allow-unsafe --generate-hashes requirements.in -# -argcomplete==2.0.0 \ - --hash=sha256:6372ad78c89d662035101418ae253668445b391755cfe94ea52f1b9d22425b20 \ - --hash=sha256:cffa11ea77999bb0dd27bb25ff6dc142a6796142f68d45b1a26b11f58724561e - # via nox -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c - # via gcp-releasetool -bleach==5.0.1 \ - --hash=sha256:085f7f33c15bd408dd9b17a4ad77c577db66d76203e5984b1bd59baeee948b2a \ - --hash=sha256:0d03255c47eb9bd2f26aa9bb7f2107732e7e8fe195ca2f64709fcf3b0a4a085c - # via readme-renderer -cachetools==5.2.0 \ - --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ - --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db - # via google-auth -certifi==2023.7.22 \ - --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ - --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 - # via requests -cffi==1.15.1 \ - --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ - --hash=sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef \ - --hash=sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104 \ - --hash=sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426 \ - --hash=sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405 \ - --hash=sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375 \ - --hash=sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a \ - --hash=sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e \ - --hash=sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc \ - --hash=sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf \ - --hash=sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185 \ - --hash=sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497 \ - --hash=sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3 \ - --hash=sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35 \ - --hash=sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c \ - --hash=sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83 \ - --hash=sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21 \ - --hash=sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca \ - --hash=sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984 \ - --hash=sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac \ - --hash=sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd \ - --hash=sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee \ - --hash=sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a \ - --hash=sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2 \ - --hash=sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192 \ - --hash=sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7 \ - --hash=sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585 \ - --hash=sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f \ - --hash=sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e \ - --hash=sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27 \ - --hash=sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b \ - --hash=sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e \ - --hash=sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e \ - --hash=sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d \ - --hash=sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c \ - --hash=sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415 \ - --hash=sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82 \ - --hash=sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02 \ - --hash=sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314 \ - --hash=sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325 \ - --hash=sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c \ - --hash=sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3 \ - --hash=sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914 \ - --hash=sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045 \ - --hash=sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d \ - --hash=sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9 \ - --hash=sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5 \ - --hash=sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2 \ - --hash=sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c \ - --hash=sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3 \ - --hash=sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2 \ - --hash=sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8 \ - --hash=sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d \ - --hash=sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d \ - --hash=sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9 \ - --hash=sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162 \ - --hash=sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76 \ - --hash=sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4 \ - --hash=sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e \ - --hash=sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9 \ - --hash=sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6 \ - --hash=sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b \ - --hash=sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01 \ - --hash=sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0 - # via cryptography -charset-normalizer==2.1.1 \ - --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 \ - --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f - # via - # -r requirements.in - # requests -click==8.0.4 \ - --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ - --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb - # via - # -r requirements.in - # gcp-docuploader - # gcp-releasetool -colorlog==6.7.0 \ - --hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \ - --hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5 - # via - # gcp-docuploader - # nox -commonmark==0.9.1 \ - --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ - --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 - # via rich -cryptography==41.0.4 \ - --hash=sha256:004b6ccc95943f6a9ad3142cfabcc769d7ee38a3f60fb0dddbfb431f818c3a67 \ - --hash=sha256:047c4603aeb4bbd8db2756e38f5b8bd7e94318c047cfe4efeb5d715e08b49311 \ - --hash=sha256:0d9409894f495d465fe6fda92cb70e8323e9648af912d5b9141d616df40a87b8 \ - --hash=sha256:23a25c09dfd0d9f28da2352503b23e086f8e78096b9fd585d1d14eca01613e13 \ - --hash=sha256:2ed09183922d66c4ec5fdaa59b4d14e105c084dd0febd27452de8f6f74704143 \ - --hash=sha256:35c00f637cd0b9d5b6c6bd11b6c3359194a8eba9c46d4e875a3660e3b400005f \ - --hash=sha256:37480760ae08065437e6573d14be973112c9e6dcaf5f11d00147ee74f37a3829 \ - --hash=sha256:3b224890962a2d7b57cf5eeb16ccaafba6083f7b811829f00476309bce2fe0fd \ - --hash=sha256:5a0f09cefded00e648a127048119f77bc2b2ec61e736660b5789e638f43cc397 \ - --hash=sha256:5b72205a360f3b6176485a333256b9bcd48700fc755fef51c8e7e67c4b63e3ac \ - --hash=sha256:7e53db173370dea832190870e975a1e09c86a879b613948f09eb49324218c14d \ - --hash=sha256:7febc3094125fc126a7f6fb1f420d0da639f3f32cb15c8ff0dc3997c4549f51a \ - --hash=sha256:80907d3faa55dc5434a16579952ac6da800935cd98d14dbd62f6f042c7f5e839 \ - --hash=sha256:86defa8d248c3fa029da68ce61fe735432b047e32179883bdb1e79ed9bb8195e \ - --hash=sha256:8ac4f9ead4bbd0bc8ab2d318f97d85147167a488be0e08814a37eb2f439d5cf6 \ - --hash=sha256:93530900d14c37a46ce3d6c9e6fd35dbe5f5601bf6b3a5c325c7bffc030344d9 \ - --hash=sha256:9eeb77214afae972a00dee47382d2591abe77bdae166bda672fb1e24702a3860 \ - --hash=sha256:b5f4dfe950ff0479f1f00eda09c18798d4f49b98f4e2006d644b3301682ebdca \ - --hash=sha256:c3391bd8e6de35f6f1140e50aaeb3e2b3d6a9012536ca23ab0d9c35ec18c8a91 \ - --hash=sha256:c880eba5175f4307129784eca96f4e70b88e57aa3f680aeba3bab0e980b0f37d \ - --hash=sha256:cecfefa17042941f94ab54f769c8ce0fe14beff2694e9ac684176a2535bf9714 \ - --hash=sha256:e40211b4923ba5a6dc9769eab704bdb3fbb58d56c5b336d30996c24fcf12aadb \ - --hash=sha256:efc8ad4e6fc4f1752ebfb58aefece8b4e3c4cae940b0994d43649bdfce8d0d4f - # via - # gcp-releasetool - # secretstorage -distlib==0.3.6 \ - --hash=sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46 \ - --hash=sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e - # via virtualenv -docutils==0.19 \ - --hash=sha256:33995a6753c30b7f577febfc2c50411fec6aac7f7ffeb7c4cfe5991072dcf9e6 \ - --hash=sha256:5e1de4d849fee02c63b040a4a3fd567f4ab104defd8a5511fbbc24a8a017efbc - # via readme-renderer -filelock==3.8.0 \ - --hash=sha256:55447caa666f2198c5b6b13a26d2084d26fa5b115c00d065664b2124680c4edc \ - --hash=sha256:617eb4e5eedc82fc5f47b6d61e4d11cb837c56cb4544e39081099fa17ad109d4 - # via virtualenv -gcp-docuploader==0.6.4 \ - --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ - --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf - # via -r requirements.in -gcp-releasetool==1.10.5 \ - --hash=sha256:174b7b102d704b254f2a26a3eda2c684fd3543320ec239baf771542a2e58e109 \ - --hash=sha256:e29d29927fe2ca493105a82958c6873bb2b90d503acac56be2c229e74de0eec9 - # via -r requirements.in -google-api-core==2.10.2 \ - --hash=sha256:10c06f7739fe57781f87523375e8e1a3a4674bf6392cd6131a3222182b971320 \ - --hash=sha256:34f24bd1d5f72a8c4519773d99ca6bf080a6c4e041b4e9f024fe230191dda62e - # via - # google-cloud-core - # google-cloud-storage -google-auth==2.14.1 \ - --hash=sha256:ccaa901f31ad5cbb562615eb8b664b3dd0bf5404a67618e642307f00613eda4d \ - --hash=sha256:f5d8701633bebc12e0deea4df8abd8aff31c28b355360597f7f2ee60f2e4d016 - # via - # gcp-releasetool - # google-api-core - # google-cloud-core - # google-cloud-storage -google-cloud-core==2.3.2 \ - --hash=sha256:8417acf6466be2fa85123441696c4badda48db314c607cf1e5d543fa8bdc22fe \ - --hash=sha256:b9529ee7047fd8d4bf4a2182de619154240df17fbe60ead399078c1ae152af9a - # via google-cloud-storage -google-cloud-storage==2.6.0 \ - --hash=sha256:104ca28ae61243b637f2f01455cc8a05e8f15a2a18ced96cb587241cdd3820f5 \ - --hash=sha256:4ad0415ff61abdd8bb2ae81c1f8f7ec7d91a1011613f2db87c614c550f97bfe9 - # via gcp-docuploader -google-crc32c==1.5.0 \ - --hash=sha256:024894d9d3cfbc5943f8f230e23950cd4906b2fe004c72e29b209420a1e6b05a \ - --hash=sha256:02c65b9817512edc6a4ae7c7e987fea799d2e0ee40c53ec573a692bee24de876 \ - --hash=sha256:02ebb8bf46c13e36998aeaad1de9b48f4caf545e91d14041270d9dca767b780c \ - --hash=sha256:07eb3c611ce363c51a933bf6bd7f8e3878a51d124acfc89452a75120bc436289 \ - --hash=sha256:1034d91442ead5a95b5aaef90dbfaca8633b0247d1e41621d1e9f9db88c36298 \ - --hash=sha256:116a7c3c616dd14a3de8c64a965828b197e5f2d121fedd2f8c5585c547e87b02 \ - --hash=sha256:19e0a019d2c4dcc5e598cd4a4bc7b008546b0358bd322537c74ad47a5386884f \ - --hash=sha256:1c7abdac90433b09bad6c43a43af253e688c9cfc1c86d332aed13f9a7c7f65e2 \ - --hash=sha256:1e986b206dae4476f41bcec1faa057851f3889503a70e1bdb2378d406223994a \ - --hash=sha256:272d3892a1e1a2dbc39cc5cde96834c236d5327e2122d3aaa19f6614531bb6eb \ - --hash=sha256:278d2ed7c16cfc075c91378c4f47924c0625f5fc84b2d50d921b18b7975bd210 \ - --hash=sha256:2ad40e31093a4af319dadf503b2467ccdc8f67c72e4bcba97f8c10cb078207b5 \ - --hash=sha256:2e920d506ec85eb4ba50cd4228c2bec05642894d4c73c59b3a2fe20346bd00ee \ - --hash=sha256:3359fc442a743e870f4588fcf5dcbc1bf929df1fad8fb9905cd94e5edb02e84c \ - --hash=sha256:37933ec6e693e51a5b07505bd05de57eee12f3e8c32b07da7e73669398e6630a \ - --hash=sha256:398af5e3ba9cf768787eef45c803ff9614cc3e22a5b2f7d7ae116df8b11e3314 \ - --hash=sha256:3b747a674c20a67343cb61d43fdd9207ce5da6a99f629c6e2541aa0e89215bcd \ - --hash=sha256:461665ff58895f508e2866824a47bdee72497b091c730071f2b7575d5762ab65 \ - --hash=sha256:4c6fdd4fccbec90cc8a01fc00773fcd5fa28db683c116ee3cb35cd5da9ef6c37 \ - --hash=sha256:5829b792bf5822fd0a6f6eb34c5f81dd074f01d570ed7f36aa101d6fc7a0a6e4 \ - --hash=sha256:596d1f98fc70232fcb6590c439f43b350cb762fb5d61ce7b0e9db4539654cc13 \ - --hash=sha256:5ae44e10a8e3407dbe138984f21e536583f2bba1be9491239f942c2464ac0894 \ - --hash=sha256:635f5d4dd18758a1fbd1049a8e8d2fee4ffed124462d837d1a02a0e009c3ab31 \ - --hash=sha256:64e52e2b3970bd891309c113b54cf0e4384762c934d5ae56e283f9a0afcd953e \ - --hash=sha256:66741ef4ee08ea0b2cc3c86916ab66b6aef03768525627fd6a1b34968b4e3709 \ - --hash=sha256:67b741654b851abafb7bc625b6d1cdd520a379074e64b6a128e3b688c3c04740 \ - --hash=sha256:6ac08d24c1f16bd2bf5eca8eaf8304812f44af5cfe5062006ec676e7e1d50afc \ - --hash=sha256:6f998db4e71b645350b9ac28a2167e6632c239963ca9da411523bb439c5c514d \ - --hash=sha256:72218785ce41b9cfd2fc1d6a017dc1ff7acfc4c17d01053265c41a2c0cc39b8c \ - --hash=sha256:74dea7751d98034887dbd821b7aae3e1d36eda111d6ca36c206c44478035709c \ - --hash=sha256:759ce4851a4bb15ecabae28f4d2e18983c244eddd767f560165563bf9aefbc8d \ - --hash=sha256:77e2fd3057c9d78e225fa0a2160f96b64a824de17840351b26825b0848022906 \ - --hash=sha256:7c074fece789b5034b9b1404a1f8208fc2d4c6ce9decdd16e8220c5a793e6f61 \ - --hash=sha256:7c42c70cd1d362284289c6273adda4c6af8039a8ae12dc451dcd61cdabb8ab57 \ - --hash=sha256:7f57f14606cd1dd0f0de396e1e53824c371e9544a822648cd76c034d209b559c \ - --hash=sha256:83c681c526a3439b5cf94f7420471705bbf96262f49a6fe546a6db5f687a3d4a \ - --hash=sha256:8485b340a6a9e76c62a7dce3c98e5f102c9219f4cfbf896a00cf48caf078d438 \ - --hash=sha256:84e6e8cd997930fc66d5bb4fde61e2b62ba19d62b7abd7a69920406f9ecca946 \ - --hash=sha256:89284716bc6a5a415d4eaa11b1726d2d60a0cd12aadf5439828353662ede9dd7 \ - --hash=sha256:8b87e1a59c38f275c0e3676fc2ab6d59eccecfd460be267ac360cc31f7bcde96 \ - --hash=sha256:8f24ed114432de109aa9fd317278518a5af2d31ac2ea6b952b2f7782b43da091 \ - --hash=sha256:98cb4d057f285bd80d8778ebc4fde6b4d509ac3f331758fb1528b733215443ae \ - --hash=sha256:998679bf62b7fb599d2878aa3ed06b9ce688b8974893e7223c60db155f26bd8d \ - --hash=sha256:9ba053c5f50430a3fcfd36f75aff9caeba0440b2d076afdb79a318d6ca245f88 \ - --hash=sha256:9c99616c853bb585301df6de07ca2cadad344fd1ada6d62bb30aec05219c45d2 \ - --hash=sha256:a1fd716e7a01f8e717490fbe2e431d2905ab8aa598b9b12f8d10abebb36b04dd \ - --hash=sha256:a2355cba1f4ad8b6988a4ca3feed5bff33f6af2d7f134852cf279c2aebfde541 \ - --hash=sha256:b1f8133c9a275df5613a451e73f36c2aea4fe13c5c8997e22cf355ebd7bd0728 \ - --hash=sha256:b8667b48e7a7ef66afba2c81e1094ef526388d35b873966d8a9a447974ed9178 \ - --hash=sha256:ba1eb1843304b1e5537e1fca632fa894d6f6deca8d6389636ee5b4797affb968 \ - --hash=sha256:be82c3c8cfb15b30f36768797a640e800513793d6ae1724aaaafe5bf86f8f346 \ - --hash=sha256:c02ec1c5856179f171e032a31d6f8bf84e5a75c45c33b2e20a3de353b266ebd8 \ - --hash=sha256:c672d99a345849301784604bfeaeba4db0c7aae50b95be04dd651fd2a7310b93 \ - --hash=sha256:c6c777a480337ac14f38564ac88ae82d4cd238bf293f0a22295b66eb89ffced7 \ - --hash=sha256:cae0274952c079886567f3f4f685bcaf5708f0a23a5f5216fdab71f81a6c0273 \ - --hash=sha256:cd67cf24a553339d5062eff51013780a00d6f97a39ca062781d06b3a73b15462 \ - --hash=sha256:d3515f198eaa2f0ed49f8819d5732d70698c3fa37384146079b3799b97667a94 \ - --hash=sha256:d5280312b9af0976231f9e317c20e4a61cd2f9629b7bfea6a693d1878a264ebd \ - --hash=sha256:de06adc872bcd8c2a4e0dc51250e9e65ef2ca91be023b9d13ebd67c2ba552e1e \ - --hash=sha256:e1674e4307fa3024fc897ca774e9c7562c957af85df55efe2988ed9056dc4e57 \ - --hash=sha256:e2096eddb4e7c7bdae4bd69ad364e55e07b8316653234a56552d9c988bd2d61b \ - --hash=sha256:e560628513ed34759456a416bf86b54b2476c59144a9138165c9a1575801d0d9 \ - --hash=sha256:edfedb64740750e1a3b16152620220f51d58ff1b4abceb339ca92e934775c27a \ - --hash=sha256:f13cae8cc389a440def0c8c52057f37359014ccbc9dc1f0827936bcd367c6100 \ - --hash=sha256:f314013e7dcd5cf45ab1945d92e713eec788166262ae8deb2cfacd53def27325 \ - --hash=sha256:f583edb943cf2e09c60441b910d6a20b4d9d626c75a36c8fcac01a6c96c01183 \ - --hash=sha256:fd8536e902db7e365f49e7d9029283403974ccf29b13fc7028b97e2295b33556 \ - --hash=sha256:fe70e325aa68fa4b5edf7d1a4b6f691eb04bbccac0ace68e34820d283b5f80d4 - # via google-resumable-media -google-resumable-media==2.4.0 \ - --hash=sha256:2aa004c16d295c8f6c33b2b4788ba59d366677c0a25ae7382436cb30f776deaa \ - --hash=sha256:8d5518502f92b9ecc84ac46779bd4f09694ecb3ba38a3e7ca737a86d15cbca1f - # via google-cloud-storage -googleapis-common-protos==1.57.0 \ - --hash=sha256:27a849d6205838fb6cc3c1c21cb9800707a661bb21c6ce7fb13e99eb1f8a0c46 \ - --hash=sha256:a9f4a1d7f6d9809657b7f1316a1aa527f6664891531bcfcc13b6696e685f443c - # via google-api-core -idna==3.4 \ - --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ - --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 - # via requests -importlib-metadata==5.0.0 \ - --hash=sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab \ - --hash=sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43 - # via - # -r requirements.in - # keyring - # twine -jaraco-classes==3.2.3 \ - --hash=sha256:2353de3288bc6b82120752201c6b1c1a14b058267fa424ed5ce5984e3b922158 \ - --hash=sha256:89559fa5c1d3c34eff6f631ad80bb21f378dbcbb35dd161fd2c6b93f5be2f98a - # via keyring -jeepney==0.8.0 \ - --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ - --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 - # via - # keyring - # secretstorage -jinja2==3.1.2 \ - --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ - --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 - # via gcp-releasetool -keyring==23.11.0 \ - --hash=sha256:3dd30011d555f1345dec2c262f0153f2f0ca6bca041fb1dc4588349bb4c0ac1e \ - --hash=sha256:ad192263e2cdd5f12875dedc2da13534359a7e760e77f8d04b50968a821c2361 - # via - # gcp-releasetool - # twine -markupsafe==2.1.1 \ - --hash=sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003 \ - --hash=sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88 \ - --hash=sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5 \ - --hash=sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7 \ - --hash=sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a \ - --hash=sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603 \ - --hash=sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1 \ - --hash=sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135 \ - --hash=sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247 \ - --hash=sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6 \ - --hash=sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601 \ - --hash=sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77 \ - --hash=sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02 \ - --hash=sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e \ - --hash=sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63 \ - --hash=sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f \ - --hash=sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980 \ - --hash=sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b \ - --hash=sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812 \ - --hash=sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff \ - --hash=sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96 \ - --hash=sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1 \ - --hash=sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925 \ - --hash=sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a \ - --hash=sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6 \ - --hash=sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e \ - --hash=sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f \ - --hash=sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4 \ - --hash=sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f \ - --hash=sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3 \ - --hash=sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c \ - --hash=sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a \ - --hash=sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417 \ - --hash=sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a \ - --hash=sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a \ - --hash=sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37 \ - --hash=sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452 \ - --hash=sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933 \ - --hash=sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a \ - --hash=sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7 - # via jinja2 -more-itertools==9.0.0 \ - --hash=sha256:250e83d7e81d0c87ca6bd942e6aeab8cc9daa6096d12c5308f3f92fa5e5c1f41 \ - --hash=sha256:5a6257e40878ef0520b1803990e3e22303a41b5714006c32a3fd8304b26ea1ab - # via jaraco-classes -nox==2022.11.21 \ - --hash=sha256:0e41a990e290e274cb205a976c4c97ee3c5234441a8132c8c3fd9ea3c22149eb \ - --hash=sha256:e21c31de0711d1274ca585a2c5fde36b1aa962005ba8e9322bf5eeed16dcd684 - # via -r requirements.in -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 - # via - # gcp-releasetool - # nox -pkginfo==1.8.3 \ - --hash=sha256:848865108ec99d4901b2f7e84058b6e7660aae8ae10164e015a6dcf5b242a594 \ - --hash=sha256:a84da4318dd86f870a9447a8c98340aa06216bfc6f2b7bdc4b8766984ae1867c - # via twine -platformdirs==2.5.4 \ - --hash=sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7 \ - --hash=sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10 - # via virtualenv -protobuf==3.20.3 \ - --hash=sha256:03038ac1cfbc41aa21f6afcbcd357281d7521b4157926f30ebecc8d4ea59dcb7 \ - --hash=sha256:28545383d61f55b57cf4df63eebd9827754fd2dc25f80c5253f9184235db242c \ - --hash=sha256:2e3427429c9cffebf259491be0af70189607f365c2f41c7c3764af6f337105f2 \ - --hash=sha256:398a9e0c3eaceb34ec1aee71894ca3299605fa8e761544934378bbc6c97de23b \ - --hash=sha256:44246bab5dd4b7fbd3c0c80b6f16686808fab0e4aca819ade6e8d294a29c7050 \ - --hash=sha256:447d43819997825d4e71bf5769d869b968ce96848b6479397e29fc24c4a5dfe9 \ - --hash=sha256:67a3598f0a2dcbc58d02dd1928544e7d88f764b47d4a286202913f0b2801c2e7 \ - --hash=sha256:74480f79a023f90dc6e18febbf7b8bac7508420f2006fabd512013c0c238f454 \ - --hash=sha256:819559cafa1a373b7096a482b504ae8a857c89593cf3a25af743ac9ecbd23480 \ - --hash=sha256:899dc660cd599d7352d6f10d83c95df430a38b410c1b66b407a6b29265d66469 \ - --hash=sha256:8c0c984a1b8fef4086329ff8dd19ac77576b384079247c770f29cc8ce3afa06c \ - --hash=sha256:9aae4406ea63d825636cc11ffb34ad3379335803216ee3a856787bcf5ccc751e \ - --hash=sha256:a7ca6d488aa8ff7f329d4c545b2dbad8ac31464f1d8b1c87ad1346717731e4db \ - --hash=sha256:b6cc7ba72a8850621bfec987cb72623e703b7fe2b9127a161ce61e61558ad905 \ - --hash=sha256:bf01b5720be110540be4286e791db73f84a2b721072a3711efff6c324cdf074b \ - --hash=sha256:c02ce36ec760252242a33967d51c289fd0e1c0e6e5cc9397e2279177716add86 \ - --hash=sha256:d9e4432ff660d67d775c66ac42a67cf2453c27cb4d738fc22cb53b5d84c135d4 \ - --hash=sha256:daa564862dd0d39c00f8086f88700fdbe8bc717e993a21e90711acfed02f2402 \ - --hash=sha256:de78575669dddf6099a8a0f46a27e82a1783c557ccc38ee620ed8cc96d3be7d7 \ - --hash=sha256:e64857f395505ebf3d2569935506ae0dfc4a15cb80dc25261176c784662cdcc4 \ - --hash=sha256:f4bd856d702e5b0d96a00ec6b307b0f51c1982c2bf9c0052cf9019e9a544ba99 \ - --hash=sha256:f4c42102bc82a51108e449cbb32b19b180022941c727bac0cfd50170341f16ee - # via - # gcp-docuploader - # gcp-releasetool - # google-api-core - # googleapis-common-protos -pyasn1==0.4.8 \ - --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ - --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba - # via - # pyasn1-modules - # rsa -pyasn1-modules==0.2.8 \ - --hash=sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e \ - --hash=sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74 - # via google-auth -pycparser==2.21 \ - --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \ - --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206 - # via cffi -pygments==2.15.0 \ - --hash=sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094 \ - --hash=sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500 - # via - # readme-renderer - # rich -pyjwt==2.6.0 \ - --hash=sha256:69285c7e31fc44f68a1feb309e948e0df53259d579295e6cfe2b1792329f05fd \ - --hash=sha256:d83c3d892a77bbb74d3e1a2cfa90afaadb60945205d1095d9221f04466f64c14 - # via gcp-releasetool -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pyperclip==1.8.2 \ - --hash=sha256:105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57 - # via gcp-releasetool -python-dateutil==2.8.2 \ - --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ - --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 - # via gcp-releasetool -readme-renderer==37.3 \ - --hash=sha256:cd653186dfc73055656f090f227f5cb22a046d7f71a841dfa305f55c9a513273 \ - --hash=sha256:f67a16caedfa71eef48a31b39708637a6f4664c4394801a7b0d6432d13907343 - # via twine -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 - # via - # gcp-releasetool - # google-api-core - # google-cloud-storage - # requests-toolbelt - # twine -requests-toolbelt==0.10.1 \ - --hash=sha256:18565aa58116d9951ac39baa288d3adb5b3ff975c4f25eee78555d89e8f247f7 \ - --hash=sha256:62e09f7ff5ccbda92772a29f394a49c3ad6cb181d568b1337626b2abb628a63d - # via twine -rfc3986==2.0.0 \ - --hash=sha256:50b1502b60e289cb37883f3dfd34532b8873c7de9f49bb546641ce9cbd256ebd \ - --hash=sha256:97aacf9dbd4bfd829baad6e6309fa6573aaf1be3f6fa735c8ab05e46cecb261c - # via twine -rich==12.6.0 \ - --hash=sha256:a4eb26484f2c82589bd9a17c73d32a010b1e29d89f1604cd9bf3a2097b81bb5e \ - --hash=sha256:ba3a3775974105c221d31141f2c116f4fd65c5ceb0698657a11e9f295ec93fd0 - # via twine -rsa==4.9 \ - --hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \ - --hash=sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21 - # via google-auth -secretstorage==3.3.3 \ - --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ - --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 - # via keyring -six==1.16.0 \ - --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ - --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # bleach - # gcp-docuploader - # google-auth - # python-dateutil -twine==4.0.1 \ - --hash=sha256:42026c18e394eac3e06693ee52010baa5313e4811d5a11050e7d48436cf41b9e \ - --hash=sha256:96b1cf12f7ae611a4a40b6ae8e9570215daff0611828f5fe1f37a16255ab24a0 - # via -r requirements.in -typing-extensions==4.4.0 \ - --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ - --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e - # via -r requirements.in -urllib3==1.26.18 \ - --hash=sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07 \ - --hash=sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0 - # via - # requests - # twine -virtualenv==20.16.7 \ - --hash=sha256:8691e3ff9387f743e00f6bb20f70121f5e4f596cae754531f2b3b3a1b1ac696e \ - --hash=sha256:efd66b00386fdb7dbe4822d172303f40cd05e50e01740b19ea42425cbe653e29 - # via nox -webencodings==0.5.1 \ - --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ - --hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923 - # via bleach -wheel==0.38.4 \ - --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ - --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 - # via -r requirements.in -zipp==3.10.0 \ - --hash=sha256:4fcb6f278987a6605757302a6e40e896257570d11c51628968ccb2a47e80c6c1 \ - --hash=sha256:7a7262fd930bd3e36c50b9a64897aec3fafff3dfdeec9623ae22b40e93f99bb8 - # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -setuptools==65.5.1 \ - --hash=sha256:d0b9a8433464d5800cbe05094acf5c6d52a91bfac9b52bcfc4d41382be5d5d31 \ - --hash=sha256:e197a19aa8ec9722928f2206f8de752def0e4c9fc6953527360d1c36d94ddb2f - # via -r requirements.in diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg deleted file mode 100644 index b8ac213..0000000 --- a/.kokoro/samples/lint/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "lint" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/lint/continuous.cfg b/.kokoro/samples/lint/continuous.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/lint/continuous.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/lint/periodic.cfg b/.kokoro/samples/lint/periodic.cfg deleted file mode 100644 index 50fec96..0000000 --- a/.kokoro/samples/lint/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} \ No newline at end of file diff --git a/.kokoro/samples/lint/presubmit.cfg b/.kokoro/samples/lint/presubmit.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/lint/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.10/common.cfg b/.kokoro/samples/python3.10/common.cfg deleted file mode 100644 index 0ed8714..0000000 --- a/.kokoro/samples/python3.10/common.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "py-3.10" -} - -# Declare build specific Cloud project. -env_vars: { - key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests-310" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.10/continuous.cfg b/.kokoro/samples/python3.10/continuous.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.10/continuous.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.10/periodic-head.cfg b/.kokoro/samples/python3.10/periodic-head.cfg deleted file mode 100644 index 302c7b0..0000000 --- a/.kokoro/samples/python3.10/periodic-head.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# 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-appengine-admin/.kokoro/test-samples-against-head.sh" -} diff --git a/.kokoro/samples/python3.10/periodic.cfg b/.kokoro/samples/python3.10/periodic.cfg deleted file mode 100644 index 71cd1e5..0000000 --- a/.kokoro/samples/python3.10/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} diff --git a/.kokoro/samples/python3.10/presubmit.cfg b/.kokoro/samples/python3.10/presubmit.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.10/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.11/common.cfg b/.kokoro/samples/python3.11/common.cfg deleted file mode 100644 index c26a74f..0000000 --- a/.kokoro/samples/python3.11/common.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "py-3.11" -} - -# Declare build specific Cloud project. -env_vars: { - key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests-311" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.11/continuous.cfg b/.kokoro/samples/python3.11/continuous.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.11/continuous.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.11/periodic-head.cfg b/.kokoro/samples/python3.11/periodic-head.cfg deleted file mode 100644 index 302c7b0..0000000 --- a/.kokoro/samples/python3.11/periodic-head.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# 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-appengine-admin/.kokoro/test-samples-against-head.sh" -} diff --git a/.kokoro/samples/python3.11/periodic.cfg b/.kokoro/samples/python3.11/periodic.cfg deleted file mode 100644 index 71cd1e5..0000000 --- a/.kokoro/samples/python3.11/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} diff --git a/.kokoro/samples/python3.11/presubmit.cfg b/.kokoro/samples/python3.11/presubmit.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.11/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg deleted file mode 100644 index b9dc6a6..0000000 --- a/.kokoro/samples/python3.7/common.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "py-3.7" -} - -# Declare build specific Cloud project. -env_vars: { - key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests-py37" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.7/continuous.cfg b/.kokoro/samples/python3.7/continuous.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.7/continuous.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.7/periodic-head.cfg b/.kokoro/samples/python3.7/periodic-head.cfg deleted file mode 100644 index 302c7b0..0000000 --- a/.kokoro/samples/python3.7/periodic-head.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# 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-appengine-admin/.kokoro/test-samples-against-head.sh" -} diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg deleted file mode 100644 index 71cd1e5..0000000 --- a/.kokoro/samples/python3.7/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} diff --git a/.kokoro/samples/python3.7/presubmit.cfg b/.kokoro/samples/python3.7/presubmit.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.7/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg deleted file mode 100644 index ae2248d..0000000 --- a/.kokoro/samples/python3.8/common.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "py-3.8" -} - -# Declare build specific Cloud project. -env_vars: { - key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests-py38" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.8/continuous.cfg b/.kokoro/samples/python3.8/continuous.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.8/continuous.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.8/periodic-head.cfg b/.kokoro/samples/python3.8/periodic-head.cfg deleted file mode 100644 index 302c7b0..0000000 --- a/.kokoro/samples/python3.8/periodic-head.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# 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-appengine-admin/.kokoro/test-samples-against-head.sh" -} diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg deleted file mode 100644 index 71cd1e5..0000000 --- a/.kokoro/samples/python3.8/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} diff --git a/.kokoro/samples/python3.8/presubmit.cfg b/.kokoro/samples/python3.8/presubmit.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.8/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg deleted file mode 100644 index b12d923..0000000 --- a/.kokoro/samples/python3.9/common.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Specify which tests to run -env_vars: { - key: "RUN_TESTS_SESSION" - value: "py-3.9" -} - -# Declare build specific Cloud project. -env_vars: { - key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests-py39" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-appengine-admin/.kokoro/test-samples.sh" -} - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" -} - -# Download secrets for samples -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.9/continuous.cfg b/.kokoro/samples/python3.9/continuous.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.9/continuous.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/samples/python3.9/periodic-head.cfg b/.kokoro/samples/python3.9/periodic-head.cfg deleted file mode 100644 index 302c7b0..0000000 --- a/.kokoro/samples/python3.9/periodic-head.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# 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-appengine-admin/.kokoro/test-samples-against-head.sh" -} diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg deleted file mode 100644 index 71cd1e5..0000000 --- a/.kokoro/samples/python3.9/periodic.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "False" -} diff --git a/.kokoro/samples/python3.9/presubmit.cfg b/.kokoro/samples/python3.9/presubmit.cfg deleted file mode 100644 index a1c8d97..0000000 --- a/.kokoro/samples/python3.9/presubmit.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "INSTALL_LIBRARY_FROM_SOURCE" - value: "True" -} \ No newline at end of file diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh deleted file mode 100755 index 63ac41d..0000000 --- a/.kokoro/test-samples-against-head.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 2023 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 - -exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh deleted file mode 100755 index 5a0f5fa..0000000 --- a/.kokoro/test-samples-impl.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# Copyright 2023 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 don't exist -if ! find samples -name 'requirements.txt' | grep -q .; then - echo "No tests run. './samples/**/requirements.txt' 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.9 -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.9 -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/main/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 deleted file mode 100755 index 50b35a4..0000000 --- a/.kokoro/test-samples.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Copyright 2023 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. - -# 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 -set -eo pipefail -# Enables `**` to include files nested inside sub-folders -shopt -s globstar - -# 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 - 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 - -exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh deleted file mode 100755 index d85b1f2..0000000 --- a/.kokoro/trampoline.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright 2023 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. - -set -eo pipefail - -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" \ No newline at end of file diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh deleted file mode 100755 index 59a7cf3..0000000 --- a/.kokoro/trampoline_v2.sh +++ /dev/null @@ -1,487 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 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. - -# trampoline_v2.sh -# -# This script does 3 things. -# -# 1. Prepare the Docker image for the test -# 2. Run the Docker with appropriate flags to run the test -# 3. Upload the newly built Docker image -# -# in a way that is somewhat compatible with trampoline_v1. -# -# To run this script, first download few files from gcs to /dev/shm. -# (/dev/shm is passed into the container as KOKORO_GFILE_DIR). -# -# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm -# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm -# -# Then run the script. -# .kokoro/trampoline_v2.sh -# -# These environment variables are required: -# TRAMPOLINE_IMAGE: The docker image to use. -# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile. -# -# You can optionally change these environment variables: -# TRAMPOLINE_IMAGE_UPLOAD: -# (true|false): Whether to upload the Docker image after the -# successful builds. -# TRAMPOLINE_BUILD_FILE: The script to run in the docker container. -# TRAMPOLINE_WORKSPACE: The workspace path in the docker container. -# Defaults to /workspace. -# Potentially there are some repo specific envvars in .trampolinerc in -# the project root. - - -set -euo pipefail - -TRAMPOLINE_VERSION="2.0.5" - -if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then - readonly IO_COLOR_RED="$(tput setaf 1)" - readonly IO_COLOR_GREEN="$(tput setaf 2)" - readonly IO_COLOR_YELLOW="$(tput setaf 3)" - readonly IO_COLOR_RESET="$(tput sgr0)" -else - readonly IO_COLOR_RED="" - readonly IO_COLOR_GREEN="" - readonly IO_COLOR_YELLOW="" - readonly IO_COLOR_RESET="" -fi - -function function_exists { - [ $(LC_ALL=C type -t $1)"" == "function" ] -} - -# Logs a message using the given color. The first argument must be one -# of the IO_COLOR_* variables defined above, such as -# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the -# given color. The log message will also have an RFC-3339 timestamp -# prepended (in UTC). You can disable the color output by setting -# TERM=vt100. -function log_impl() { - local color="$1" - shift - local timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")" - echo "================================================================" - echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}" - echo "================================================================" -} - -# Logs the given message with normal coloring and a timestamp. -function log() { - log_impl "${IO_COLOR_RESET}" "$@" -} - -# Logs the given message in green with a timestamp. -function log_green() { - log_impl "${IO_COLOR_GREEN}" "$@" -} - -# Logs the given message in yellow with a timestamp. -function log_yellow() { - log_impl "${IO_COLOR_YELLOW}" "$@" -} - -# Logs the given message in red with a timestamp. -function log_red() { - log_impl "${IO_COLOR_RED}" "$@" -} - -readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX) -readonly tmphome="${tmpdir}/h" -mkdir -p "${tmphome}" - -function cleanup() { - rm -rf "${tmpdir}" -} -trap cleanup EXIT - -RUNNING_IN_CI="${RUNNING_IN_CI:-false}" - -# The workspace in the container, defaults to /workspace. -TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}" - -pass_down_envvars=( - # TRAMPOLINE_V2 variables. - # Tells scripts whether they are running as part of CI or not. - "RUNNING_IN_CI" - # Indicates which CI system we're in. - "TRAMPOLINE_CI" - # Indicates the version of the script. - "TRAMPOLINE_VERSION" -) - -log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}" - -# Detect which CI systems we're in. If we're in any of the CI systems -# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be -# the name of the CI system. Both envvars will be passing down to the -# container for telling which CI system we're in. -if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then - # descriptive env var for indicating it's on CI. - RUNNING_IN_CI="true" - TRAMPOLINE_CI="kokoro" - if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then - if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then - log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting." - exit 1 - fi - # This service account will be activated later. - TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" - else - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - gcloud auth list - fi - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet - fi - pass_down_envvars+=( - # KOKORO dynamic variables. - "KOKORO_BUILD_NUMBER" - "KOKORO_BUILD_ID" - "KOKORO_JOB_NAME" - "KOKORO_GIT_COMMIT" - "KOKORO_GITHUB_COMMIT" - "KOKORO_GITHUB_PULL_REQUEST_NUMBER" - "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For FlakyBot - "KOKORO_GITHUB_COMMIT_URL" - "KOKORO_GITHUB_PULL_REQUEST_URL" - ) -elif [[ "${TRAVIS:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="travis" - pass_down_envvars+=( - "TRAVIS_BRANCH" - "TRAVIS_BUILD_ID" - "TRAVIS_BUILD_NUMBER" - "TRAVIS_BUILD_WEB_URL" - "TRAVIS_COMMIT" - "TRAVIS_COMMIT_MESSAGE" - "TRAVIS_COMMIT_RANGE" - "TRAVIS_JOB_NAME" - "TRAVIS_JOB_NUMBER" - "TRAVIS_JOB_WEB_URL" - "TRAVIS_PULL_REQUEST" - "TRAVIS_PULL_REQUEST_BRANCH" - "TRAVIS_PULL_REQUEST_SHA" - "TRAVIS_PULL_REQUEST_SLUG" - "TRAVIS_REPO_SLUG" - "TRAVIS_SECURE_ENV_VARS" - "TRAVIS_TAG" - ) -elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="github-workflow" - pass_down_envvars+=( - "GITHUB_WORKFLOW" - "GITHUB_RUN_ID" - "GITHUB_RUN_NUMBER" - "GITHUB_ACTION" - "GITHUB_ACTIONS" - "GITHUB_ACTOR" - "GITHUB_REPOSITORY" - "GITHUB_EVENT_NAME" - "GITHUB_EVENT_PATH" - "GITHUB_SHA" - "GITHUB_REF" - "GITHUB_HEAD_REF" - "GITHUB_BASE_REF" - ) -elif [[ "${CIRCLECI:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="circleci" - pass_down_envvars+=( - "CIRCLE_BRANCH" - "CIRCLE_BUILD_NUM" - "CIRCLE_BUILD_URL" - "CIRCLE_COMPARE_URL" - "CIRCLE_JOB" - "CIRCLE_NODE_INDEX" - "CIRCLE_NODE_TOTAL" - "CIRCLE_PREVIOUS_BUILD_NUM" - "CIRCLE_PROJECT_REPONAME" - "CIRCLE_PROJECT_USERNAME" - "CIRCLE_REPOSITORY_URL" - "CIRCLE_SHA1" - "CIRCLE_STAGE" - "CIRCLE_USERNAME" - "CIRCLE_WORKFLOW_ID" - "CIRCLE_WORKFLOW_JOB_ID" - "CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS" - "CIRCLE_WORKFLOW_WORKSPACE_ID" - ) -fi - -# Configure the service account for pulling the docker image. -function repo_root() { - local dir="$1" - while [[ ! -d "${dir}/.git" ]]; do - dir="$(dirname "$dir")" - done - echo "${dir}" -} - -# Detect the project root. In CI builds, we assume the script is in -# the git tree and traverse from there, otherwise, traverse from `pwd` -# to find `.git` directory. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - PROGRAM_PATH="$(realpath "$0")" - PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")" - PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")" -else - PROJECT_ROOT="$(repo_root $(pwd))" -fi - -log_yellow "Changing to the project root: ${PROJECT_ROOT}." -cd "${PROJECT_ROOT}" - -# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need -# to use this environment variable in `PROJECT_ROOT`. -if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then - - mkdir -p "${tmpdir}/gcloud" - gcloud_config_dir="${tmpdir}/gcloud" - - log_yellow "Using isolated gcloud config: ${gcloud_config_dir}." - export CLOUDSDK_CONFIG="${gcloud_config_dir}" - - log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication." - gcloud auth activate-service-account \ - --key-file "${TRAMPOLINE_SERVICE_ACCOUNT}" - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet -fi - -required_envvars=( - # The basic trampoline configurations. - "TRAMPOLINE_IMAGE" - "TRAMPOLINE_BUILD_FILE" -) - -if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then - source "${PROJECT_ROOT}/.trampolinerc" -fi - -log_yellow "Checking environment variables." -for e in "${required_envvars[@]}" -do - if [[ -z "${!e:-}" ]]; then - log "Missing ${e} env var. Aborting." - exit 1 - fi -done - -# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1 -# script: e.g. "github/repo-name/.kokoro/run_tests.sh" -TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}" -log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}" - -# ignore error on docker operations and test execution -set +e - -log_yellow "Preparing Docker image." -# We only download the docker image in CI builds. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # Download the docker image specified by `TRAMPOLINE_IMAGE` - - # We may want to add --max-concurrent-downloads flag. - - log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}." - if docker pull "${TRAMPOLINE_IMAGE}"; then - log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="true" - else - log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="false" - fi -else - # For local run, check if we have the image. - if docker images "${TRAMPOLINE_IMAGE}:latest" | grep "${TRAMPOLINE_IMAGE}"; then - has_image="true" - else - has_image="false" - fi -fi - - -# The default user for a Docker container has uid 0 (root). To avoid -# creating root-owned files in the build directory we tell docker to -# use the current user ID. -user_uid="$(id -u)" -user_gid="$(id -g)" -user_name="$(id -un)" - -# To allow docker in docker, we add the user to the docker group in -# the host os. -docker_gid=$(cut -d: -f3 < <(getent group docker)) - -update_cache="false" -if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then - # Build the Docker image from the source. - context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}") - docker_build_flags=( - "-f" "${TRAMPOLINE_DOCKERFILE}" - "-t" "${TRAMPOLINE_IMAGE}" - "--build-arg" "UID=${user_uid}" - "--build-arg" "USERNAME=${user_name}" - ) - if [[ "${has_image}" == "true" ]]; then - docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}") - fi - - log_yellow "Start building the docker image." - if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then - echo "docker build" "${docker_build_flags[@]}" "${context_dir}" - fi - - # ON CI systems, we want to suppress docker build logs, only - # output the logs when it fails. - if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - if docker build "${docker_build_flags[@]}" "${context_dir}" \ - > "${tmpdir}/docker_build.log" 2>&1; then - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - cat "${tmpdir}/docker_build.log" - fi - - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - log_yellow "Dumping the build logs:" - cat "${tmpdir}/docker_build.log" - exit 1 - fi - else - if docker build "${docker_build_flags[@]}" "${context_dir}"; then - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - exit 1 - fi - fi -else - if [[ "${has_image}" != "true" ]]; then - log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting." - exit 1 - fi -fi - -# We use an array for the flags so they are easier to document. -docker_flags=( - # Remove the container after it exists. - "--rm" - - # Use the host network. - "--network=host" - - # Run in priviledged mode. We are not using docker for sandboxing or - # isolation, just for packaging our dev tools. - "--privileged" - - # Run the docker script with the user id. Because the docker image gets to - # write in ${PWD} you typically want this to be your user id. - # To allow docker in docker, we need to use docker gid on the host. - "--user" "${user_uid}:${docker_gid}" - - # Pass down the USER. - "--env" "USER=${user_name}" - - # Mount the project directory inside the Docker container. - "--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}" - "--workdir" "${TRAMPOLINE_WORKSPACE}" - "--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}" - - # Mount the temporary home directory. - "--volume" "${tmphome}:/h" - "--env" "HOME=/h" - - # Allow docker in docker. - "--volume" "/var/run/docker.sock:/var/run/docker.sock" - - # Mount the /tmp so that docker in docker can mount the files - # there correctly. - "--volume" "/tmp:/tmp" - # Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR - # TODO(tmatsuo): This part is not portable. - "--env" "TRAMPOLINE_SECRET_DIR=/secrets" - "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile" - "--env" "KOKORO_GFILE_DIR=/secrets/gfile" - "--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore" - "--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore" -) - -# Add an option for nicer output if the build gets a tty. -if [[ -t 0 ]]; then - docker_flags+=("-it") -fi - -# Passing down env vars -for e in "${pass_down_envvars[@]}" -do - if [[ -n "${!e:-}" ]]; then - docker_flags+=("--env" "${e}=${!e}") - fi -done - -# If arguments are given, all arguments will become the commands run -# in the container, otherwise run TRAMPOLINE_BUILD_FILE. -if [[ $# -ge 1 ]]; then - log_yellow "Running the given commands '" "${@:1}" "' in the container." - readonly commands=("${@:1}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" -else - log_yellow "Running the tests in a Docker container." - docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" -fi - - -test_retval=$? - -if [[ ${test_retval} -eq 0 ]]; then - log_green "Build finished with ${test_retval}" -else - log_red "Build finished with ${test_retval}" -fi - -# Only upload it when the test passes. -if [[ "${update_cache}" == "true" ]] && \ - [[ $test_retval == 0 ]] && \ - [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then - log_yellow "Uploading the Docker image." - if docker push "${TRAMPOLINE_IMAGE}"; then - log_green "Finished uploading the Docker image." - else - log_red "Failed uploading the Docker image." - fi - # Call trampoline_after_upload_hook if it's defined. - if function_exists trampoline_after_upload_hook; then - trampoline_after_upload_hook - fi - -fi - -exit "${test_retval}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 6a8e169..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2023 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. -# -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml -- repo: https://github.com/psf/black - rev: 23.7.0 - hooks: - - id: black -- repo: https://github.com/pycqa/flake8 - rev: 6.1.0 - hooks: - - id: flake8 diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index d8a026d..0000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "1.9.4" -} diff --git a/.trampolinerc b/.trampolinerc deleted file mode 100644 index a7dfeb4..0000000 --- a/.trampolinerc +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2023 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. - -# Add required env vars here. -required_envvars+=( -) - -# Add env vars which are passed down into the container here. -pass_down_envvars+=( - "NOX_SESSION" - ############### - # Docs builds - ############### - "STAGING_BUCKET" - "V2_STAGING_BUCKET" - ################## - # Samples builds - ################## - "INSTALL_LIBRARY_FROM_SOURCE" - "RUN_TESTS_SESSION" - "BUILD_SPECIFIC_GCLOUD_PROJECT" - # Target directories. - "RUN_TESTS_DIRS" - # The nox session to run. - "RUN_TESTS_SESSION" -) - -# Prevent unintentional override on the default image. -if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \ - [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image." - exit 1 -fi - -# Define the default value if it makes sense. -if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then - TRAMPOLINE_IMAGE_UPLOAD="" -fi - -if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - TRAMPOLINE_IMAGE="" -fi - -if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then - TRAMPOLINE_DOCKERFILE="" -fi - -if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then - TRAMPOLINE_BUILD_FILE="" -fi diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 1cc3724..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,310 +0,0 @@ -# Changelog - -## [1.9.4](https://github.com/googleapis/python-appengine-admin/compare/v1.9.3...v1.9.4) (2023-10-09) - - -### Documentation - -* Minor formatting ([#249](https://github.com/googleapis/python-appengine-admin/issues/249)) ([7de9b52](https://github.com/googleapis/python-appengine-admin/commit/7de9b52ce89849f49ca067690a8725d3d9239f09)) - -## [1.9.3](https://github.com/googleapis/python-appengine-admin/compare/v1.9.2...v1.9.3) (2023-07-04) - - -### Bug Fixes - -* Add async context manager return types ([#238](https://github.com/googleapis/python-appengine-admin/issues/238)) ([72764d1](https://github.com/googleapis/python-appengine-admin/commit/72764d13c06bdd3d6055efcb753819f67823a971)) - -## [1.9.2](https://github.com/googleapis/python-appengine-admin/compare/v1.9.1...v1.9.2) (2023-04-01) - - -### Documentation - -* Point to Search Console for domain ownership verification ([#232](https://github.com/googleapis/python-appengine-admin/issues/232)) ([a45eff9](https://github.com/googleapis/python-appengine-admin/commit/a45eff96750e74230f60e312b2ab0ad9b9933ec5)) - -## [1.9.1](https://github.com/googleapis/python-appengine-admin/compare/v1.9.0...v1.9.1) (2023-03-23) - - -### Documentation - -* Fix formatting of request arg in docstring ([#230](https://github.com/googleapis/python-appengine-admin/issues/230)) ([7738bed](https://github.com/googleapis/python-appengine-admin/commit/7738bed39a867311611a57f7da9e2cd48d58f7c3)) - -## [1.9.0](https://github.com/googleapis/python-appengine-admin/compare/v1.8.1...v1.9.0) (2023-02-27) - - -### Features - -* Enable "rest" transport in Python for services supporting numeric enums ([#224](https://github.com/googleapis/python-appengine-admin/issues/224)) ([819631a](https://github.com/googleapis/python-appengine-admin/commit/819631abc6b95d3d40d1772f74dac62300f4616f)) - -## [1.8.1](https://github.com/googleapis/python-appengine-admin/compare/v1.8.0...v1.8.1) (2023-01-20) - - -### Bug Fixes - -* Add context manager return types ([846b2e1](https://github.com/googleapis/python-appengine-admin/commit/846b2e19462cbe1a0b2e201b95eee65deb3dbd5b)) - - -### Documentation - -* Add documentation for enums ([846b2e1](https://github.com/googleapis/python-appengine-admin/commit/846b2e19462cbe1a0b2e201b95eee65deb3dbd5b)) - -## [1.8.0](https://github.com/googleapis/python-appengine-admin/compare/v1.7.1...v1.8.0) (2023-01-10) - - -### Features - -* Add support for python 3.11 ([#216](https://github.com/googleapis/python-appengine-admin/issues/216)) ([ed1c020](https://github.com/googleapis/python-appengine-admin/commit/ed1c020e28cc152dc273c409abfdc36c6c376b20)) - -## [1.7.1](https://github.com/googleapis/python-appengine-admin/compare/v1.7.0...v1.7.1) (2022-12-08) - - -### Bug Fixes - -* **deps:** Require google-api-core >=1.34.0, >=2.11.0 ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) -* Drop usage of pkg_resources ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) -* Fix timeout default values ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) - - -### Documentation - -* **samples:** Snippetgen should call await on the operation coroutine before calling result ([a086ce0](https://github.com/googleapis/python-appengine-admin/commit/a086ce0d68a2790bb46390fe5d2c7d9b2db235c0)) - -## [1.7.0](https://github.com/googleapis/python-appengine-admin/compare/v1.6.0...v1.7.0) (2022-11-16) - - -### Features - -* Add typing to proto.Message based class attributes ([80bd28c](https://github.com/googleapis/python-appengine-admin/commit/80bd28cf8f56ea3691aa08005445b81d8372e033)) - - -### Documentation - -* **samples:** Snippetgen handling of repeated enum field ([80bd28c](https://github.com/googleapis/python-appengine-admin/commit/80bd28cf8f56ea3691aa08005445b81d8372e033)) - -## [1.6.0](https://github.com/googleapis/python-appengine-admin/compare/v1.5.3...v1.6.0) (2022-11-08) - - -### Features - -* add support for `google.cloud.appengine_admin.__version__` ([2126361](https://github.com/googleapis/python-appengine-admin/commit/2126361cafcaed79633e7f403591a53a507972ba)) - - -### Bug Fixes - -* Add dict typing for client_options ([2126361](https://github.com/googleapis/python-appengine-admin/commit/2126361cafcaed79633e7f403591a53a507972ba)) -* **deps:** require google-api-core >=1.33.2 ([2126361](https://github.com/googleapis/python-appengine-admin/commit/2126361cafcaed79633e7f403591a53a507972ba)) - -## [1.5.3](https://github.com/googleapis/python-appengine-admin/compare/v1.5.2...v1.5.3) (2022-10-07) - - -### Bug Fixes - -* **deps:** Allow protobuf 3.19.5 ([#201](https://github.com/googleapis/python-appengine-admin/issues/201)) ([be08794](https://github.com/googleapis/python-appengine-admin/commit/be0879490e5bc6a61756e17d71d7c51f4742a19f)) - -## [1.5.2](https://github.com/googleapis/python-appengine-admin/compare/v1.5.1...v1.5.2) (2022-09-29) - - -### Bug Fixes - -* **deps:** Require protobuf >= 3.20.2 ([#199](https://github.com/googleapis/python-appengine-admin/issues/199)) ([dcadfa9](https://github.com/googleapis/python-appengine-admin/commit/dcadfa97388ec350a026436e644bf7d4024549a3)) - -## [1.5.1](https://github.com/googleapis/python-appengine-admin/compare/v1.5.0...v1.5.1) (2022-08-11) - - -### Bug Fixes - -* **deps:** allow protobuf < 5.0.0 ([#184](https://github.com/googleapis/python-appengine-admin/issues/184)) ([ee28547](https://github.com/googleapis/python-appengine-admin/commit/ee28547fb402ae8917a70ad776fa99e927599852)) -* **deps:** require proto-plus >= 1.22.0 ([ee28547](https://github.com/googleapis/python-appengine-admin/commit/ee28547fb402ae8917a70ad776fa99e927599852)) - -## [1.5.0](https://github.com/googleapis/python-appengine-admin/compare/v1.4.1...v1.5.0) (2022-07-18) - - -### Features - -* add audience parameter ([307bdf5](https://github.com/googleapis/python-appengine-admin/commit/307bdf56fccbb04229dd4fae1ae6d425e2c51bcc)) - - -### Bug Fixes - -* **deps:** require google-api-core>=1.32.0,>=2.8.0 ([#175](https://github.com/googleapis/python-appengine-admin/issues/175)) ([307bdf5](https://github.com/googleapis/python-appengine-admin/commit/307bdf56fccbb04229dd4fae1ae6d425e2c51bcc)) -* require python 3.7+ ([#177](https://github.com/googleapis/python-appengine-admin/issues/177)) ([a3d18cc](https://github.com/googleapis/python-appengine-admin/commit/a3d18cca4a42a6290d582c2ea2b7bb50189a65ac)) - -## [1.4.1](https://github.com/googleapis/python-appengine-admin/compare/v1.4.0...v1.4.1) (2022-06-03) - - -### Bug Fixes - -* **deps:** require protobuf <4.0.0dev ([#167](https://github.com/googleapis/python-appengine-admin/issues/167)) ([d18523f](https://github.com/googleapis/python-appengine-admin/commit/d18523f1e900cd3d59ab5919629680f1023cb5da)) - - -### Documentation - -* fix changelog header to consistent size ([#168](https://github.com/googleapis/python-appengine-admin/issues/168)) ([32eb983](https://github.com/googleapis/python-appengine-admin/commit/32eb9839a119be5c9189140e02dd8e2c2798cbf3)) - -## [1.4.0](https://github.com/googleapis/python-appengine-admin/compare/v1.3.3...v1.4.0) (2022-05-05) - - -### Features - -* add Application.service_account ([#134](https://github.com/googleapis/python-appengine-admin/issues/134)) ([595a87c](https://github.com/googleapis/python-appengine-admin/commit/595a87cd561cf26da72599adc6750fdf20a2f1b5)) -* add client library method signature to retrieve Application by name ([595a87c](https://github.com/googleapis/python-appengine-admin/commit/595a87cd561cf26da72599adc6750fdf20a2f1b5)) -* add Service.labels ([595a87c](https://github.com/googleapis/python-appengine-admin/commit/595a87cd561cf26da72599adc6750fdf20a2f1b5)) -* add Version.app_engine_apis ([595a87c](https://github.com/googleapis/python-appengine-admin/commit/595a87cd561cf26da72599adc6750fdf20a2f1b5)) -* add VpcAccessConnector.egress_setting ([595a87c](https://github.com/googleapis/python-appengine-admin/commit/595a87cd561cf26da72599adc6750fdf20a2f1b5)) - -## [1.3.3](https://github.com/googleapis/python-appengine-admin/compare/v1.3.2...v1.3.3) (2022-04-14) - - -### Documentation - -* fix type in docstring for map fields ([b0ce988](https://github.com/googleapis/python-appengine-admin/commit/b0ce988cf7ec3620d6d586abab8b13de50e8b586)) - -## [1.3.2](https://github.com/googleapis/python-appengine-admin/compare/v1.3.1...v1.3.2) (2022-03-05) - - -### Bug Fixes - -* **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#115](https://github.com/googleapis/python-appengine-admin/issues/115)) ([a4b3624](https://github.com/googleapis/python-appengine-admin/commit/a4b36244e2e566770f3cca84aac9bb003ca47f56)) - -## [1.3.1](https://github.com/googleapis/python-appengine-admin/compare/v1.3.0...v1.3.1) (2022-02-11) - - -### Bug Fixes - -* resolve DuplicateCredentialArgs error when using credentials_file ([a6ec7ac](https://github.com/googleapis/python-appengine-admin/commit/a6ec7acb2f7b0a8acb68bd7de770c299eb9ee8d2)) - - -### Documentation - -* add autogenerated code snippets ([5f989b9](https://github.com/googleapis/python-appengine-admin/commit/5f989b948c03c409466b76f8c5853819261b9737)) - -## [1.3.0](https://github.com/googleapis/python-appengine-admin/compare/v1.2.1...v1.3.0) (2022-01-25) - - -### Features - -* add api key support ([#100](https://github.com/googleapis/python-appengine-admin/issues/100)) ([67f3bb4](https://github.com/googleapis/python-appengine-admin/commit/67f3bb4c0fa31f795c6aef4bd19b9a5fe9da0360)) - -## [1.2.1](https://www.github.com/googleapis/python-appengine-admin/compare/v1.2.0...v1.2.1) (2021-11-01) - - -### Bug Fixes - -* **deps:** drop packaging dependency ([fd7fdd7](https://www.github.com/googleapis/python-appengine-admin/commit/fd7fdd7f7ef666f1c9ff64ac27f98b4573a5d1f3)) -* **deps:** require google-api-core >= 1.28.0 ([fd7fdd7](https://www.github.com/googleapis/python-appengine-admin/commit/fd7fdd7f7ef666f1c9ff64ac27f98b4573a5d1f3)) - - -### Documentation - -* list oneofs in docstring ([fd7fdd7](https://www.github.com/googleapis/python-appengine-admin/commit/fd7fdd7f7ef666f1c9ff64ac27f98b4573a5d1f3)) - -## [1.2.0](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.5...v1.2.0) (2021-10-11) - - -### Features - -* add context manager support in client ([#75](https://www.github.com/googleapis/python-appengine-admin/issues/75)) ([e5d86ee](https://www.github.com/googleapis/python-appengine-admin/commit/e5d86eef07ee05454135b5b392a6841f7932a303)) -* add trove classifier for python 3.10 ([#78](https://www.github.com/googleapis/python-appengine-admin/issues/78)) ([e915580](https://www.github.com/googleapis/python-appengine-admin/commit/e915580dd5e66a4d44cede94acfde0e181e9fe3a)) - -## [1.1.5](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.4...v1.1.5) (2021-09-30) - - -### Bug Fixes - -* improper types in pagers generation ([a29e420](https://www.github.com/googleapis/python-appengine-admin/commit/a29e4200c6fdb7cad045bfd29e74a35c9a6e6fd6)) - -## [1.1.4](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.3...v1.1.4) (2021-09-24) - - -### Bug Fixes - -* add 'dict' annotation type to 'request' ([89b4378](https://www.github.com/googleapis/python-appengine-admin/commit/89b4378632af08a11c3bd45d88eb0f0ac152238f)) - -## [1.1.3](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.2...v1.1.3) (2021-07-27) - - -### Bug Fixes - -* enable self signed jwt for grpc ([#53](https://www.github.com/googleapis/python-appengine-admin/issues/53)) ([8b6c798](https://www.github.com/googleapis/python-appengine-admin/commit/8b6c79806ea6c052d27434da1d6b997d27a83156)) - - -### Documentation - -* add Samples section to CONTRIBUTING.rst ([#49](https://www.github.com/googleapis/python-appengine-admin/issues/49)) ([6b59802](https://www.github.com/googleapis/python-appengine-admin/commit/6b59802d54d044575520711416baa85b0a636bea)) - - -### Miscellaneous Chores - -* release as 1.1.3 ([#54](https://www.github.com/googleapis/python-appengine-admin/issues/54)) ([aeeefd1](https://www.github.com/googleapis/python-appengine-admin/commit/aeeefd10f953ec09ddc8e3bde38f0d90bdab47f8)) - -## [1.1.2](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.1...v1.1.2) (2021-07-21) - - -### Bug Fixes - -* **deps:** pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions ([#48](https://www.github.com/googleapis/python-appengine-admin/issues/48)) ([c9fac07](https://www.github.com/googleapis/python-appengine-admin/commit/c9fac071151957e69fd83cb9aefb027c6551a55c)) - -## [1.1.1](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.0...v1.1.1) (2021-06-30) - - -### Bug Fixes - -* disable always_use_jwt_access ([d8d2f5f](https://www.github.com/googleapis/python-appengine-admin/commit/d8d2f5f9e6c986387fd0d811e4be06a68a83aa8e)) -* disable always_use_jwt_access ([#44](https://www.github.com/googleapis/python-appengine-admin/issues/44)) ([d8d2f5f](https://www.github.com/googleapis/python-appengine-admin/commit/d8d2f5f9e6c986387fd0d811e4be06a68a83aa8e)) - -## [1.1.0](https://www.github.com/googleapis/python-appengine-admin/compare/v1.0.2...v1.1.0) (2021-06-23) - - -### Features - -* add always_use_jwt_access ([#40](https://www.github.com/googleapis/python-appengine-admin/issues/40)) ([f260f90](https://www.github.com/googleapis/python-appengine-admin/commit/f260f90985b5f05f11258b86af1b1ead652a882d)) - - -### Documentation - -* omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://www.github.com/googleapis/python-appengine-admin/issues/1127)) ([#35](https://www.github.com/googleapis/python-appengine-admin/issues/35)) ([34b578c](https://www.github.com/googleapis/python-appengine-admin/commit/34b578c920e8fba4cca1eb0532d357552056d12f)), closes [#1126](https://www.github.com/googleapis/python-appengine-admin/issues/1126) - -## [1.0.2](https://www.github.com/googleapis/python-appengine-admin/compare/v1.0.1...v1.0.2) (2021-06-16) - - -### Bug Fixes - -* fix typo in setup.py ([#32](https://www.github.com/googleapis/python-appengine-admin/issues/32)) ([1a749ef](https://www.github.com/googleapis/python-appengine-admin/commit/1a749effe4873c759a1630c0d836bafa193856c6)) - -## [1.0.1](https://www.github.com/googleapis/python-appengine-admin/compare/v1.0.0...v1.0.1) (2021-06-16) - - -### Bug Fixes - -* exclude docs and tests from package ([#30](https://www.github.com/googleapis/python-appengine-admin/issues/30)) ([16ad4ac](https://www.github.com/googleapis/python-appengine-admin/commit/16ad4acea57a44126d0d954962a15a455dfbdbf0)) - -## [1.0.0](https://www.github.com/googleapis/python-appengine-admin/compare/v0.2.0...v1.0.0) (2021-06-02) - - -### Features - -* bump release level to production/stable ([#23](https://www.github.com/googleapis/python-appengine-admin/issues/23)) ([4cb1678](https://www.github.com/googleapis/python-appengine-admin/commit/4cb167891b8d926389dd9561de8ea7b5314906c4)) - - -### Miscellaneous Chores - -* release as 1.0.0 ([#28](https://www.github.com/googleapis/python-appengine-admin/issues/28)) ([de071b0](https://www.github.com/googleapis/python-appengine-admin/commit/de071b09a7ec19637452856e1bbdb522e5f1d050)) - -## [0.2.0](https://www.github.com/googleapis/python-appengine-admin/compare/v0.1.0...v0.2.0) (2021-05-28) - - -### Features - -* support self-signed JWT flow for service accounts ([c798db2](https://www.github.com/googleapis/python-appengine-admin/commit/c798db287a2e85551e512e66d4bc1da344a806d2)) - - -### Bug Fixes - -* add async client to %name_%version/init.py ([c798db2](https://www.github.com/googleapis/python-appengine-admin/commit/c798db287a2e85551e512e66d4bc1da344a806d2)) -* **deps:** add packaging requirement ([#20](https://www.github.com/googleapis/python-appengine-admin/issues/20)) ([f352b81](https://www.github.com/googleapis/python-appengine-admin/commit/f352b811c13dd4b5b9fecf719dad05ce292e61fa)) - -## 0.1.0 (2021-04-05) - - -### Features - -* generate v1 ([1a14a9c](https://www.github.com/googleapis/python-appengine-admin/commit/1a14a9c4dba69fae84586b59da27762b5f39e58b)) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 039f436..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,95 +0,0 @@ - -# Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of -experience, education, socio-economic status, nationality, personal appearance, -race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, or to ban temporarily or permanently any -contributor for other behaviors that they deem inappropriate, threatening, -offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -This Code of Conduct also applies outside the project spaces when the Project -Steward has a reasonable belief that an individual's behavior may have a -negative impact on the project or its community. - -## Conflict Resolution - -We do not believe that all conflict is bad; healthy debate and disagreement -often yield positive results. However, it is never okay to be disrespectful or -to engage in behavior that violates the project’s code of conduct. - -If you see someone violating the code of conduct, you are encouraged to address -the behavior directly with those involved. Many issues can be resolved quickly -and easily, and this gives people more control over the outcome of their -dispute. If you are unable to resolve the matter for any reason, or if the -behavior is threatening or harassing, report it. We are dedicated to providing -an environment where participants feel welcome and safe. - - -Reports should be directed to *googleapis-stewards@google.com*, the -Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to -receive and address reported violations of the code of conduct. They will then -work with a committee consisting of representatives from the Open Source -Programs Office and the Google Open Source Strategy team. If for any reason you -are uncomfortable reaching out to the Project Steward, please email -opensource@google.com. - -We will investigate every complaint, but you may not receive a direct response. -We will use our discretion in determining when and how to follow up on reported -incidents, which may range from not taking action to permanent expulsion from -the project and project-sponsored spaces. We will notify the accused of the -report and provide them an opportunity to discuss it before any action is taken. -The identity of the reporter will be omitted from the details of the report -supplied to the accused. In potentially harmful situations, such as ongoing -harassment or threats to anyone's safety, we may take action without notice. - -## Attribution - -This Code of Conduct is adapted from the Contributor Covenant, version 1.4, -available at -https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index 72a5caa..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,281 +0,0 @@ -.. Generated by synthtool. DO NOT EDIT! -############ -Contributing -############ - -#. **Please sign one of the contributor license agreements below.** -#. Fork the repo, develop and test your code changes, add docs. -#. Make sure that your commit messages clearly describe the changes. -#. Send a pull request. (Please Read: `Faster Pull Request Reviews`_) - -.. _Faster Pull Request Reviews: https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md#best-practices-for-faster-reviews - -.. contents:: Here are some guidelines for hacking on the Google Cloud Client libraries. - -*************** -Adding Features -*************** - -In order to add a feature: - -- The feature must be documented in both the API and narrative - documentation. - -- The feature must work fully on the following CPython versions: - 3.7, 3.8, 3.9, 3.10 and 3.11 on both UNIX and Windows. - -- The feature must not add unnecessary dependencies (where - "unnecessary" is of course subjective, but new dependencies should - be discussed). - -**************************** -Using a Development Checkout -**************************** - -You'll have to create a development environment using a Git checkout: - -- While logged into your GitHub account, navigate to the - ``python-appengine-admin`` `repo`_ on GitHub. - -- Fork and clone the ``python-appengine-admin`` repository to your GitHub account by - clicking the "Fork" button. - -- Clone your fork of ``python-appengine-admin`` from your GitHub account to your local - computer, substituting your account username and specifying the destination - as ``hack-on-python-appengine-admin``. E.g.:: - - $ cd ${HOME} - $ git clone git@github.com:USERNAME/python-appengine-admin.git hack-on-python-appengine-admin - $ cd hack-on-python-appengine-admin - # Configure remotes such that you can pull changes from the googleapis/python-appengine-admin - # repository into your local repository. - $ git remote add upstream git@github.com:googleapis/python-appengine-admin.git - # fetch and merge changes from upstream into main - $ git fetch upstream - $ git merge upstream/main - -Now your local repo is set up such that you will push changes to your GitHub -repo, from which you can submit a pull request. - -To work on the codebase and run the tests, we recommend using ``nox``, -but you can also use a ``virtualenv`` of your own creation. - -.. _repo: https://github.com/googleapis/python-appengine-admin - -Using ``nox`` -============= - -We use `nox `__ to instrument our tests. - -- To test your changes, run unit tests with ``nox``:: - $ nox -s unit - -- To run a single unit test:: - - $ nox -s unit-3.11 -- -k - - - .. note:: - - The unit tests and system tests are described in the - ``noxfile.py`` files in each directory. - -.. nox: https://pypi.org/project/nox/ - -***************************************** -I'm getting weird errors... Can you help? -***************************************** - -If the error mentions ``Python.h`` not being found, -install ``python-dev`` and try again. -On Debian/Ubuntu:: - - $ sudo apt-get install python-dev - -************ -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 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:: - - $ nox -s lint - -- In order to make ``nox -s lint`` run faster, you can set some environment - variables:: - - export GOOGLE_CLOUD_TESTING_REMOTE="upstream" - export GOOGLE_CLOUD_TESTING_BRANCH="main" - - By doing this, you are specifying the location of the most up-to-date - version of ``python-appengine-admin``. The - remote name ``upstream`` should point to the official ``googleapis`` - checkout and the branch should be the default branch on that remote (``main``). - -- This repository contains configuration for the - `pre-commit `__ tool, which automates checking - our linters during a commit. If you have it installed on your ``$PATH``, - you can enable enforcing those checks via: - -.. code-block:: bash - - $ pre-commit install - pre-commit installed at .git/hooks/pre-commit - -Exceptions to PEP8: - -- Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for - "Function-Under-Test"), which is PEP8-incompliant, but more readable. - Some also use a local variable, ``MUT`` (short for "Module-Under-Test"). - -******************** -Running System Tests -******************** - -- To run system tests, you can execute:: - - # Run all system tests - $ nox -s system - - # Run a single system test - $ nox -s system-3.8 -- -k - - - .. note:: - - System tests are only configured to run under 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 - auth settings and change some configuration in your project to - run all the tests. - -- System tests will be run against an actual project. You should use local credentials from gcloud when possible. See `Best practices for application authentication `__. Some tests require a service account. For those tests see `Authenticating as a service account `__. - -************* -Test Coverage -************* - -- The codebase *must* have 100% test statement coverage after each commit. - You can test coverage via ``nox -s cover``. - -****************************************************** -Documentation Coverage and Building HTML Documentation -****************************************************** - -If you fix a bug, and the bug requires an API or behavior modification, all -documentation in this package which references that API or behavior must be -changed to reflect the bug fix, ideally in the same commit that fixes the bug -or adds the feature. - -Build the docs via: - - $ nox -s docs - -************************* -Samples and code snippets -************************* - -Code samples and snippets live in the `samples/` catalogue. Feel free to -provide more examples, but make sure to write tests for those examples. -Each folder containing example code requires its own `noxfile.py` script -which automates testing. If you decide to create a new folder, you can -base it on the `samples/snippets` folder (providing `noxfile.py` and -the requirements files). - -The tests will run against a real Google Cloud Project, so you should -configure them just like the System Tests. - -- To run sample tests, you can execute:: - - # Run all tests in a folder - $ cd samples/snippets - $ nox -s py-3.8 - - # Run a single sample test - $ cd samples/snippets - $ nox -s py-3.8 -- -k - -******************************************** -Note About ``README`` as it pertains to PyPI -******************************************** - -The `description on PyPI`_ for the project comes directly from the -``README``. Due to the reStructuredText (``rst``) parser used by -PyPI, relative links which will work on GitHub (e.g. ``CONTRIBUTING.rst`` -instead of -``https://github.com/googleapis/python-appengine-admin/blob/main/CONTRIBUTING.rst``) -may cause problems creating links or rendering the description. - -.. _description on PyPI: https://pypi.org/project/google-cloud-appengine-admin - - -************************* -Supported Python Versions -************************* - -We support: - -- `Python 3.7`_ -- `Python 3.8`_ -- `Python 3.9`_ -- `Python 3.10`_ -- `Python 3.11`_ - -.. _Python 3.7: https://docs.python.org/3.7/ -.. _Python 3.8: https://docs.python.org/3.8/ -.. _Python 3.9: https://docs.python.org/3.9/ -.. _Python 3.10: https://docs.python.org/3.10/ -.. _Python 3.11: https://docs.python.org/3.11/ - - -Supported versions can be found in our ``noxfile.py`` `config`_. - -.. _config: https://github.com/googleapis/python-appengine-admin/blob/main/noxfile.py - - -We also explicitly decided to support Python 3 beginning with version 3.7. -Reasons for this include: - -- Encouraging use of newest versions of Python 3 -- Taking the lead of `prominent`_ open-source `projects`_ -- `Unicode literal support`_ which allows for a cleaner codebase that - works in both Python 2 and Python 3 - -.. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django -.. _projects: http://flask.pocoo.org/docs/0.10/python3/ -.. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/ - -********** -Versioning -********** - -This library follows `Semantic Versioning`_. - -.. _Semantic Versioning: http://semver.org/ - -Some packages are currently in major version zero (``0.y.z``), which means that -anything may change at any time and the public API should not be considered -stable. - -****************************** -Contributor License Agreements -****************************** - -Before we can accept your pull requests you'll need to sign a Contributor -License Agreement (CLA): - -- **If you are an individual writing original source code** and **you own the - intellectual property**, then you'll need to sign an - `individual CLA `__. -- **If you work for a company that wants to allow you to contribute your work**, - then you'll need to sign a - `corporate CLA `__. - -You can sign these electronically (just scroll to the bottom). After that, -we'll be able to accept your pull requests. diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index e0a6670..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2023 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! -include README.rst LICENSE -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 diff --git a/README.rst b/README.rst index 2673cff..6eaf526 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,8 @@ +:**NOTE**: **This github repository is archived. The repository contents and history have moved to** `google-cloud-python`_. + +.. _google-cloud-python: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-appengine-admin + + Python Client for App Engine Admin API ====================================== diff --git a/docs/README.rst b/docs/README.rst deleted file mode 100644 index f3166e3..0000000 --- a/docs/README.rst +++ /dev/null @@ -1,82 +0,0 @@ -Python Client for App Engine Admin -================================== - -|beta| |pypi| |versions| - -`App Engine Admin`_ allows you to manage your App Engine applications. - -- `Client Library Documentation`_ -- `Product Documentation`_ - -.. |beta| image:: https://img.shields.io/badge/support-beta-orange.svg - :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#beta-support -.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-appengine-admin.svg - :target: https://pypi.org/project/google-cloud-appengine-admin/ -.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-appengine-admin.svg - :target: https://pypi.org/project/google-cloud-appengine-admin/ -.. _App Engine Admin: https://cloud.google.com/appengine/docs/admin-api/ -.. _Client Library Documentation: https://googleapis.dev/python/appengine/latest -.. _Product Documentation: https://cloud.google.com/appengine/docs/admin-api/ - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. `Enable the App Engine Admin.`_ -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Enable the App Engine Admin.: https://cloud.google.com/appengine/docs/admin-api/ -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - pip install virtualenv - virtualenv - source /bin/activate - /bin/pip install google-cloud-appengine-admin - - -Windows -^^^^^^^ - -.. code-block:: console - - pip install virtualenv - virtualenv - \Scripts\activate - \Scripts\pip.exe install google-cloud-appengine-admin - -Next Steps -~~~~~~~~~~ - -- Read the `Client Library Documentation`_ for App Engine Admin - to see other available methods on the client. -- Read the `App Engine Admin Product documentation`_ to learn - more about the product and see How-to Guides. -- View this `README`_ to see the full list of Cloud - APIs that we cover. - -.. _App Engine Admin Product documentation: https://cloud.google.com/appengine/docs/admin-api/ -.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst diff --git a/docs/_static/custom.css b/docs/_static/custom.css deleted file mode 100644 index b0a2954..0000000 --- a/docs/_static/custom.css +++ /dev/null @@ -1,20 +0,0 @@ -div#python2-eol { - border-color: red; - border-width: medium; -} - -/* Ensure minimum width for 'Parameters' / 'Returns' column */ -dl.field-list > dt { - min-width: 100px -} - -/* Insert space between methods for readability */ -dl.method { - padding-top: 10px; - padding-bottom: 10px -} - -/* Insert empty space between classes */ -dl.class { - padding-bottom: 50px -} diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html deleted file mode 100644 index 6316a53..0000000 --- a/docs/_templates/layout.html +++ /dev/null @@ -1,50 +0,0 @@ - -{% extends "!layout.html" %} -{%- block content %} -{%- if theme_fixed_sidebar|lower == 'true' %} -

- {{ sidebar() }} - {%- block document %} -
- {%- if render_sidebar %} -
- {%- endif %} - - {%- block relbar_top %} - {%- if theme_show_relbar_top|tobool %} -
-   - {{- rellink_markup () }} -
- {%- endif %} - {% endblock %} - -
-
- As of January 1, 2020 this library no longer supports Python 2 on the latest released version. - Library versions released prior to that date will continue to be available. For more information please - visit Python 2 support on Google Cloud. -
- {% block body %} {% endblock %} -
- - {%- block relbar_bottom %} - {%- if theme_show_relbar_bottom|tobool %} -
-   - {{- rellink_markup () }} -
- {%- endif %} - {% endblock %} - - {%- if render_sidebar %} -
- {%- endif %} -
- {%- endblock %} -
-
-{%- else %} -{{ super() }} -{%- endif %} -{%- endblock %} diff --git a/docs/appengine_admin_v1/applications.rst b/docs/appengine_admin_v1/applications.rst deleted file mode 100644 index 8afb1c7..0000000 --- a/docs/appengine_admin_v1/applications.rst +++ /dev/null @@ -1,6 +0,0 @@ -Applications ------------------------------- - -.. automodule:: google.cloud.appengine_admin_v1.services.applications - :members: - :inherited-members: diff --git a/docs/appengine_admin_v1/authorized_certificates.rst b/docs/appengine_admin_v1/authorized_certificates.rst deleted file mode 100644 index 03ac310..0000000 --- a/docs/appengine_admin_v1/authorized_certificates.rst +++ /dev/null @@ -1,10 +0,0 @@ -AuthorizedCertificates ----------------------------------------- - -.. automodule:: google.cloud.appengine_admin_v1.services.authorized_certificates - :members: - :inherited-members: - -.. automodule:: google.cloud.appengine_admin_v1.services.authorized_certificates.pagers - :members: - :inherited-members: diff --git a/docs/appengine_admin_v1/authorized_domains.rst b/docs/appengine_admin_v1/authorized_domains.rst deleted file mode 100644 index d02102a..0000000 --- a/docs/appengine_admin_v1/authorized_domains.rst +++ /dev/null @@ -1,10 +0,0 @@ -AuthorizedDomains ------------------------------------ - -.. automodule:: google.cloud.appengine_admin_v1.services.authorized_domains - :members: - :inherited-members: - -.. automodule:: google.cloud.appengine_admin_v1.services.authorized_domains.pagers - :members: - :inherited-members: diff --git a/docs/appengine_admin_v1/domain_mappings.rst b/docs/appengine_admin_v1/domain_mappings.rst deleted file mode 100644 index 89af15b..0000000 --- a/docs/appengine_admin_v1/domain_mappings.rst +++ /dev/null @@ -1,10 +0,0 @@ -DomainMappings --------------------------------- - -.. automodule:: google.cloud.appengine_admin_v1.services.domain_mappings - :members: - :inherited-members: - -.. automodule:: google.cloud.appengine_admin_v1.services.domain_mappings.pagers - :members: - :inherited-members: diff --git a/docs/appengine_admin_v1/firewall.rst b/docs/appengine_admin_v1/firewall.rst deleted file mode 100644 index ce343d1..0000000 --- a/docs/appengine_admin_v1/firewall.rst +++ /dev/null @@ -1,10 +0,0 @@ -Firewall --------------------------- - -.. automodule:: google.cloud.appengine_admin_v1.services.firewall - :members: - :inherited-members: - -.. automodule:: google.cloud.appengine_admin_v1.services.firewall.pagers - :members: - :inherited-members: diff --git a/docs/appengine_admin_v1/instances.rst b/docs/appengine_admin_v1/instances.rst deleted file mode 100644 index 57f5079..0000000 --- a/docs/appengine_admin_v1/instances.rst +++ /dev/null @@ -1,10 +0,0 @@ -Instances ---------------------------- - -.. automodule:: google.cloud.appengine_admin_v1.services.instances - :members: - :inherited-members: - -.. automodule:: google.cloud.appengine_admin_v1.services.instances.pagers - :members: - :inherited-members: diff --git a/docs/appengine_admin_v1/services.rst b/docs/appengine_admin_v1/services.rst deleted file mode 100644 index 2857661..0000000 --- a/docs/appengine_admin_v1/services.rst +++ /dev/null @@ -1,11 +0,0 @@ -Services ---------------------------- - -.. automodule:: google.cloud.appengine_admin_v1.services.services - :members: - :inherited-members: - - -.. automodule:: google.cloud.appengine_admin_v1.services.services.pagers - :members: - :inherited-members: diff --git a/docs/appengine_admin_v1/services_.rst b/docs/appengine_admin_v1/services_.rst deleted file mode 100644 index ebe1b56..0000000 --- a/docs/appengine_admin_v1/services_.rst +++ /dev/null @@ -1,13 +0,0 @@ -Services for Google Cloud Appengine Admin v1 API -================================================ -.. toctree:: - :maxdepth: 2 - - applications - authorized_certificates - authorized_domains - domain_mappings - firewall - instances - services - versions diff --git a/docs/appengine_admin_v1/types_.rst b/docs/appengine_admin_v1/types_.rst deleted file mode 100644 index 51f718b..0000000 --- a/docs/appengine_admin_v1/types_.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Appengine Admin v1 API -============================================= - -.. automodule:: google.cloud.appengine_admin_v1.types - :members: - :show-inheritance: diff --git a/docs/appengine_admin_v1/versions.rst b/docs/appengine_admin_v1/versions.rst deleted file mode 100644 index 58a0f63..0000000 --- a/docs/appengine_admin_v1/versions.rst +++ /dev/null @@ -1,10 +0,0 @@ -Versions --------------------------- - -.. automodule:: google.cloud.appengine_admin_v1.services.versions - :members: - :inherited-members: - -.. automodule:: google.cloud.appengine_admin_v1.services.versions.pagers - :members: - :inherited-members: diff --git a/docs/changelog.md b/docs/changelog.md deleted file mode 120000 index 04c99a5..0000000 --- a/docs/changelog.md +++ /dev/null @@ -1 +0,0 @@ -../CHANGELOG.md \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 692d6b2..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,384 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# google-cloud-appengine-admin documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import os -import shlex -import sys - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -# For plugins that can not read conf.py. -# See also: https://github.com/docascode/sphinx-docfx-yaml/issues/85 -sys.path.insert(0, os.path.abspath(".")) - -__version__ = "" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "1.5.5" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.doctest", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", - "recommonmark", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_options = {"members": True} -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = "google-cloud-appengine-admin" -copyright = "2019, Google" -author = "Google APIs" - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = [ - "_build", - "**/.nox/**/*", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/README.rst", -] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Client Libraries for google-cloud-appengine-admin", - "github_user": "googleapis", - "github_repo": "python-appengine-admin", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-appengine-admin-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - #'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - #'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - #'preamble': '', - # Latex figure (float) alignment - #'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-appengine-admin.tex", - "google-cloud-appengine-admin Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-appengine-admin", - "google-cloud-appengine-admin Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-appengine-admin", - "google-cloud-appengine-admin Documentation", - author, - "google-cloud-appengine-admin", - "google-cloud-appengine-admin Library", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("https://python.readthedocs.org/en/latest/", None), - "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ( - "https://googleapis.dev/python/google-api-core/latest/", - None, - ), - "grpc": ("https://grpc.github.io/grpc/python/", None), - "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 3b7d117..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,23 +0,0 @@ -.. include:: README.rst - -.. include:: multiprocessing.rst - - -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - appengine_admin_v1/services_ - appengine_admin_v1/types_ - - -Changelog ---------- - -For a list of all ``google-cloud-appengine-admin`` releases: - -.. toctree:: - :maxdepth: 2 - - changelog diff --git a/docs/multiprocessing.rst b/docs/multiprocessing.rst deleted file mode 100644 index 536d17b..0000000 --- a/docs/multiprocessing.rst +++ /dev/null @@ -1,7 +0,0 @@ -.. note:: - - Because this client uses :mod:`grpc` library, it is safe to - share instances across threads. In multiprocessing scenarios, the best - practice is to create client instances *after* the invocation of - :func:`os.fork` by :class:`multiprocessing.pool.Pool` or - :class:`multiprocessing.Process`. diff --git a/google-cloud-appengine-v1-py.tar.gz b/google-cloud-appengine-v1-py.tar.gz deleted file mode 100644 index f412a6c0e600dc61ee6a1422e7a19c87bd120fa0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 49152 zcmZ_VV{m3o*f#3ewr$(CJ+U>hCbn%&Y}?7iwr$<9lRM`3yzj1!KfC{}>aJRKRabS_ zI1O- zz#};%Ae~GN<#PcALQdO_{7HWXi@)W+g}m<%|6_dpKi8&>m*v9ziX=md<6&!`LEXeFcC#O8BGt`F;Z0YefJT5 zJ?k}pcX{fs1@IsoyMxI)-6)&ATs0Dm+4Kjhh)^p>7N8~so# z_k`plcRLHf{$8WrCF|mQCEV-(_G65>`tJpL0ONKh`>%4|;2QSxqFYvP-!u2iC_ge3f&(tlfEbPnU=i}`Eyx{XP;PZBKT@8!@dN>}e z+1@^0|9JlReLw%2g9p)=SG;q}+kZ7lBn@WGAek0|3gQT?&OoBcg$CTw5e#)(uEGEC z-PHlMNHPapyS)+>hA^<%!wwV+(r9wRGxL+UOJzm5m2dDHv&YVzkAK#_1qkXZAeYmB z`W^iR9gcpO^1Ltev2os0ta_C4QoGP`6k{RZ?Mz~5GKD}P>A z1|0VIL92XxY(!Ao37nQ(=_C(NM70q-lRi&SyXQ`iDa)L`Y7rX~QXFt(SojZ5eV8c7 z#{y{JMpJp;i&=mC^B`eO(QL!#wF2^nbp&+v@5O#(02?U#oRAz?hWC93Pl!MG{m?80 zwMmxm>cX;)pB4EGAW0wS#JxawBSy3)U*diBxvs!MaN?ZV`|?Ie!xtt|-o%m?l4R&f z*zYIt#95QFpmX}S9pEnY00E5opy7Dwhe$lej&^IpV>^3ANia!gIDiM%bAWYzkO6=6 zPZPyz5r!hoVL6dME>?XFXFb*i8ElPYqyi+a4Ku_UXE$sS*gg_ugb-O@t0%%S3{*#2 z5hGcY`IMK_Vc1%8hpD&MPK!-^Ka4}T4u}GriU!j^kly~khz*ddjF03^IBVZ3p6XRA z*y-_{cih@&!kwPL`{Ov_Y)Dj6pGq>-kar74=sVVbkSFQSl8V%)9E1FWZiZ+OTTWB> zwjA=GI?(~84si#;r)j|3>XqXVokI6`CA<447=n@JOLJCo)9Tm=;6kGYpOgac2_)`v z__rqkGloj_wB_I{HJ5cMTXiLx_FCse^C1pH3YOVM zVoCCV&(fvRWH#8qJ~{9}tU+<862JEmANM~PpN%lT-WS74m&)*ypEU}7#{x)3#ZSTt@aqep_d zG2BqUp!?Z%0=-W|@Lb(6DIyP*(}YwF#sdms$@wP8GRH`$-XZu(wvH3sc#cZ>Tc~k` zYO8r})Iq?>35 zCVD(WXdNMn95q%ZE;94bw`nLt`d2tMoK*u{14B(4iJCy-mR7a-HK}_od&=h--MQW3 z+Av%c>2D(2L190`?9`$qxh0XQ^LMPfp19wl*hyGF+C8|ap9YRBG((;}ZKd4VHzEc) zi@oj}tGC4hNr)a4r10k=-ryQf`5HZvagXxE9Mb!O4Yu!E^VZI@IHGes`W=YBRlwHw zezR35dGQF=hta85Z_)onDdC})ddg>6#hQ~J^rs&}`@0hiA4%ppJ{k>XS`nFT!qXMa zzi2Mt#T9E^u$lrUIsvEhgF(`kGaB<~ao@B=$vJ)l*Uk*mVduM)ApH~gB_oY1VpOpX z+#F?X>!Jy&|8&Lz3gT@eeuVAR)^Y(AK0^7{axSw*&;%Dk)` z@Pl0=$S?~k^ULvdbjvV+09A4OaNv6Vo-^vw#RnRfYd#b&wZD(Q(jj@x@B<9ud$&d0rmy_Sq zgOk_i_oY;4w`)ar3=;M^0^yBUP2wzR@TfdNyPB`qExg!J2L83*P`!kzc>UnW)J$JqT8<ru82#UU5w<+3{4=1er7xM6 z1a;s~pN!R^W;E}QHzHzyYp2Z0%(EyQ+2C^jzOoYE_@8?Pohl$mZRXuD&d^L+51p~* zu+MkTX1x(NMs7TiJDXFW8W|z^j5__6idu2(Hh)%jzK?s_I;>N=sH=sj5v7DVVs|4L zO(=DvwnpOCEqr)HP+dsMxPDiM1+Zt_YudN93271lF^Rk!eCAJ-G#h#9K_S(B-av?3 zX+MP5wl5i*aF*G-By)KG?jSX~3Wj*jEumOBP*T^`9qAGzx&4bA@>knm1mHVjY`?af z`C%2&Qu~zI8v(o9owNiVtDHPwWPFtw0?eibcNAAi!B>{*jl`y`9Sr z)F(yLLx^f0hL94BP%SeQFtgV}{sWxsw2YHT+ff~&2{AEtZf2r*`o_V&u*Fv^4m8J; zIaH-IlX}p;AIMfRTPH*00pBaI z9tGQ!wr}M1ds4IblMsRIkgQ5;@3whpQ9Vc+z75}Tzobt|15ocejoOa)2BbyxC`H`l zZs7QOA-vY~Q@l09oi43<{BA4BO84SJlC$)yj+-8hYE|r%6aB6+v(fr+wLJ1VO+zqH zUmRV30}SrJnOQutWpMT1y#dBw)4sK^K|U+VVIKJ0gZhb6jOR(X=r*dl?@~mX9)z); zcXcy++A-qgzcQyjE0AXDwll9>mRhCm)ufEj%kQ zOH>gQWEy6h)FFMEFO{|!7=0<9xvZK%ISxG944lN=h&O|jcc2EeV7V&=0qITvmhB+m zN{_f|U&M|8%{@c#6`W@Yd=q8HuxPaZ!!T5zMP{pDb*z&8-sE7NB3YNdo`2ng2=*^C zo2~fF8Ip01t^V4BWy_3k$N@V#4l!h$cGuc#GHfS=@Oz(gpUYKC^P|zg%KX ze4giO$pw~$9Sqd&IFRJt>+%1nsDUzt9Ef(&ra9Evjbh3o;C9FoQ#9^e^F5`85IM{e zM})dp%p_|}*IoLN4b1je4Od@NnBG)zU%_b>E}F@AOUN<-*r`^XSg*Cvm+{Kwb!R7M zF6ObLNJTm9{SA^|x486-x6g87+34mcaVpSg2h3r&)%YRqG>(-Ik829TpcW&cc4os*h`Wr?!jQxe9(g(V~~#oSRPTMeE)E9`=) z?gvQTGayaAut11ECqxBe(&shTk_=pARBGp1w5y)~%DLz-F-X_UmC7zu=oQHM5tbF8 zAeZ-}d|evjh>mR_CVma5wj;n5YNEx4+;KToc%D~{GzwseBV5mNG=rf9Kx7us-iP9- zKzMLAy@yaaib7sQUc_x&&+;acZk~ioPXwWtk^^D$>b3l>zeqc9` zF#(3Rj@bmnK2 z`G?+{&ww$<(!>Fpno^`lxzR1yiM8^n8j{{*^|Qh-on-M*=?BFuO{{K-p8bH6SoE=L z86(9!6Rkm+g*|6bv}`NeFWYL^M}?}ib3Hvpsy}V!H>q{@>XeRbMBp=e_$Xz?rT)NJ zxGd_{Ctnf09%IlF%P8_QXa+VYd=&d`(OAK1r$AEFjnI9*W4-nxDn=&{6$TdZoit*p z$^gv$uuWRHL)Rph!3hzIgd)l%5ST9)1F|dVFEPY|QDm~I-;ExSRgPHGEYgH0=c4d% zAjXTp8`JrF_ZqE6oc<=YC#NTL@F{Hf;Bm*5*JS>K>13+8=@ezFQFij8yUjB+(3xM|zr^3t9v~v1U0CUm=7oUGIz)@sujqdF`m)P>7 z_<~#4zxbG2_nWEpGwrFWDI5Bj5=&7*t);;H^ zwUy_#nQ^*WR_kXU6Vom+(NjXVGVyHBBbA{9xqN{A^aO2(>~u6SmT{4EeB;!O1q7s(s41wjBo z*QPrsgYlkDzqcNhD6GG4*6olbrlo&BqCfu%C=t`j)lFg}{bQ85bQa(&LH(tNA&7BY z?TqzqjJpc4ow}u2CMm0-ka^&NNr@`*Acj_i`dAd#8hJ4BiQ~$Ks8aL@0~X{^y?}&I z63r}msEpoP{Y`f# zg=&RG4O{BJyZY2{qosP~KIq}v&v@gK6=o3Z)_$l}*msAJpL=pg%T3c)w)>C47iK22 zBcSP(Jl887`^*2>7$G@!2PZ2b{^Ry_4yiQp5NN{pQf{B^lZBg4T+mpbRnZ>c>(&}r z3in<=A)Fl4i*PZDY1L;Cv|8-L9(FxXIxYpnbP*3_z4iy54YA@L!KUQMvb1EYO&RZC zGPre<*PI#R+AOW{(uwU-v^(j`dhSqbJIFUn+2%?FtHiY#{H@T_)@y-y25C5U4%r*p zlJaj~u)oE5QRBZx!of%R78S!`ZN6SoVA zy7@*V_G<11v8HmB2ZFy~`kNo3t`e=Lbb1WvKB48wye@lW6WY(EUel9<-!r-F(VP43cjjKI9GZARescB zUE}Msd0oaUCQJwap_4AaL?$1I)fahaVaDj~z@`wwK`Ah7+l)lJ6-cbKMeVgG!7IPQ@B9@AcJiJ1`X@LW zcR zFUwTgCX81Et=?zN4|mq+5!rX&T~o0uO}`i}d#ro9>a5;HA@Q^mQ|@zl%o=o`JlA(X z)kVm5%`rzm5oTpn!G^@V9huc;YV!tIi}${fC>zp=PEJ9v)I+~lz34G)l`C_j&88~8 z*`#(IF33hFh4OA>I2A$&MexHQy)t1wwnWDUJMwuq4Sm~A?J_Ipv$xO5Go56#?E+(+ z%v1M|mQ0sR$Q{5k@_>#^rJ{gOiwE2)FbDK*5A(VM6q+w%%mSk@WP}<2k`fjnmm(-J zpAGgEb%kM-K>Z-{3Q|fSLCY;eJhc&1a`=^tcmG$?i=vvLt_HbduF5!F=B#cE#jx_y zG0KmcQ2gNpS}#_LO7Boc@^PZW3&L@43|cQmZfj?Z{$x>4YBUyp)=S4kw4n{G-7CY zF=0%U3`~`ht{yoajKz;|g*i348Vhs#&1|#)38t`BNWKyZsfSiP7*!?{*lVey+3|dY z4H{19E^YG=9d>u`#19xd=zu3)$iJreXc}x5VA!633 z_ctb|awaM5A``ya#@R`TG`W0XEA$dXS!oNFh=PgWRX|iN+R}Kk~?q2}pgYIaCynz?bxwA1{ku z7x8EABa+jzCMbH#Bx}UYsogVjAB-obmwTjZ`G3vxgAa155C_#Q?-SXKbj5o5qtZU# z&pnUNf8<+u_2tksC5T&g54#RS$841cQ)y_#F%D>bzdmaf;{vqRga+?6#}n@aO%&er zENzC7w=ZP+{Q9nBxs1skrpDBg2e7BCW{W5;nbH>sL@=qAoCyM8RY~(B9#e^Id_x9; z?6USL0zQr_A{sJBUN8S^$@BrOkK9c>1D5HxoM1H&ek)f^XfjmCYp~8mH>fLR8uxti z;s&sQt74IaR^YY}lCva4U=-tCEqh3^KVXAMiA7ZSIM#D2IDP_*{5dtt@_Er7B~sW{ zX^G=Ob0q$-g?wSoKY~5~vQ8vTP(CLEEBk$RfDTF&=NNqdw*_Pz3{T_>JPRqA)EiGZ zXsdrV_wUAX8rUpw+}mzBw~D0SODv&6Hw()S`P-dZ8bXBOV>wf$%Qd;fov z6K(Ow9%-K#$WsqnR}R@b_RU>>9bH?aMBS7=4Q}w-jBZ37g6mlP+l=0?33kX147zcW zwsQ=+X$x~iHIh^P-gq&ZW(%8TlGXp!-)M#Vu@NRYRRT4R#rVf~YP9I7fk8JNrIeRX zm?$P)hw3Ima*ASOwb80JxpaR)rzK19ZD>11FKykXb0b0U-OVZZ{mny^v2-$Y|cui(;_1I{ibMjo49X3KK)_^l}rEzVXCH+bdx>U>f9wGSMhZ z^{%)-7theTDZ}-ymeQ1I5Y&y$IkqCRrPmSX-6{emf+Xez{Q`mSEj~M>TAB1c{`*2E z?88^8LC`Xw&Aln~YLBsA1+>2xjEoFQwflx$z@}K7&^QQ+9oZjew3ZEp&&L=)Ur)M1 zoVcCIwkbv|7ORLop)Xs0PF-lUvTt}8sYN0@T>&c%qQN!E^4@iC)tC|;sd=z+70 zAl#BT)IbTq58#3?k_Hvv!)#m$v2F%(hsAnS;)~BA8)+xf{SDm(-~{YMgtW`>;X-@=o zT?DrL^Hi*>#9lq!wyKi?Z#cFwjsHuGmq?#NS+4o_h8kGXv12wV7jsbl$?w28?W5I_ zuK6g)h1tw|wiXP*!)fQ5BK%8vXqoxc8A@H#CR21{TM+f?D_&D#Ai?H(3p1zWi8_YZ zUb}Bn%64va#$cxU+U|$8bBz{amKHz}q+1z5dHZBu==jLdK6s$Xc5^C16k#BikuAM$C+OC>b%vL}^O@URl{89%DLGhsp z&y>jp5#h%A(4X9}^J@saRMKci33kgSiEKc2tic+6@OmCW>tZ{z7@tgLhv3UBt@Y1I zs-1ZHVm#A)@ifTJrh4D%0-U*R&K8as61 z5hSBK4DJsD;HPJ7|Y_sH} zi%=EPf7tz;T@0%;Xv>8XASHT2GtB{ncZDMQ{_KcDvznB_pUN=$2VO^0+iq?!n2OLsl2OC+E8|M@)S@>Mn-8Wk z@}w%SNu0D6=5Z+P2wFn2DtDZ$oTnBe0vL!WaRUY-*e8^Zmax{$ z{?03gP|#zU5asi5%QMpV7kh!PATuQ43`=vALF!sM=WFUwvrVf7 zIx1BKibiI-ZkS5?@$p0q_FUSxWHVcC>CUvO=C;9an_qYLI_eW1HiK1X_4C1s8y*@x zFfp7=nbAzv6o*ZgydB&Vr;E#cM>H6o=WC?i=s?8}mf-kid>p|4L{ljLpJ=K=e0%x1jam`b zWswb z6Yd#wC2PJ-*+p4+>gaVpo9!QkVnm5jhc92-OpLn?@$|qSCpr*@b`&vLuS_p2F$+X? zFx>m$nJqu9K*k8IVNfs=yjiG+Ksn44SlgUPu6px#-}6!xkuw%v6TR~)^*???G(y)>_g8_#vu-8g3mE*@5IAKRmt zgNagya;-6poKZxHw|B8i02yE9buk621Xv>_|A6N!oh|4g=uWQu_$u|+69Y{u|6IPo@>)FqS7J#^--(wvFO@zq3f^M>)4&o27)*ih@m`Vhph z>*b!DC!oT^Sz}%^W@}jp8^F4sITFVjZv_jFNxY$|s_xbC$+{d)Da~JAwMl6^GPbcb zRZaHh4(T*+v#QRZ;SNk8taPK@C?<-YOjsd?Vbk{wigPgUM{y3sS^QNGj64hTp4?KG zDIr>M2b*f8ijhx(#y`5Z0+Aj8DkxTUpw`1-yG>>l=1tNF8AHj|@}$uyf1e(QJa7Ll z`Bq=v*IuaKinGKyI!^`rz`8zkiN`EaWKa)eY~KM>E+M@!%83^I$DdQHMFeNKI%1@q z=AFdw@;uK<VNc(w|G0x#PPd+xh%!OQG;BJvjLH#y@^}j`ya_P``sxax4 zpLgs|Fz6Av{`gW9rw{1IC%7kG@D?wxr??2S#jSs+)$DcVmB^=3>M37`ED@|D{J#B! zXoIQ8IS1MOgk>JwXgv&d)FEHPk2*Bt>s|5UzmuMVRix7X=E?mdL$1CtQV=Hm!I?#~ zls?l@<|vH})_hs5EtfE2o8cnO=zAK6ViwpTxpWN!uF%Mgb=iWnkqcd71TvF}jO*8W z-Sd70O$>NLezOt)Uvxir`V2{UgMrCki4RK6x{(%rrHMF*-cn0*QL!{yz2KUtzuT6A zTn~f`?Cs;qG@|7A<;()vMm$SCU}?|8Mmqk=8fO?yCvF(EcYqQ9P=YQ*MiPCRh|E+up}#&WoEkC};cl!G1R~+)BnnQp+8zP_);KXV3JWTS48=Nn?}|4UUd$5B z5`r{m9C9$sD@C&>;J{V9MR!9MQm-?iuFE3$S*G!|d$BY=Nq9UY^0ou8>~(ItBllY; z*cwm!n>^Eia~IgkJP6KVo*Y$%MmN|UW4y&!3I%%rlbkxCjK_qnS1DYYA8;agQPT<$ z)Uc!f5@Cson7q#=v*?7;h(E{`sX0gZqXnyg*Og+_sPcSbLPTLqEE5`_hVP!xa> zDIS1)Cd@f6K>+dP^Q&ZDK{^4xg`_C(YT+gl(p0$1(6{k6ZB;<2?n~#D8IMXEBJC9v zo6oQe7o;*2#FSSA{Qh?k!r@lXYcZ5*sx)1%4yJ4@aIH96n*i0aEhCiNcps4M&7*$f zzLud*G$8jn)arridPQhD=9y%n>V#RwZ82>!0%E;x1likw4gTzi$dEKT|NLR-M&?)_}XX{M893>2s0JUB`qlAHXS-c&&DRN>Q%%`rL!I`c0@X5jX?!;FH z8RsIedf34*(AvjNac&+klp`c(L~+ezY_YSw9e)GUXTjF8pCv0W*jSUwEW=-qyVOs z18*zoeHr#6i>C%>SiAQ3)hHsEf`F@P_w%s8@Ig1^2fcUDM^U!N}v5$BSgG`lc;0U1yVc>J-c=2V}t+)xey6Yb6WW%iITV9c5EyIFi)M znDj}$v3~|DBRS?Ni8-*P6BTS~w=KVrj!1H5UHlOKc@$iuiAX4Sr*2TQH)=~Og!KUXbb)>`@Y78+fm}?gvY3SH3N$YH+^DvZw3oFn2 zH`~n%Kna(csr7;C=C$(tU44YP-CpmXo6l>>nI-A16$wAYF>o2xF?1`G5a|;$|F@IR ztLu@w&+AK%W2n!wS)(#>h1~CiE(FHb0(2Cz`BcoI+tjfozXx@ozE+OC{?-~pwh69K`_dy#4nAWVj_yG6I^M)2C_T=yY zM759CA^DGSE9ZGL1K!wR>mAu{UpMam+#(0l>}GQ_=L>|@I}SRth_Cqz8|ix z$C|-$SSlZ^u|Sn6bg0BJ9*axI;s>Q!Cdd1LEQ_yhX#MRBqxZX%CQyM_Ue><<$$_~p z*^J;SE?sl9hSxLWSyNDuzrsM>a^fCf0^@CcIq{tEb3vT&9P{_(PC5MT+!8Xe(w<>X zzTe}n-<@Hv&&S2*;pdLt>(eH`--qySKz^U!3J?qg(-qw}Y)3Gb7z&pR=l*6y{niXc z27KQOuuxCc0+M8gn~%v9`H0f1@*uLi^BHDgxB?-(hy5gS#10sA zh?+Q`sL@@;LWP{I3xiZ~!Zz4m);s@Sk~tjzF>i+Ig>oNZeqEHv9B`eI=urcsDlFTp zvQ9IN{^Na-@9DS)y8P|`d;p6-$4e`J*qm=QWkPJ4?`zr-;GN8`{=6WT5qg$!F5TTt zJlXAd4UO_5x&(K}peO*RY2i$R8;l!DOZ|$M7fXJ`5PT#Q)~rA)8;7VeinB z`M>$4XDQ?Hb+7Kc*%$I%<*7mcd=RqI>Fd%uSiSs=g{&O>g9_>={hWr)`()D_9c=pX zqMv2Kcy;4G`fNcmT+zFjKA*Oz4rD79qgr92U_lPyh;9nL=XF?U!Jk>kO2sK%eYrEH zzoGW3NYJcSMpfG#G%FYI4aSI{_CalTG2FyPYJX5??npFikiKSqLGPZ}KI^SpI8=

YuJ`$Pht5^ApEK!9AxF7{Jhk6j zO(Wx?olwCeAx(>sfL#&Rz`&$FA8j06iD4&PpQ|=kz5UK1p3bWiyAXwNVep@D-BK@A z#_)SXK3bFLWlHu!V5nCv5brcNk(TY|*y5eKvo;uM#A`)%)N|M6h0&ErTD-OF;us7( zsJ61EdV_gOq}Vg>H8mB0Y7vDnlFf5;bM?}xL~R6frdVB(6MexMF=|a)=e8B}Nod2e zB++?zneJaaZIz|H?@+Pi@q<5$ToWdGJMc%vR*8tD~^i>r%LE zHOlLU;!jEp=3we+4F6=+wlD1-^$ImbRiyiAVSDohRfP8e2{$@8X?^B4ZC2G1Ro zxE&U%UirKsNI;11Auzf;+Qfd74u5k(=BhHqO@uIZk+VmbS$hsjCg3&N-#N!dN$j_& zMdJIaz)bXXj>r~`j^VKy#+6WIsPHz@ysVlZvZpdj16I*X$~p;z_u?de`KH)+T3q&~ zYiN-Pc&{k^7ITn?rVB;T3373=lP4y`YwmmP%f^?a1yPMRvhWG)r-(x-|JjWU|gy+*+|z zDS@{gJJ!2v5pibg#XhB6A2+3We&#N}}Ex zx>n+W8lZmrZFVt127-h98Ro%od#J;22A6Q^)4V@hEhk(F)>TUiLHAtO+&F6B0qAYR zlji6tkCAeKxe?vat{40#2IP9|;gE;XScv}zU%)q~o|G_Xu85A<&00p29veC6dTvKx zP+T(JaD0d0PHl|2v*q&qlq{VZ!>u9M@szre=2v3#CLIN1_`Kun6y*}_V)7VVbqadC z|J9Oyno_-%G6I;ubQ?KBrJ!CVzTN%0Ke6+C|Mq=72W;FqVmk_*OcT&GXzHV*}p2TEyWHB3ao}zqcPvFn*3$F2ioytP_L<#ofk()p6hRqC z2XU4E+Q#0|sVD7Pzqk?ga9<>8D;2?KGu`dOsvR+2`mVouX1;CxHHlgK>cN5YHP7Nr z+!mTfVtfjt1AA1j%K-|tL;|Fl79ig9IT~-n* zkhbvup5uJ6iD7_xnzS3SoYiR;XV968+yQb7r|GpZd$L$wz+}ZxCnJLJT)mFsLvnxH z<52tEDxerjf_jTeIFVZ@%J&uuay)6;w#>7Pa5ORR-;{GG$VT=8p^h7--6+AUUrrT8 z>f$09A3h0FjFE~J1k=q=Du-CO>#b~8Wi;9eTSM4z>`bnzi=nP|SyYVF6Y(G^mPC>% zI0|FSedT*(ymd!OXBtZB9_=>IOc_?9mhqoga`jg0ZZas+ff8NDFXk3WP`#qf(U2_( zo0~5GC1H~%M99S36vb-jM=eiecrr;Ek zg{z%}?EO3}<*TeS%K-)EtL>ZPb~)NxCDj;5b9|OAt;)Zp@;nSD<~b?tV{?U>5b}gI zrI<717^1KdFS^Z9~F>dmlWK3QR*5KW7dYbW7_VJYCh%uH^>r>T&xdP<%2 zFPLj$JdTurmx~{AEjLo9oL1etxNJgc8iqe52>E#C-Kc1F^1VnUmpA%(dZQXw*V^OhC73UzNBj(UdU4JFwv!t-fIN#O<7^WY%a@f}&iXjk zTJ3~5Aj>IAY*3}BFuj1mt-Nxr%1D6s(|g+IaE5Y&z>_F0kqx9Z1~@ueP4ksT)b3U1 z5|=!@QB)6NmK})VE1@NJj>?XY`#!Ku^zPT7qRm{#e_1es$3B7Et;+JPIybVMfGtUu zaKgLD^0zEO$yuM$)sutM|77M_xQ zxV1LQblC$3c9~{xEz_lfc;}1(uno1?dlRd1s>aofVhpbB<$IfNFys}mS}MQ&Ix1^r zPfd!s&xS+PQmu0SJZ`xiG#u%aeFu)VwH05i$Q!=%-pj^d?}FG?Z0cyBj0&p+L3Nb5M$4k(e;Yo}ruUzo3j@6Tr{|*oSI-$W{io+DOf+WvW_e@|6|_19@>Huarz~j>c%Zf^BjdL=misKYL88F3@~e((or&N?)z|&KGin#| z$6I28@joE)M7q;Y2ef4)Q`TgCZU|YslK=e*U~A*1W`UU=qiD?6T!{ZHB;czxG)E2{ zc51DH%+TPw#i*?!-2{OvUEB=LwnS!I$6!*mL}ApEpnVF?>{kfQT>GU-V3mc>jEhbC z;dVq?$#Neea3?OIL8^hNDzVk`t~d`thvP^{K3~5FwjUzQ8~J+yZS#V!NgfHd>L3$K ze&tb3Hr_VtIP&Qq2Q6L@+;Um{5Jsv|p2(m7KQY(XNB|~|AUWI80EXr`$ibg)U}lJ* z;FkE{3ZVk?!r1hHE^2~;S@M`@E^-zb2M^&cCU%dYtt-g6S87e%n8fk-&1hR~0%Cf@ zK9QjrAAuPO4&6X(T9LIllQ3^dBnb8|%>)=Il@GUaR z`#!W);{$xVQU3!m*nOR>H*y*ubt`r;q*31iPlYdjD6YCLz)-w#;4?o2+~XbO5^r+F zrnJ`pDT9v-VzPbYP-=|7zk4NDq{RVeoSxwTC>+7E0u8j1OcZ2egntiwh8BlBj{)5I zc=faPNu=7(?R_i8V1m{;eRTworKSQ$rm@>WTr3JgA@`w{%S9bAlIRuE^6THj5Y1CP zSa$=LcigW1zkfZzw)=oXcJ;%r#p(N@L3VPn^+T*vr_31W zS9Y3*McV)L3Ki#Tl(`#(A+227x;G}UpIqC_CFF{WitvJ9p{$$6emXlm13Z_7AB6mP zUKX=GQ59L5)uYWOL(JYZK=04yKX%6gNu=dm35lEA2~$lVPrNR z>wS}mLB$Q6+lzFYo>slr z5Yf{k9(ykI@Qac3a+)J#er<4Zq3#_+mM8@cubs9U9!XWdZW zg8?Vl6l?NF#L3*fW|VNP2uF8Vr>~Foe+>oht2{TY}k5lWW zhP7d#PRxeXdYp``>RQ2$Fw@Imyc)@~VLrl|;1fST!dJzi2fG)bgyG*7s#TQ6si1?d z!?a3OaEjT_SvJn55{BXZ#Hf({-d8FrQm%p#((Vt2_4Fa)%m#~j*W#gG1bP0IPy4L4 zUDyB(>t4BQ%UCkokpJpoKHv(a^DvgRs@2)PQMLmZZ~+oomXZmxToeA2*rWy-pyjCP zHF?S=kRG~N%XU%JWM&b5X_nr9?QwyLETX(F#3gI&kR=JEkQHD)UO+ieC3u?|PFD{6 z_kVr47W|onS>Je-%5vIe>nY%vPzIUW!fk^s9O3RpM13Kt32~c)K9?#@Qh8gFsmR4} zpwJ*Muxp)^NVp`)3>X%+hlS`9JP8N$%$N&Pcg(ZzoJeVfyW^K4syJeN3Sgxcx%*d)v&A zpO_<)OyC$ zDR}{z*rm?*dq&tlGfuHKo!f;|0i16gSL%#s-Mfe&A9qYIg4 z0U{z3ZiHV3ZzISzcY6)-iXY!vY&b)hfjx)ph%q`dI3LNO6lkkEHsKbavBM({SM>?r zKjk|2ADrD6$c;xK$rQ0EEP6=(KU24ptlKziz6JKh0dhjm%6r{jFXj4iBZJ@t`p_Y5 zuhp)S1o^Uw@hOP~*hEez!ZsrzjftD!8hcf^v(FxXv7}L+ka)*P2>3{n+7L!48C2tx zHlZX0$dI`4h8Hz4RHB#Zi!(ZqS4h;%dUuV0Pgw|SgM#i>4Q;6ZrVM2wnlCph6v=IB zmg3x-Y?~j8)l90ck3R}0IOJmMrt|1oZ71NWo%a|_t~C7&dWd&(j3kke$>GL2v;G1t zTg@BykdfXz6`!^ur_?84{GIsyhR_iNOb7`V%%k^^p%(ArSFZ2=^XJv5MChJeSg*vE z3DryT}cfF?rf9-26Kyb zgz{#Vjv9%hqrHOoA4C=Oab*wl9BC_IAuBBoiPY|0-j$2UjvDRB{ofz$b)~Ac4sv_o zQm>xZXW8yv?dV^~4kC_c0hg9QL1Qe$eC-)S!_InR&P-b-S`JO1bdSYKji(vUUf995 zm<_TDbhRbVOqr|v$sa^APOQhT)`I#8C&q2F2zOWfq%J!vSDvms&K-`T(Slto>NrKe zYObfRd2>8UDJ{#nw2W5su$2ynbQbrI&bnP>N7H(;h_Cjh+G@922dh2goAvcg1N-YV zgnel4cJ6LtX{nblV*Q+5e{4~Od?MmC{~=1C%c`1? z1HW0W&qI{WQO?I$(~QA~{?)oI;AV~ZB+7oo(yYX8vPvGRLMo}M3J#i1houmsh1M@a zt8LXV*w6o*CYuCbpp%pY*etkAs>eBKjU0ZV@AzB)WHzO48FJ45q3oWbBx|@tU8il^ zwr#7@wr$&XrES|*rCDj)HY%Mb>-+of?tS*@arVAj5hE_vSQmj6&wM9=R*`T*h4T(B zzgG%+R$OQ^;7o2Dmtk?ix?j<)j7?lukW1RD#+Tg;O5fqXsOAH$zbGajjCYEH6wTud zyeUVu?A!d%dC>Mc5yWSCBviXbRPtihlk<5jISI6fX5fdHcl96s*+Ze_!o1{(-)ICb zfFFUzIFpSWg0fyeY4jy(16)AiXq2n6T^F7(gej8I7LR41u3O&=- z1(^Y0jJ^Gqo65kTSh*vbRe453aoDFMkdr!HI+tIFg?_%cFmv)dvK6??WcG@l|vn_CV4B>paUuP-g6ekI{~g}ZK= zL1NZ9qB8T0P2ldR<TIZeQjYi!9T*jf z`kX)MOxELcl%2P0m(rj{E7p?Sd9+)Ic*V>GKlzt9)9OlnS+nKT@6PzfouGK|6i@f# zjkXLZ0BSfp?fE*(#(%!;{3fCzdw7l`$!bKmyEgClVC~4{GB4W+nF<(y_u0`Oj-A5i zQGRNU0*2@mBFq(5KFqd@C3bbhQ6Oy{FGYeoy{ryHR)PKkn5Li-ROG5COG$ZiFjgSl zS>o)dBktEtv&X-@%I92MnJW)X#JZ5xGj?e42@@y*m1@p{Q*EV7Lt09|fa(D8kDJTe zaV(RR^0OsG&`fPYi`oNzWI#hvCL{FNIaZL1Z3&`12jZ5jcd3)-T#z;DtHWl%A#z|MB zq_b%ZsA(JxgQmq?nx3!ueN-fJW@|Tw=Ss+~XrS)Ot*3dNkHH1RJsHt_s$?S`M9HTh^lc;D;N=>6A4}CFA zY2Qwqbo>aNVWQwa11v@;+~?|MXQohJzhGGS`+iq3BH4^d7%!jUp1cBPMp{GS<0|p7 zl@tss4UfqP&y#IZOCvsVWh)eHZs8jVyA;G^leB2M+}rG-OdY+2ZF&b4(q79%rjl?+^bpcU~Mik7)P{(Zz-uzH8<$hS~pcKy3_JP)?n8=g>Q+lX0wNP z0ybMt!ZAPlWVhcFh0%3LOHBcPUf?c0Z8AfNR@+bEesM!~9m*2o%=Ns4#E5zv zR}ss>w?W$cZCKCRkYU3J9RI+t!7#mm#RgT#<-h!gVPylZ9s0Dk@i|@T)zVD|a`yq{ z5n0Jc*i=(r5DVh+2ZA-lk9d*%_=yg z{6+G)x}@d7y_*-KaU*Mu`jP`kv*W$*BG7|%@j^K^w6qwkIyX=S_kw@dK2i`p!C>h$*})qtc)e&Frm-lmG|;%D+p)IRdhFaBhq(Z z65os!EdfGH0e0EYV-Vd!{@{S_h)2^A=iJW4i~NVu&5ja#CD!SYSgj5q+eR59&PyF7 z+ZFQmfIY+d6GaJ+b{?Y?s|c(Dst25W0q6l&w4|i`6nrh(Jq1qC35C9MhIVNnn8GhV zRvEV#lUZf*M4Y5QRGu~i0G0;Kx)RcXe(JJ)PPo%&O_;4%;yw6-g4ALI2zU5-LGFbR z7~)OFj});zF^x`5$3OC;^c__(md%6OP7&_vQkg5lC0C{x<%bkA+%fme9;G6lf6O;M zYZw(-M&W=>>tJT}W9I7D&tO3<3W!VI0S!Dh%8cqQ8^OBWYctD?JMuTJZK8kxa_E8N z`<``+xErzIGBJOP)e^ou<{R1`@6qD2VkT$}A~sEPAxA*eFff}WDj4ll&NieBn=q9X zo~i`fkq{G@`riEUaBWPX3V^hK20Jj8hZ@)D-Xoz!G_fGl zP-TN;e6H*w(Rz3=sP);WTtY}qFkKk~j(<9~ySurmlUoqP4?q9Ok%LE6gNsHk3qqZw z#gM!RX^Fd&&awrsQOj1<`yV$9Piuf|)%u64W4l@fiE7ri%fQ|em_kDwd{kH7Ps*^w zUT#J`?!8*5xLj8!EpC9&1;m1#Hu_UkbFa<4PLhZ(^kntAQ6_9{r&{a2RG#Ei5DH<+ zclk`OhzEY1ElFMilD@%ve6&YjF8LG}7j25rf6(W7bUS(CW-};->1Z#fkUu9G*I9lU{{vSQ(tR~Uc9Ko@ z{sXQ8(|*HM83onRzi@Tq8?Ji%g{ysk;cA4NaxH|`e}}7jL;t|lK7{AvWy06_JJ{#{ z39ho7#+FxVG!jGiEYxfC8xHD5Fpp!LMr_^(o8ZbehR-%K^^tENqAc~LH`-f0{Q!Uh z&=8awHPmsQ-f_h*Wxh;MmtQ3{h*7sQ--|ma1vN3* zh(KkPhB)IXGM`9C1_vUMaU#a@S$5~zcK7-N~r@$w>@&jHT#8hqfkqB~Bz?nu@OTcN+k^#>B$jA$} zQww=hIj0)86H$YPx9tqel%1*oFMdiBLrc37>f%?P;5QqZn}ES;S~v5U^HUBkuFC;P<%Ief5|nyXDe1IhLn-Xh^@ zqiu3w;TopH6A~DTJa;oFysg-f5=K-I9;TQVZaQX|m0$aWhZ!ebCUY$7<0d`df)#(h z8t)ut0pe;IGA?Y*-pDv4610keKUQN@hp}IXTjbeA#`;vW5hsKG)Pn+CS3`cPsxx+> z@Yclu&NeX5%^zU1KrKc`u=^Q|PJoH3=P-fQuB(QOKVM#arJu{M`P-~P=x$_efj&mY z1ThHh^J3Y&Kt_v=JFy3s7h)1G%aD>6t=3=)r}-wET__rG53M?t7zS&wM;)e#%h(Ms z-WQN%1kdkwFTxe|u4X+kf(60No5Yl&v`5X0!*g1PYn|YiPOZfRZ*1&sV9!*Y43G zCqMSiAn*O^_QxBC*0TbqW}wZ&xU|I|Js8)%H8cZ2M|xOo0;0)w2;ntF%XkWH0qSTW zb8lhm;w@+2&-6bfjjefJlorgXM`@GfgEzsgf(fC8;W}!}f(@R(pL?YUDxRHD#S;mB z`itoiX2?IO_Ty;+)P;U35I}$M=6!J#gmM79{;3GhOON#Zun^RCT_v42I2_`0ZQn8M zrLK0$(tc~a(Gz)+B0%Eb*&Ci<0p3YM)1d*ErvIct5b)+k@Z%s7_DI^xR6!izaO3q1 zA3~HgjgsU5D&g&M7)f+Y?Ho*Tyr$lTN$n*XUEv-Kza^R|*rAfK8(-;<1T3iQg~BnQ z2fNS{pNt>w{}!Y09Ui9&0m&qU<>)hV2eE*PbnRs0ZyC@hp#}kweoxYC8L~W3?8D<)A#n#splcflcL92%1D7# z9H8sy(F8W@u-@-Y>l~f^FyQ^$9qwoxZB%grRh`5q6zeXnI~J(vbOcC&7m__t3P!?Zx(dYdN1x(5}9WCEYfu%d_BH2TN9_KB+E1KssGQL0?zfFH9}42kK~|<|=VhYM z^EH%P&Weg(;=a?woED;s9GiFqdAjh9pG(Ho)0nXx(-Ft&q5^-kMLNVD=wF3cu8)@n zU!wygS=g%5CSXHRvmMva#)W}3pT-&uz^+xNX6Tatg@LdcdQyCk?khDoM`K{{=!)cJ z0sBitA(au#L52IS$X(>IrUm@Z{zHuB{a8K}@t2xetsH-MJ4Q~o&*SIj%X(Bsi{E-T zh7YXxeQ((a3v!V>O6p-( zin!9ZgVH07-TbUGe_j0PS{$4WJlx6DFcO-vU7+yW_=_*NiC;?+>4dBOL?6?s8GJdv z?$4vp5A@s*{BpmZ&Kvc7UrtYkqV#lm-X5P*kHz_Uxj!#o8n?gOq5m@(61eIv17dtUA;<0H?eQiU2tgT^>Wo$y~5BF?t%q>_Nz6qAh?Y+EX>VK7aqT* zI$j7yQifFA|LjF&lDV!8VL)?XTJXu2!w|pUhI%;tJf5ERR{>$tlwVk){PBM}YY;-M z<Mt8kC(NMl;=A^T2$0W`o?&Mmco3Nu~i3cgDkJ zgXY`)B)k0?_hVJ7*QQG}kBqE#$Yd`ed0)@eS-f@oQkDuW$3F$u|bpsVK4d1I-{sdQkQ>J9#I@RCrkIkQR%TU#w%B}38z{< zh7=q91*Ikb0;SMM-}y~L7YU7;(;K$*cl`6&CYGvGzM+#lq`G&F0Fe4AndrN4*Mas;PX3JxSVh5J#@<)Y6<<8M%-jmP` zsC%~LskFnF0w3Dug2qYU4O$^{i{)|lgQp1!%#RQuW7%JE87o{gDFtI$V&F+dZX zXQ*1o(L@}5|Gtvvh}Df%q?@L9f5@==hN;bg4l2RBmbgNx_%rFG7`<$~AsSpsz8a9D z97U76HhcKM$CfTDe3I7777wuLiWjJ^!3H$)7WFcAeW>3DfSO{RMABg-DISFQZe9g0iCUuA&v;)40_5$K1*QY%s0Y46T8$_J>r2Sz80fiI#wPRtchk z)4AFunMj@6Sb06v`r>->mUV-J3#sJ#nu%uZ#~ldUN<=V9k;7>Wt7G)9NxBfPlTl#< z@erO?a%h@gz&Uz)7Gi{e0asd*(Frt>S)PS+c8nI+`@*+fbMrz;_XjCuV zbq+DlLEppusW=k@KT~?;^+p_k*!CaZ10?7F2vn7Oua`cle+g7RTNnmH5lGe{CWWij z(IDDV0PIFlv@r7Lv1N$#z&N9DT%guuqSBopA&IL++6%a5yyb8(3li2}V80_o+pma` zbMw79O>1)qSQigR*KA2D_A;%L=<%n`C0$7S3)z#M%>cek)t5NSVvgU(r#7zU)ds(hmjj=lPk6=2cHg!yyA%)ZJsQ$&q#fb;WMcA~Tl5 zL5GgjTSK^3K5~9Qjp)Hx7?mqMRnSf%&Jp9RHX?Dvh*x2B>`YarvmY zK|@Id*cJwIyp))TL5DM2Y>$m%-|XF`YiDaqT&D37QQDleVs7C_tah%)rr@IpykB=YU`@^mE zbL%%7cQS=TRj;hZ+@i8P9dknhiX67!PumQI+&Xw&YG{_K(N8$)sYQ?}gt`}%(Vj|g z%y0_#sXF*=Veed#ghEhFp+F{b-DT8O)pER!wacG8Zf*;Nb;Uf`_WLWns3pTXi!U{|x70st zR3-^3@7!3?zUCO+@LK&+O-QX#*!A^K_Wnc%0y5QhZkGlb>!Nk2ZQo+d4Z%*Rz)lkB!n3UgTXUOAy{juTIyaeC6Y zf=;(0KxM#TxZCc9JHx%O`$gB;ko}bu0(O{?wnbGIW9&^~C0mv;Xjmm_Vo#tOA4$Wp zkheggf}Au?I%9ojA0Ei@o#KX3JVU=o(grA$;tsdm&lo1BsMj)Bkrr*lFY{o)v<|M% z5a2u6VHTEAio^iNSmH@M@G15w!%!&{NmCpon61m9cr)2LFr;0GSV@Fjj#HW|xyin# zLuTn#cr`SN0_F;C1`A05;r;++9cK}#`B-2jVSDNDTd0yGHpRX zE|cnk&$+nKP171x)Qh;CzA2<@RKYdRfwmCVu~Bwr9k|kvWX?vuDPAF=@zoBmYTJ&j zTzKGEC>p05Bb_}iRC3ToH&w2~!2p~|l4AzVL4a&K?AlDvS1J!WbbEeC`5I1=tLMDt z!N4~MvP1?zLM~~zR*2ZSZdzm(htv*kf&F0fCwqr$gqAJ4;^n^aSSNU<+9hi?+jz3U z3FWqr?Qo+w`%|6?PMX7tFqJFrLtyzu0;l+(NACJWJ5hD1q3c}nqKf8fgS2|McGs8) z-cg3-wB{;f0VY_odS(M#$~M4417WJ$!I)qK zy6)v?i@PiM?r=Uw+UK`V($ta|4`q)D1HYzH=Imw6d?jEw+4tiaFyhi?WVQt7(B4N6 zGsUF^Y+a$gwWc&2gdCU~sn#d4uB~#*n0h5Z%8B;2fT+FfH-^eUd6V9c@9|-53r^}0 z$6{I}tpM|h*A=FAxHG)b2ECzQuS`(Lca!HRX*A#UM)P!97w5|U+czyOWzltVU9E2V z)lWKs1%`?vzT=M_H{t}*pVp`)ijJ3JX>9#Xh$YlIc++Kzk;SP=_Bi{ONFpPb)@R!d z*#3inQ*w)UOC0bad6d@tyfWFRa>i?-zhZoVlzv>5Oeu@MErL zB4dD%%_OYIRho-`%EM)=(l>w$8MbLI0?ANiyG5!lBG>?gC|cP3`q2oEX$_T1!5p4K zTae`WOGclpfAXA)8jfWuCN(-L>4WPoUOA0d1n-%Ur~;uPlA_>J_k+wF4KF${&H`r1 z4)EqzF3w=1Ii!sX?kZ^*$l{GmRI#OJImrm?l;hy5b_Pm}0I22svH{dM{j@z-bl(02 z*y!g@nHE@xJT>I7pgT5)a+mYsiaJpwVJMNAraE8*yFmsj8ED2d5Y$eNsH%5?{ERP` zVJ47Hc02?RaLTLvl&IwzpEU`r#V0zuJX5}lfJCWFg;doJJ+ZO=Ndl>g?M9HUVfI~fd>~N zS@r_FPXxqxmqSRg8{(1(n1~40Nv!|;9R6Als0_Uj4|5^;D+J6Ym8%>n0K~UrGTO(Y z8np?y7*2d3nd`kXo=&b?O%O|WT4JXdvp@rBIuXII;rSvd`(A`sy>k>#(wEYDJGh*3 zY=TJ66wP~RV@-fnCMTyszu*TF-`jT_F*xKqju;H<5bQWRJx#X=R!`Ga0ys`v zq^qB0%ET!nB!v}D{cx_+r=6>jajm!^rrSJ{;40zMJEEo-&8OQ{OM?-+T^DXxBw|q> z%5n@WRHD>VFJ_w$Xd-MO1MPAcrf{YQ>W*m>DUw8o#5MvmXpKUP`G_Ro#E0+{DMNfb4U%)F#1yeP^Ft+lIuWUgs@el@wL2XuV7X4roKUnS)Nnf_5jmy@Phcz88 zwqFcd=!ISs#*O-^*hrJqj3W*ckvgu#(5M_Fs+L);Kv;6;VK4A^f0#{lCU}F&nMsQU zvshAA0HqN`nLfPNMn(Mz6aOH-o)2@P?~Xv91!1Ny<|yHDPnJuDh=c3C_JM&QD-zMW zW$YXWJoM<#9uM5-G{7=5PV0^LFZ}T}uJ&MXKZe?ZQsHpAmHxZL70CJk4UX6l8B^Ccs<(_XWWJdLWJZ)RhI~+%z)hi!XNb zRq1yDRC2OCmAZor9%L8%GJ(nyu>}WY=&wc8=-*1rZVRh!I|Jg?^)t}9?REmDVS)sIlw!!G5xARFd+}J3>UlYIfF)g*S7Npw`)3 zw`PnBg!7wy{QQwmnN#1HI|wb)G2T?x#XZ?uAK6io9$?ph)p&Gs(Na7PQwGrkKJDb_^J7oJei|3g3wNlbSf zm{7ZiqcS6cHWz?Djr{X*fnU%p0+Av2Hil)n%fu7YGyz{HxfM(%zjTPbWG?EJ$I3It zh_>Q^T?iysESyEin0b?3$k;2gyYF|dr{C}xI)4N@^JG>c9RxSHtUK~_*YQU$0IQg< zm~eaCzNGx~VoXX7fBKH(@RudV=a*D4uKNb!JJ!l?LlK-lXz)v6!&0s`IMW$tG;;8! zuYnh$NVvFIU$5JwXc(#=0jRh*-*;FJPhM{Cw_{lqBdVBx=POZ$Wfhghzb4tbER-EB zhu{$VT+geHZi>Ih`4_e?3gZlQ?Rk56TD;j`4eQPA<-z{Ee0ZNKUc*xn zIDI5JQGKn(?eE>gd|D^_YCw{zgh2(jc?xU6{fyZ(r-Hi2uI!Lnh1G2l95J6V=~*v- z3f=Y|t*rr`UrK^7Z4F{GC7yMW0O0M!15$4g<=UC~l+g1dv3mpQv-^s-nuFF#+%@Mk zNB6VhP7gj!-3{ERz$C=S!TET)kbtM{sv8AU5Rh@V0DWA5HyhZoV$d}vDdm-4{xKVQ zRf$RFPyFc)Ly`LTo!6%Ldud4UY_K+-beN<)t~V$WMel;@QKA-!KY4$g<{vT^#T~#` zDUIOmCm)t(uZ09PvK!X3NDT&#e-YKE6A9|Z5{)~_cV`F-4_j8mCnsV>@+7DyrF@R7tstv<%WE>87^0&7bnIT2D<))d%gy+4P-Dx- z$~|RTx_ZG9VkXW#b;cd=r*qf(DPu~van*{=YYN}Ewmo6ku6sjk3xB2dDe}&{i=U4nTS-4+E+g4urj9q|g%;ZToWZjyU!tmPoMJ0I6o?>;~Gf|R;9pUm-R zlMT1@^8O95vd#ramk;&GB2Ws&NiW%##5yGA;8gwUCthZ??7pYv+U{;T>rsy%ldTXp0588?k9^~^hG~Mp?mGO@%v|%&x#efi20zeAH3jCKuVT6Y zTUmC{&H#F{iy zTWVx&)|4r~>|RE)J*@a~_hS|K?7I$mnPJE1%r4fL8v*gR>D2Fn|1nhSayy#6iQ#e; zbz+L#s4HWp9gp}f+|t(HW@{p9t@ubAh&Xd6GJ{n-h6wai=Gl8T7d?(Jnx-LW^fP3I zaO~Of@SlG3ScvbWt=zGKz4NHBY(4tO<#h}1+%$jGWr~|jS}Rd)Wdla&7pK>4lms{1 zRe>4B0E+}A_3d9G%ll1aV3HW=lP)a)5il6&B>Va~Ly%1BNE&lquvOG`PIC2zYYLf$ z7cAtaGEUk>&;T&G09b(XubQ6 zwL>pD({FyD>y+#gfz>8?#)g(eWxqv50bmg(u)lO>Wm)C(Zau1qKyb-=wk6&q^KAGa zp=#jy+iu;^tYG>$(7Xa>?WH&qLXPVzg$iSv{V{C5KTF2_dL$JKML|u@gM}JNsVAyM zk@iYY9mD-7@x^bAA@!mlDYgw{#vCP3nS|S~<*cg|spSq7(IOP7G*2+E69H6`BGYx>W!`=U%6 z+=;3=s=$0lF3cu2MG1w*n44pc=1R{4hF9A0rIxGIimpG$Teky>sFK~5oXHqTy zC`9Kl*N`@%Mhmm#8W7r9Qiz4ROgc(PVh~wa- zPnX9|7J^C^LK(3b4{}9`SR;|xhL3kn3Nj%}k%W^>Qj_tAqG$n$a0N-Ku_Wqg!jfc~ zGPOy9(p(YiJeduT!(3!};*v~`GPT0>M+V5nu@%(0`#ZShQQG~Fz*4ebN{Kt=k~c-A zzu%;8n$8g0J5tTzM*U8J9RYFK{CIS2z0t$=i*1^{S!yI#=5eC!ZuPYnN!nlPjQOiM zUYAHU#~qxf;d`W=XtSNI7N$Qqj_JmtTx8p`=Y#p{n6JR~do916lk-9KHisrexWC^z z`k3)#sqt97uS--j<&c_7LhXn}tL|89i1OFQUgT`?prD8q&DG(pjzM6EFPa8V$Zkv+ z|W<8!U<(G`GE8=tO zj52MCgUpOg73#H9saPFv|sv(M%Q&UdtqC8jB7#=Yk;Xo}k42IX1IS2eZKdjKjtYI(sBXwGgGt#`Edj(AuL4-)iPX53 z=T5>*VPZg$2l--vcD*blON^ zkU-#U)NOYhGLVG@_A-m;gS;SF0<)(akjI!hj(28o&by@o5N*DBh?D#Fs)cC!^FRkT zNGzpVLWJRz3NY@!KfzG1Ov3?l^vhQcAecar)7Ch!k>n4(;P!kVNg-$xs|VzD9Q8=f`%m!Lf7R8V4(@O?O{dCCPmF=r)_A^7vED&r&Z2f9RO4yXqWs0q5jD*StJ zqM)CZ;C=?TJ#$tl7_wUx}Swe={IxcF@KvPsd=S>EB zBa`Kontb#*6r%}PjrYYx1mnil8@$Zl>SYZNbMR+oGo3&zw0__)SAf^`4)!5@GU3-A zrG?2ytm*(D!mS)QVlk8?IB7OeMwwwUd=lhCt)m3PDfr#M1CD&5{tinbM(j2kg~)#< z^$&&#kd7dpsgmSZ=mN->0Fw+dP%w?7ZhRgduCJzC>NQKd%>>Ha%w84hpm#AcHZtY_kC!vOa1;ao?_8 zV0a+X7XpEA6yXd7nBX<@&b)&mrY*pmImLJqMt?818Ea>w=B2&P+diMtG`Oi8u6`Bg zEZZJ%Vxd4!O1qP^w8qv_No*&p>gdtn8)A+-Iz=)woH;D!O*~iDJcWY?Bag`X3}Q#L zVJ5%ma!YSikaKpk9-s7bX`OZKe5-qwZ3?v*pr%WMt%OKM;Z+WPP3Exw4=}mu;ID zZNw`^p~0cc4(FQv)SbR?`SQB|R@dx375CbO6l>%y?8v=VZ)oJ?TbDV!?Yh?{ zDxY&~ovS|nSz7m56RcoGL_nnP--|stYmjHl-h>jziwZ4vEwQ( zmYTpX!oI%8-_-cuAt~3NciGc5Gnt>kUBT!RuZ%c@mKlnUV0t)%whu77{$A>!zn7ZX zJ$om0ddGz{gZVkk73}Xxxr6;ZDF?8>CzbWP@QD_geM*675;=5cPFl@JhpL)H#hAe z=ByC^f@JEtBPw;ypMx=z{!gUxg{Y791DRd>OFO?>Q^LzR{1*BLZ}aKqUV9A63RwvU z3r|0S*n(tw%#QNTl+1eyd$|;M`Ep^c9anR!tLbsy+$N}%0BURf!@@aGvfrSh*39L> zgW8m`goeUsP`(2w1QCj=&!Kd6PkOUta{^U z1>lXAx5(7IMZLj|lH#_aM%5{pFk@5IzlAM~gv+MuI{LhD=&}ABUOmV_O9oe$g<2J} z-x6gI49DwS{@o80!Wox>GxDmnxg|LdGq253uB9B~>{Pg11AuMYjS>6K!f^f9?0*+3 z*&`|8(aob3VHJdxMRS0Y%mLfsj1-ZS3kNDeT^gXFFtW*(%ku=4Z}ed2b&NDv7RN}y z54$6E*BSgZSEAA95_a%YkZ-g{8o6wStHX0;_}M1_J4NVk)(iPs)gC?m_+S^k3LB(;yY=eY7a*v_Rv>Th2M#^($|Qh`UdRSX6=W? z)vJ<12U+HkMOZx%C?-aF(@ge}S;r-oriu%`uoOr+Z8`9~tFf?rq@Mk8-iFAy0f)O;6DBBr> zgrumZIZ~cQH^+&2A;SN=L=7E=W#}iIeBFLmt$nRlrF}((ar>CkF~Y36=elu!lcUK6 zKMc&1PA)@DpYzl*PI)ZJfWJk$G8dftRBUxOWq5(DN~?A_K!!*@G5B{4A-Mlwo9BQ% zlljm-O%DBB%4j}oA`Nvb$SRi#t|B$St$sYeJ-L;tKn{94PW<a}jqzotJg4lpOHMy)f>b`kuRMpKA;Q>E`xYNf3)p;b|0P-UI+(L1l`&A>oA z7xhV#t0Gi^kH>NA9j!hxR_7@etBXL5j6{TE1lP&p@dd0StVgZi_4Hv;y8hy5$s2mz z#-vjflyN*B>&obe@4G`S+qdv8&&2-oyFrs@3Yv{f7L-hQ-Xr~b zw;Ms|`^G_esWrC*HBh&G$R9w37|V_NQ36@~kPu%NEb6s7rHoRZ$B1fIXsYh&ReuRb z>hZS^5^iD8p|f+@yye9DCTvD|YQjmudZ?e@K~8@e@n0vqtudj6b zM#p9&#p?#`pPmFpQ`mbk7S)pPi(Ys+(e7VR$JuuXo*he_<6Cw{7l8Oca@LIe3Xin| z_4ZX6^h8_?hsB*f1-uE{-fdkWf2>Pou@G0M^UCO0t4)-;%Elu}f($E8GDtg;urOYq+t0-UCWD9M zJ{Ka!h}YTcR}GzK9ar>kz#P99q42J9W0+uBj63B>$<1zt& zXjvc61BXhFn@qM@?#^oEYWypei%nWRdWHJd2a}k$9(%d2YQO@G(Nh)dIruHRAB)2Y z&30^?sZRDcvM zi2S0uNgn9@hEPnvYH=3cQ@V2j0+9Pp|A1iz`~bKY#R)H9Y6HrZ;$OUq{V-VpN7xAi zqxgOb%GS5&o5+Au`rW#>i5=dWYsyc|b6uOwe%72_L^+TU^Y(1<;K~&Ya{XE~F#Fiy zK`L&DCIJFO4{eaaD(<~_dQdSMZC+#h5KnTuKGAm${WXaX7V$9Ap@H8KYWKep>dIdn zJL%mZEEl#voRvIUTrb3o>mTyiyArjCza!Mm-Eoz~1=0cTzw7v-(EUUrP0xV@#O1F_~I)HWaDco1W_1wVP;gEU-d<#2gh~zAP ztI#gfy`;@n>zXMXaR$t0-nWo8(mqC-IX!(iqQ*Nh3k#go3~#-sDH|PlQ{W1Y)+2Yl zjR_-GTsz;jUWW|*?0z%T!4t>h8c;f%^Wwio2kfG3|M$@W9?w&b*n)WN@C75tE3oeX zHU7T?)Ul%yBg*io=I|pfo*XsHz`!R8bf$42(TN*S_hsncJ0ZHZ>a}=7H#}Ou%;MQq zc=3K^)(@LUH!opDT?lCyakNBQ#YnhrRxuK34K<6AbVe^>{H!jp5m`*3c`1;0@Cvb& zWjru-C=pP{&&eIiD#4G0SA<@P;6>ueI^C z;|qfOdNm`(3V9^SK&E#4e&899(_b#mLe|TiINP<`utg9m_A4Y z7ypuAky)a=p8U|)xTEe*vHF+`uOvIJbW8qPSOsStX3o|Nq&2H9qa$F~3$ku-qt#IU zR)biL8pP0ub5rHL?@nCGeY#BZy8{>ePqC7Qa6xFlCo2|(6532g+3i?75L0%w`Xs!l zWrmkn&FA054zB@iqR7_}M%?xEXw)tL4pFZne21uGdS0U;@b@_pzeCj2e?!zV!ErBT ze?!z!e?!z_&lKQ?k=RPfLjMX;Tl@`CU(`}O&2BG~9an-BQvsFqoeg-9thB<4Q-J{T zm&{5l{1~OajY{ih%yoVh4;E6;7WYA8=dnoyTb!nfNu^MvuD$KdzZ62195<*TTw0MV% z*u#r68mErOMh7A9$pFC^TRQK~h7*ElDm=yspmpO2<6wx`cW2JhRgeC*u zOR3V^`pTm3ApXK2@B63i#Wsufy$ok!n9cIA*chA!j9cF(sty1)&3LsUIGo{_$k#=> zT+omtaKX4CVK{3@_3X#-aju6Q*95g7jy3c0dA^4BCka6jU*yWAE;32war9RuNI|5W znga_Y5~TS9Y5}B*v($<(G{DjfKa_EPFZct#_yPjBz?Uv6B8$>&EkAAe1f5qMcU9NQ z2pziigJa#5*F#yKRDw1b^a;7+2tawF4qXpSxylkQJgRgP5zV^} z#~Tu;^Q?!4H~&3j)E$wFV3@Ej;?^xcEk}P8%rkzhIk8;v!bSx~QHVS#l!5LsMGmyr z9hw~k{~IxXAZ+dbI#5s+5v&gLa!Bz+m!&gww-wq&G$Q{!P@viM-Jovz+n@%aEuEwd z178GwDMCRzqf^tT=<1l;syf&=mntn;Ae1}N4I=f1kTecj9E?g!EijVh<=sWJ zDGta_hw5J2a!!XFx#X?HulK2lfezb9|1lY|hmdtG{?Rs%pg+R$UinVZBWZFxk&-7{-4ws50+5)4<;+-Zlprqp-y3Z~5y zV=__H$vxJ2a55s()e~OgYNO5hX^+Cq9Vx;WgKY_EJ``O`>hK-C*Ls$gvx359@XbgQ z461IaQ1M|i+uxuKKUs@T07xl8*x|zlNG}<$@pSqcJ?v`1&QXx_} z2N>m)8Gk}zgF~c%V3{GtNqtHTS*kZI-6)Y1be*wgM~B1g#xrN{a5}c0uWRHZlbhY; z{Z+~Tefxzs=Ei>r+e;G(y; zvtA_TjGuA|#9ge@3B6o>Tu*&dLHEQD))%`rGKe{iZFpDL9_X`(PH5XtkI;FXV?m(Kwok`{t>Of%3a;WJp=CuC4Odt4iMQqHZF zsB>_qpD#_E(dg{9d}qJEGd6Uc&isra&Iffa!+VcEG-h@;SRRiTxUoIvs+BpMSH8tJ zk`V>9(GqvNROVe~)}dA4K^xA#E#Jm(VvmuY)QoF&5!b?xWMfCakK!iP=T zV?488V9#JmR~5MpDi<877xAqx6EXb)XkH*;&>Yf~Qi48SZfdVy{$w;Q6KPzgKoV8Y zZZyC}iPz`$?#D5bee5e3QCtUTk)UJbp%cuW3BVwpldKRJw&@dpzGQB)$CTr zj>zp&CsYZ!vugs;M%TxX;OVH#Tl~ipJy^QGr0eF8+|qa-Th@?HQ_5MWv%19+Vqy~q{GAngl8M*@_F(niYmW&Pa~v6zPX(K^kS zeF*a^BnS$T-5D%1FV5bl5@eK8A~^r2pt?tb5+SA|imQdW9A}E1lI*lR+v>5%cTr7t z!2p?uZ?jJ&m~Lk2Q<<;kvKTyCMN2m;1N3s6C6suyA2gx9!uNcfc5%QY44%za)Q{Lw zs${shM((t(UxT!dQnLlIbHi+!{EVLqqO3*~%$%$Cp}5W6$e8AsE_- zY4Zok??pnEIni8+L4RTDRtBgOZ5d0V&K_UGe{cyvL5+sBaK}^(_*oylaAyyaw}jgj z+1n{`$m&@9#;$QMeq-17m!H`6km?`U_4Q!zCwBdzz!FDRIu>RleLA#O3kEegbo_Rq%Z~0LYJ$$rjLs;Q+ zXfU|(--iZEgR^$iLF5vN69d!5Dj}nqu-5vW1-Ut{sjm19cO7Fi9%FY~3-X3a_m&m= z%T$C;%cl$7$;%W{anqj785cFao7bvbqZRKXs9FX}b13o*(NwXXZLSZ4skPh3FE`tT zkw(3p8f{NW3_pvyR4v9Y*-XTxJ7VEw7^Pmi&zL1HAuk#e$`x!MG8iA+{hdq|l4x~z zOf_HU)A-NyNVq+GH(hsoGP$wrw>N1_rm`&~n3Y{&Y?8$0NMIp)VEoTQ_$=L|2t!p` zl6GHZ_yycn(aYVws?s1quL_WQBz-XvJ_Vmuu=>8x>&&?n$6Kr5=6t`s^LqC*IvdIW zGJfDCXW2=r{~pn91&95WHwe=X2XrN^$Vto2s6F6Jx3m>(eOc6ZDFMi0h~E7}wGP!+ z@};w7wXToDa5d?%6@guQ;h#v8%XQ$ z{INE$Jp%X-YlBPh|GYN%0t0nr>-&#u16R(^wZZ88pKF7BE!Tfr8(b%zEOGtQ+Mu}e zb8RpfOCcAM_%CY%RH^^6Hc0DmDXwWA>;+>PE}E;ewQ#>i-{JP$Ei|PQ1I%3ElpcBF zYg_*+pQOTWcQH1wb@w!>s2%gF;(udu+RC6NCppT214dHYF)w7e+qXihk&o}WKp$J` z&c<-vb|V&0L1ChI_G+VZ`C9$W1w#T$`|;IA|5fax6bj&d4gtg&rt`~9$2t7n z@F;7IYkPbR$HVKjZv~j*c4#Gd@yY!sGL#zHSU_g6h|uDegM1ylno#()E?xlC|1wZU{jW%n>Rx7OYJfBzk?cnd1wa>FTd7>{W~~XDrTB8pF}&XB&bv4D+#w zzAIL>KO8O~;P!nALmJ;&8KwBl*ddAm61y+6H2lRHg_(C@i3fI9{qUleHXN`mMi4+2 zAL0qJVNI)XP+U)4LPV^;RS{jSut0ooJ&|ni!6{-~M5O&16M7OR%akVeG7nNe&>Wpm zYfGiHLRgIw)KC^l9ebK}&P({BfL%tLOGhx-CgnYR?aJbpuq-Fs_!YaevtCf4&V8qT z{w3zu1&{ztuIc&D4LA=LLKWm;MIABA2T3{fqGueTtBmnRSmvxiM$NBo=n3&^>&X#XRb6y2 zFufii+Hq*_m;%aBnRL50^4f=A`DhPQUUVeHUoUEY@Pm`IKcQ5&l21-D8wubRCce*nTB`M zhz|y-Mvpo?g(xQsRbOu(<{Qp6KmD&q-$P2(l(UgA{_w&E;F)NB8U{j+>|j^uAyF=e z+v{&|P9X^G%Bt(3e^~ef< zV~T>c2Jegg{V%<_@6iv(z0HXmeWAua$%%5<^0;jyg<^iffg6F@h!P^f9Xoms@xUWD ze(dp}gFky1Cx+-)@BxKW-{UKfdJkeL%_)BD&a^Y6Oa1~`8luJ)>SO*UCLqivbcFi; zVrz6BXRl0U^l}Qgq5`Yj3D!p*4GEo@y~5MODkNCM;@14K_9f~GiTh?Xk&+%Q_!i@I z$$wT~LjwhvuT#>$g|UU9>3vOW_;zWjgiZ4iO1BQV`~2It zw#1XG=B7Ge8ah;t17)ra61m4TZ(^Xmui+CXCsX0gk^4|Z^uWLH=lr=OuOy4b3rtN# zFoL(yAbFk_zJ{Q)IFv4Q&S+~S->Yfi5MdkmAxIv?u=3S%gDfAEg>Wk#B#1LI1<^bE zl`;(}0LC?L5*dv`Oa|Q7t@%f#A*zqglJqNk4HX*^$&;RaDDgU(`K#~G6H))7|5+T~sVStWOC3Wv&;k`$O>SBmStHLxJj3KE`xsO&Z=J`n^F?Y=iW zjaHh%AGkH%-*D^NKJcW;Pu$w<6SszD7>=wMQ3EcRn%%*YKNfV)U}_(zMpbymBJhzW z62K&=Nj}FSsNw9_)IOAM=ic25&Fl-sFq{xY^GgRNYYR5o`1Do1Fp0Qxv)2Z%h{<11 zgv2K^B`%3~J(-|CJV|wCMV}Vybw%rf}1BHb< z+nvOOzQh-Fg}_E+;C$HLzCJ!#4Pq7xEMOc?702;Q$^8&<7i(lQ{c&^37ZKg@U_!Zf zPV_F^HNAF15TPTE9)Agb6R(bEK9BKRUK$A1VsXEuG0x6mEtZ^M<>@d^mMJ-DZPA@MxrJz)@Q=XFV(G5u7g0P5o-Z2rB3T-%L5H+> zGcxxJU0VoUH&YzVfGeRU%qR5yy&@;&`K-v*0Do8H1XG_CxfQW8e_dt1*YB)d(doiG zmmaMp1 z`j>x&h{fY=R2cI|zBLk+5v;ISewO16(@Q8CpNTo?rSB>VmWMU%@5CGzX0u37$xft0 zA=$$$Xt;yK!k|!5Ai+%C@IRI0LZI*}K%xkcMDGK7Vi`^rUhw3b?{>JL!c>w~I^wr~ zK+7--sbY z;u-YIGHw!zsYLt$p7#er^wa{OB2tn5hInG&rI=QW2u4n&anA z+KyxUC5=`I=aFb$_3@)WaILIg)eMU99Y5A3+4ikiu&A$I-dvKf%I2|!}kjI_|1IXA5edX~Y#G%9+D11^6h2V(p z>P=`x8pz^C6rZ?73dr&_y&uz+HsbRaqz}nQ(ZG%;K`Ht=+nD*EOL2M8#1&Oy0*@4$ zz{kXE8)WH(%lag*Yn*{Ns=yx~-{M~0`v$(&UklI}M3d*|_-9;kLC6p#BeP@Zk$C@7 z0?(tu&C&jJi3si$S4@xPo%fQ`z(y1JrR-I;d`POsQNvpD&#c*~yNDy)as3@WLvf^9G;MUo(u9xb5SDP}&rm$#GZY8!{tU$t zK11JCJ!JTQoCw%i@dIbr0xAwJ`UE{qEkZB-lwbsoVjp(0Ri8}L&A6Edu5Q_ z%hF3h?L?lW&3L4^sloQ&u2JG@|18&4ClHvJVk^XP||-6gv!2XZVLzg-X2771GtVHoU2FS_WXdoAoK)*q<>oG2g`=0#qV*^PfAN^v+BhINU{S*YHxuY z9UOMU~vF$UC+8NFMO*8n_Hc`IF8uBeAgjLeZ~g8t{-zer8aO@OI-;!Yci}Q z@btsF2FkY`04yhP#FdlhZZ}Uv`gm)5b$VIfcc0905w(5gSeFl?Nz(>UMYz1Cy+j4lFOj*mMjLc!{%XDEab?Iw( zRV2O0zGZBXDtg1l=0M?++T0dE3#F@Y3#3`w+~Ja0)ez=0r1+mfqXp2)y`v7&)Ufk1 zX;x&-^b!bef@BvwC5iC*pdQj6&w=>;9AcHS;~5(iMNZ2n{9}4 zn46hvfJ~P|#)k7xUqtv~bS(hDG@Ff=RZB*)dDDDT(BO?IIg+KY22wRAtj2RtfumOi zoLsdT$gILA{z_zQ5ZYJ^=uQD0G!kcHZ#^m?SrTkhm9SvvRrVNhFt9}U^d%rWV!+oL zoX_ziYaBn;D*AiTGjhtsQDwxBrb#1USJitXvs3ZG_x0-$HSnQNl2Pj4GOn*A-$(*N^GLoiGD#gF z12UkQph`bL+}Ho29up`?Q4BH(|Cr)~)*v2ac{fKDfWtMm!_*CQM{JF8j{@k|Y>tTU zW9Rg2MB``1Vh%OH5tgCkb}d%*$|#Rxv)9uZE~3EOMFzehIvzIDcC58^c=$>$iUhh&2W)g1{qYLu!?1r?5#Uu1q$H56D<(u+~EM=Ky#=|vRfy|rkbXl); zD9zW%Is&(~lh$Mk_P$rQ2EpO>k&?WG~bza=j0 zzF~G12qX7KP%VCiKKb+lbRa0}|3Dz!+8H1HGuiro;=!0TqJO4-cmAY)lji=Qeu2ov zv$6WRhI`%+uIkSs2|S`LL@lBbwt|^crC4`&$rt$fMN&k`qw%!eJQ5(h3th^#Epfek zAowkNE7v8x8@*BldDyoaVns!e#so%jRWexcHf#)6whwyEmkmPuOS)YK4+K>m!+fYS zBm5%oN#rnu00~aLK1jRgz%T&~hirgU@UZNMb~vZ`kPtiaSlf+ri*!R>lW8sa^!%$J zQ?-`!R&BQV`OmD1Y+01f#v|mIKOkWwYHwh+g%>&tl$mK^7qyE?v#aS z`y=Ay)v)oF1KVMD?M~g9_CCMF`Z}RfXQ!Wk-Etr?U*jIeA|>7_k&JbLl$p7#qN|vM zWdDkz&`XYo``yZeNLg@@hFt(ga|>uF$U5R>XXfO_!WIsv#7}bixHM6BdA$4ym3e-o zpbSzsj(}-xaLiqwRT;;*I67PZ2Vo_5V)c59N`2fMRuYZQSIjjuD$z7ZiG#eGZ=0>b zvtdyI#)2mlsZcW^JhbZD?w<~DiuIokaNvJ;fUAG~CkGgP0Dfyy*LM8x4zT3wKRUpQ zVN6y*q51WsHhdS(fRQ80xO~!!E=tQU7Ga!Q{9B?uBsV|hKiIIL0t=rAb5i9rTUN3()0XgMf1w;MU^T)E{Hg+Z*g)JrH z?t(t{5+%QK%tQ&nL`Fm#m0IjIm0WDSHhw7rZ%+@L92S~QFF2wj)>iM&V9-Q280znD z%!Knr9q%>9Q*cx+^CQL)QHk!wIMfG3q)pmH=(0`IpbJ&{j#MzVkj^zA&9=r=nwVZl z0YJUV@JaNmX`bDzTO((AokgjN&SI*BQi5l?@P>u$IoK9yVDR;?^I0X<_FgWXS2}@d z-t&FtjpOx9q{YnT%mR~UYTEKD{gI0IyI>H|N*6#{kHLJ`Cv zCnOsY{8*qP%DM|GAk&b+0r%71z@wW&KOmYS&@y$l(k7t-ZDni{7EAJGm~!K{MSt3* z4GE!s&v7Np!YEs$^pG2r5>FlR5K3umy^o|0ROaXJlY*TeY zlS2hBv%wDe_iRvR7}hhJ!U-?eEv-tNC<}b7qUTf)G0OW$xvjzLplV(l`*N%U0Mnt7 zw56CsjopE$M%iTwYh!pliadCEWn&N&VLG3O!$>AQ*p@p)1@dyJQepG4(MbW&t_S#b z7J;Vo3bkmw@2p<`yE&~8wOb44NoIsx5!1wVsXa8$NI#8D(XnnEA>!oGuVQ4J0-M(1 zcE}@YI=9cOq!Z}rMZ46K@-UQzD4zySIKUR{CWxL1mdgXH`*kX{@tiQ6P~nD$qZX`w zhl8xfYF1QP<6pYCBYQEj@=ZFYQ3aa@Y?8+$cE2ih;7W!2#*9W-Xst|ydRyW<1}3yk zTBu`$%@b9~v@X%as$D;wkF#<{v^{u{^kLsCU+(Qa7)@r>|5D;<^rg((O~((NnioUY z>jiHB5mZ2x1kBSx_J2$S6t`xv{vrN`uMlynK#i+g5yX1cPh*%w-xJ=)M6aY^%Y6 z=N0fyOH*id!|X@6+m2pB3msPuJevTXq4hc-4hZX5A=Gpy^o_jw5#Yv{ zF=pIq#~Rl?=tk!|X&T5NCiwu2={Bc7JyR*>pEcG|Hg7Sbx!oMTq$PWn>sT&1p#&kO z03zW%ADAS-uBF-w_~jpbVcT5mBGUBwzkK0i$xmN+wDteY7Y0x;X?C;?H)5`zzFLgdw&+6yEbhAyuN_t-i&z@;t5Y9<^_sh9oRpUL7RV126fVHo?^F{MP{s#t6S?xMHDA7K9nE?P%uj%3FU?Yf!~Df!;2V_!Oed(ROq9d z(1^s--l?~bf{7W{NPKL`s{ZG*#nhH9#9GV^LSZykf$F8TUwI3SB zB{%l8P=;7>vjV*cRJIthm~431VNXU|KUUA=`%t8I?`eeYHMv8u9;C8HltkAzQ$hk% zeh-x3b|@pI>b6FL$|3qW4(wc1+BU;;y~Dg1_{tHAr(kVZi`5?At-^I7R5U|Y`1b|S z)$VSEW=g$v9A07iwPyd&vLN4_TEKG>FA^-yRWfdZ50{jvIAS);b*ar>L(M}W)%2iX zFbqo29DU2;=3`7GhG+;mO6Di|AXQ#%KDHd{bn;T*{PHK?Jj8)Z7Ra*iaZvh+PmDIn z90cFff+!P)@`HhCJYoxmpBPseNiqQ7TiVtrf8bZqK@~i?!~QC<^3F9*L;Y_Gaf);k zF|P+y!o=ux&q!!pT!Jw2*k1hBA6;T7rhg`3Z`HngAv4*i~PZ?(nbb zsHf}LSf+6Z3X^uC%J{1vw>e2|>e6+DEx5%F28HGc1w6KEv0o}jc-wn_d{6VX78|jr z+MDri5C?$Zbe7A(LJy%_bfT7$4){`67_oPhu2dEe$zP-`0jR@&J0nWPO>5YEQB~z) zAJbkp5SUvuitgJ~g5xa55h$Rv>f5R}E;M;JboKQ=8N`KN4dSlPm=R#!Ik;p~cmcd) zgRj@)Ps^*J+fS>D7b7r_)9IZOfl%<;A5EiEDUdap@ZJSw=uQP38RxN?DTO=P>c?IK z)kBpXe;LGFGuuGm7g1+-u%ohga1@hc7e%n3S~YdtTDo|XTTgfWP}j5^*PWA|&K_=d zum2DbPDXmT+<(5SzA@rd1Y<>XaMZOqMO_a{)S!BVNG&-t~LdMV?VNHM0gC>yt?GWd} z5M?<3TSwR|dg;OqbAwltrp9>5abo{xM`(~2L-@b$2!ZoyUeL$-$$Wne4&UhrKota9 zO=xAbzd1Po0Fx?kjT3Hh5`$_70om8}g(ahddxGSKy|TmY%4m@Rx{c~$UuYm20t{s& z4k#_-+|i`^Q55my3X%ebM#3IYp#oSxF;v<=PqTk4UBA0LU%l$Vtvuem?sRUrw_Lt+ zyj^bJ{_1~P7QR>qyV!4Stel{o*lhRLs%)Qa{Mdbacv@BBqy>=SW$9L0qUe3pi6Zbp zxIp3nwP20<(p77hd%-+YKA2nN-D8Udzld*zOFSEO)+ItkVN3#9s52lHC?4x$nZXlT zlsfniZJ;pwKeT~x`Tx)co*hB8Uq^ug{+ zeSyuof2f6%UUHfcRY7cj5m1ADfq&UU>g61cUDK(GT&O1&IOONv*?*%eAh|@;qB9(s z`iC^|gaCYr3YWUViGX17^zRPwiR5pG81=V9%&h`I_;AIhII`+qpEbCGw>Xi+Q zmo{-#SPiO~n35h7hq~tt`KXj3G;xS9Zt@WYzer>kz z?*1)3+IcJVu#ZWJy0crjh>E%$f2Dk5M`2|c>>O7;rx;t!^`-;K$ql4rML^Zb-ZPj3 z0U?AfwYPDj2s8fRc0af~M|_)q1}eneJW2AR_5~$&ODf4mb++(zK@NqRBM!&@ZoNv=X%gQyuLwk8d))f_Eg}#51#IaP< z`|YP_LI9ciTM?jK~g=<%RRHFGYo3A6HQjW~uE{2vQ&M0Js9n+Dw3DVV{o zoEkaUHh3h>xW@r1QleT|pUTB)D-N`&ln2Uibp)}Bw2EC62i82V2_Y`ACdcnw=)FE6QO-x|ZA&?+8z#Wv+J#waaRNu9IlE^ayAec$wHIQU5O ze%sbM{AUQ8?rlKnA;jSpXk!9cTIoY-|IIjxeSaM$G5-?Y#m3v!fw|N3yW8XO?((G- znibc99KhEqMKy-Dw7D6i8)6XT@L3PKRv4r<`1^7Lv-q_=;&FE^0yb%sgV3a=6lr6o zL--fvVamBJ!DUvzgGnJAzD99OyQ0)wm<3IK>;gplV16HKeuCDVD6GubA>9O;16J-i zG=xoNAc7{7^O*m$QDRUI94EH8hPxtrh+Z|}$+V5F$ ztCbMRoq89mz=2}$IbSq{y_w09*U;8gDhXPbs6W4gILzQTpmk4-4_Llca5hqM zpmjtJH`}#k*tqq=Gu}l@=T-Mn<|-S|whZaY;HASnkNIDsjwa*m)ZM>k6mF9=M}PPX zeiYD5H8YYzkn?1PS+&Vp?`{Uz%sfnhsAwQ(J=BAMnJ(1rp{(<>JJtii!N}{AuHv6N zNfMp=ImP#9K_&W!=}X_gw?Pb1(^Ly)5E>$m>BJQe+M;pVqaPeRpnO`wj%X1hG8oVe zV-WM+^bS^F#g*uy;XpAa_@dVbGVcno12X!Z)VooJOL8bD3EFlQi6;W4_`xR=)MiSK z5{O_fIT}^2-@b|hZ)Twk1FZ;KsI$4>$r=2N41}|ckuCn7yz)E-wRbQSo>>yT2I6K) zSv(#bsBiF&XBK##zKq_+4XeeG{l3ci(rN7X)GGv~nyqZ^vyf?{K z2xOW$5yo-R7L#ozwt~*?sgBO!Sr(@GW%dg?mnSwx=gh|mkQcW-2(RWK4g8}X;^)mU zLL_SOXdZ|nV2FQU!l$fN4+%Xs#gWZ4Wr^(LmEsqa(=Ax(i&GYw`CGD|%frjp2&meJlLH7~FPE9+sVqjIZ9|{ShQs4}W?Sl!&B&*z?;Hwu~AFg)8QBK#gS; zxoQBQ-?vgRw3uwloqcbtsWOWlqFGG9o8*`hoL4?;&?{#E|2A%EYsOlSQJ}+1mpU@L zmev}X`m=N$3u|WlIc0GWT`$`L;dDl9(ap9`57lq7oak1J)l#E{*wL7yb>aR@4v@xo zoA<>rzT(w8;wU@gjLoFdk zz7c0A(1p>9^{CB(Uu-RRdvRCg)FnH=kSfbJx-2}=7JBFg4gxOUWQ1~Q&H1#7h{i?f zKr#x;q7T9ut@574WMRIUzUm#zlVA@fZGlYNjAlGHo|%5NLAjN$Z)3t1C8&f%QiYT6 zeMU-lkX7j7@)m^uxOS#f{N}K4Ka=4qJjP*UIiDH!Ya9X^2&qr>tWcqj$depQs0_{P z3jw`)xhWuN`~JuXDEos;tl{&wMmWZ<$exI)) z1^sd;13zMRQw+cBy3z!Tze* z^3{XtX#{?jgwCMCt1p#qT;dB{$~0)mZieVWNX}FlrhOkQXbwApY~B~Di^7zkMT_2= z=&-gYtu@V2fvIJSD5_d4i5P&dC>r__FATY&KQm^XG9ePb59`~=`4 zxjv47q|!fF(r?Sk2`72ua`%il&TI3ek{ipS=TANWopo;5TedC2*W(7@BUFY`!ij+p zHAZtriS|h1LebRnboxL9=tRF8%Bpy!Wd!q|6OFGUzMLhY__Yep%d0E{W@D|6)7J^r zd^_iglDB;qCV-ks;6r-F0dYk(%Eb!`C~f9nAKF&3mqe>=eUSP-(-hp}gPLux3$eIk}k+_W4dUl2wXzARMKlV>-Id2&9c$oLH#H4A@|W3((%s(=GrSwDxfB`W#nyb*0tnR{Q`e zVSb|&4j1lkTHMGiM(uRp^+{b(td3SoN((B~j|&>I3!9>Teb}E^qd2Wne!gD>uJgyK z@_-B4CPx855O<-|(}R z*I|qst2#O$@OI{yL6P$Nz)TT|wu{6g@E@%eBW~B{+s8j|6g|2`)413~=Cb}Z*-QUy zMtTMGGlRjRCbOSE2mSIh`J-Z&SkV63@IT3)NVLl#r?1uKXz_sv`gtoFL z_gyVYC36rfA}1EQddcoS*~{xr@cEz9a`I_+q6Xc1@B+Xp!5PBiTU~^okW+A<59hIw z*car7qi^1A?LTO1(PC`=DE}JRfZ3n)^cL(|XxGxmj}b(YaY=!Rx#|^-6;)k}2mykOb z;>W;e1jrF5{6_?6eC^3ZckV%L zP1erI?she_P+woh1aj?m>uC9kR(LWp^TVMmx)+4q8a7>QxHSZmfLNyweb86rtvCZZRg3Q-} zb=o7v@0jB{k$=VKQCy27<9R#G4UAwG)wAXra6z{f+fbu)&5&*M~MlYH>gK0MX zke9i&+v}@iBbLPc-a7!!uQZjdd(H?P7E2OtJs#{6b#?r-25nY?ep})NRK)5; ApplicationsTransport: - """Returns the transport used by the client instance. - - Returns: - ApplicationsTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(ApplicationsClient).get_transport_class, type(ApplicationsClient) - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ApplicationsTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the applications client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.ApplicationsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = ApplicationsClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def get_application( - self, - request: Optional[Union[appengine.GetApplicationRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> application.Application: - r"""Gets information about an application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_get_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetApplicationRequest( - ) - - # Make the request - response = await client.get_application(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]]): - The request object. Request message for ``Applications.GetApplication``. - name (:class:`str`): - Name of the Application resource to get. Example: - ``apps/myapp``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Application: - An Application resource contains the - top-level configuration of an App Engine - application. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = appengine.GetApplicationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_application, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_application( - self, - request: Optional[Union[appengine.CreateApplicationRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Creates an App Engine application for a Google Cloud Platform - project. Required fields: - - - ``id`` - The ID of the target Cloud Platform project. - - *location* - The - `region `__ - where you want the App Engine application located. - - For more information about App Engine applications, see - `Managing Projects, Applications, and - Billing `__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_create_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateApplicationRequest( - ) - - # Make the request - operation = client.create_application(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]]): - The request object. Request message for ``Applications.CreateApplication``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App - Engine application. - - """ - # Create or coerce a protobuf request object. - request = appengine.CreateApplicationRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_application, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - application.Application, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def update_application( - self, - request: Optional[Union[appengine.UpdateApplicationRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the specified Application resource. You can update the - following fields: - - - ``auth_domain`` - Google authentication domain for - controlling user access to the application. - - ``default_cookie_expiration`` - Cookie expiration policy for - the application. - - ``iap`` - Identity-Aware Proxy properties for the - application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_update_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateApplicationRequest( - ) - - # Make the request - operation = client.update_application(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]]): - The request object. Request message for ``Applications.UpdateApplication``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App - Engine application. - - """ - # Create or coerce a protobuf request object. - request = appengine.UpdateApplicationRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_application, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - application.Application, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def repair_application( - self, - request: Optional[Union[appengine.RepairApplicationRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Recreates the required App Engine features for the specified App - Engine application, for example a Cloud Storage bucket or App - Engine service account. Use this method if you receive an error - message about a missing feature, for example, *Error retrieving - the App Engine service account*. If you have deleted your App - Engine service account, this will not be able to recreate it. - Instead, you should attempt to use the IAM undelete API if - possible at - https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete?apix_params=%7B"name"%3A"projects%2F-%2FserviceAccounts%2Funique_id"%2C"resource"%3A%7B%7D%7D - . If the deletion was recent, the numeric ID can be found in the - Cloud Console Activity Log. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_repair_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.RepairApplicationRequest( - ) - - # Make the request - operation = client.repair_application(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.RepairApplicationRequest, dict]]): - The request object. Request message for - 'Applications.RepairApplication'. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App - Engine application. - - """ - # Create or coerce a protobuf request object. - request = appengine.RepairApplicationRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.repair_application, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - application.Application, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "ApplicationsAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("ApplicationsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py deleted file mode 100644 index f75c702..0000000 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ /dev/null @@ -1,848 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import duration_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, application -from google.cloud.appengine_admin_v1.types import operation as ga_operation - -from .transports.base import DEFAULT_CLIENT_INFO, ApplicationsTransport -from .transports.grpc import ApplicationsGrpcTransport -from .transports.grpc_asyncio import ApplicationsGrpcAsyncIOTransport -from .transports.rest import ApplicationsRestTransport - - -class ApplicationsClientMeta(type): - """Metaclass for the Applications client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = OrderedDict() # type: Dict[str, Type[ApplicationsTransport]] - _transport_registry["grpc"] = ApplicationsGrpcTransport - _transport_registry["grpc_asyncio"] = ApplicationsGrpcAsyncIOTransport - _transport_registry["rest"] = ApplicationsRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[ApplicationsTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ApplicationsClient(metaclass=ApplicationsClientMeta): - """Manages App Engine applications.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - ApplicationsClient: 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 - 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: - ApplicationsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ApplicationsTransport: - """Returns the transport used by the client instance. - - Returns: - ApplicationsTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, ApplicationsTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the applications client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ApplicationsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ApplicationsTransport): - # transport is a ApplicationsTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def get_application( - self, - request: Optional[Union[appengine.GetApplicationRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> application.Application: - r"""Gets information about an application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_get_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetApplicationRequest( - ) - - # Make the request - response = client.get_application(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]): - The request object. Request message for ``Applications.GetApplication``. - name (str): - Name of the Application resource to get. Example: - ``apps/myapp``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Application: - An Application resource contains the - top-level configuration of an App Engine - application. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a appengine.GetApplicationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.GetApplicationRequest): - request = appengine.GetApplicationRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_application] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_application( - self, - request: Optional[Union[appengine.CreateApplicationRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Creates an App Engine application for a Google Cloud Platform - project. Required fields: - - - ``id`` - The ID of the target Cloud Platform project. - - *location* - The - `region `__ - where you want the App Engine application located. - - For more information about App Engine applications, see - `Managing Projects, Applications, and - Billing `__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_create_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateApplicationRequest( - ) - - # Make the request - operation = client.create_application(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]): - The request object. Request message for ``Applications.CreateApplication``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App - Engine application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.CreateApplicationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.CreateApplicationRequest): - request = appengine.CreateApplicationRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_application] - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - application.Application, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def update_application( - self, - request: Optional[Union[appengine.UpdateApplicationRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Updates the specified Application resource. You can update the - following fields: - - - ``auth_domain`` - Google authentication domain for - controlling user access to the application. - - ``default_cookie_expiration`` - Cookie expiration policy for - the application. - - ``iap`` - Identity-Aware Proxy properties for the - application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_update_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateApplicationRequest( - ) - - # Make the request - operation = client.update_application(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]): - The request object. Request message for ``Applications.UpdateApplication``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App - Engine application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.UpdateApplicationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.UpdateApplicationRequest): - request = appengine.UpdateApplicationRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_application] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - application.Application, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def repair_application( - self, - request: Optional[Union[appengine.RepairApplicationRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Recreates the required App Engine features for the specified App - Engine application, for example a Cloud Storage bucket or App - Engine service account. Use this method if you receive an error - message about a missing feature, for example, *Error retrieving - the App Engine service account*. If you have deleted your App - Engine service account, this will not be able to recreate it. - Instead, you should attempt to use the IAM undelete API if - possible at - https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete?apix_params=%7B"name"%3A"projects%2F-%2FserviceAccounts%2Funique_id"%2C"resource"%3A%7B%7D%7D - . If the deletion was recent, the numeric ID can be found in the - Cloud Console Activity Log. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_repair_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.RepairApplicationRequest( - ) - - # Make the request - operation = client.repair_application(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.RepairApplicationRequest, dict]): - The request object. Request message for - 'Applications.RepairApplication'. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App - Engine application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.RepairApplicationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.RepairApplicationRequest): - request = appengine.RepairApplicationRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.repair_application] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - application.Application, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "ApplicationsClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("ApplicationsClient",) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py b/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py deleted file mode 100644 index ed14eb7..0000000 --- a/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import ApplicationsTransport -from .grpc import ApplicationsGrpcTransport -from .grpc_asyncio import ApplicationsGrpcAsyncIOTransport -from .rest import ApplicationsRestInterceptor, ApplicationsRestTransport - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[ApplicationsTransport]] -_transport_registry["grpc"] = ApplicationsGrpcTransport -_transport_registry["grpc_asyncio"] = ApplicationsGrpcAsyncIOTransport -_transport_registry["rest"] = ApplicationsRestTransport - -__all__ = ( - "ApplicationsTransport", - "ApplicationsGrpcTransport", - "ApplicationsGrpcAsyncIOTransport", - "ApplicationsRestTransport", - "ApplicationsRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/base.py b/google/cloud/appengine_admin_v1/services/applications/transports/base.py deleted file mode 100644 index 043a148..0000000 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ /dev/null @@ -1,207 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1, operations_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine, application - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class ApplicationsTransport(abc.ABC): - """Abstract transport class for Applications.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.get_application: gapic_v1.method.wrap_method( - self.get_application, - default_timeout=None, - client_info=client_info, - ), - self.create_application: gapic_v1.method.wrap_method( - self.create_application, - default_timeout=None, - client_info=client_info, - ), - self.update_application: gapic_v1.method.wrap_method( - self.update_application, - default_timeout=None, - client_info=client_info, - ), - self.repair_application: gapic_v1.method.wrap_method( - self.repair_application, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def get_application( - self, - ) -> Callable[ - [appengine.GetApplicationRequest], - Union[application.Application, Awaitable[application.Application]], - ]: - raise NotImplementedError() - - @property - def create_application( - self, - ) -> Callable[ - [appengine.CreateApplicationRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def update_application( - self, - ) -> Callable[ - [appengine.UpdateApplicationRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def repair_application( - self, - ) -> Callable[ - [appengine.RepairApplicationRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("ApplicationsTransport",) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py deleted file mode 100644 index 7a2e8f1..0000000 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ /dev/null @@ -1,387 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers, operations_v1 -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, application - -from .base import DEFAULT_CLIENT_INFO, ApplicationsTransport - - -class ApplicationsGrpcTransport(ApplicationsTransport): - """gRPC backend transport for Applications. - - Manages App Engine applications. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient(self.grpc_channel) - - # Return the client from cache. - return self._operations_client - - @property - def get_application( - self, - ) -> Callable[[appengine.GetApplicationRequest], application.Application]: - r"""Return a callable for the get application method over gRPC. - - Gets information about an application. - - Returns: - Callable[[~.GetApplicationRequest], - ~.Application]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_application" not in self._stubs: - self._stubs["get_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/GetApplication", - request_serializer=appengine.GetApplicationRequest.serialize, - response_deserializer=application.Application.deserialize, - ) - return self._stubs["get_application"] - - @property - def create_application( - self, - ) -> Callable[[appengine.CreateApplicationRequest], operations_pb2.Operation]: - r"""Return a callable for the create application method over gRPC. - - Creates an App Engine application for a Google Cloud Platform - project. Required fields: - - - ``id`` - The ID of the target Cloud Platform project. - - *location* - The - `region `__ - where you want the App Engine application located. - - For more information about App Engine applications, see - `Managing Projects, Applications, and - Billing `__. - - Returns: - Callable[[~.CreateApplicationRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_application" not in self._stubs: - self._stubs["create_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/CreateApplication", - request_serializer=appengine.CreateApplicationRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["create_application"] - - @property - def update_application( - self, - ) -> Callable[[appengine.UpdateApplicationRequest], operations_pb2.Operation]: - r"""Return a callable for the update application method over gRPC. - - Updates the specified Application resource. You can update the - following fields: - - - ``auth_domain`` - Google authentication domain for - controlling user access to the application. - - ``default_cookie_expiration`` - Cookie expiration policy for - the application. - - ``iap`` - Identity-Aware Proxy properties for the - application. - - Returns: - Callable[[~.UpdateApplicationRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_application" not in self._stubs: - self._stubs["update_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/UpdateApplication", - request_serializer=appengine.UpdateApplicationRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_application"] - - @property - def repair_application( - self, - ) -> Callable[[appengine.RepairApplicationRequest], operations_pb2.Operation]: - r"""Return a callable for the repair application method over gRPC. - - Recreates the required App Engine features for the specified App - Engine application, for example a Cloud Storage bucket or App - Engine service account. Use this method if you receive an error - message about a missing feature, for example, *Error retrieving - the App Engine service account*. If you have deleted your App - Engine service account, this will not be able to recreate it. - Instead, you should attempt to use the IAM undelete API if - possible at - https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete?apix_params=%7B"name"%3A"projects%2F-%2FserviceAccounts%2Funique_id"%2C"resource"%3A%7B%7D%7D - . If the deletion was recent, the numeric ID can be found in the - Cloud Console Activity Log. - - Returns: - Callable[[~.RepairApplicationRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "repair_application" not in self._stubs: - self._stubs["repair_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/RepairApplication", - request_serializer=appengine.RepairApplicationRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["repair_application"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("ApplicationsGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py deleted file mode 100644 index 9013cf1..0000000 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py +++ /dev/null @@ -1,396 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, application - -from .base import DEFAULT_CLIENT_INFO, ApplicationsTransport -from .grpc import ApplicationsGrpcTransport - - -class ApplicationsGrpcAsyncIOTransport(ApplicationsTransport): - """gRPC AsyncIO backend transport for Applications. - - Manages App Engine applications. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def get_application( - self, - ) -> Callable[ - [appengine.GetApplicationRequest], Awaitable[application.Application] - ]: - r"""Return a callable for the get application method over gRPC. - - Gets information about an application. - - Returns: - Callable[[~.GetApplicationRequest], - Awaitable[~.Application]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_application" not in self._stubs: - self._stubs["get_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/GetApplication", - request_serializer=appengine.GetApplicationRequest.serialize, - response_deserializer=application.Application.deserialize, - ) - return self._stubs["get_application"] - - @property - def create_application( - self, - ) -> Callable[ - [appengine.CreateApplicationRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the create application method over gRPC. - - Creates an App Engine application for a Google Cloud Platform - project. Required fields: - - - ``id`` - The ID of the target Cloud Platform project. - - *location* - The - `region `__ - where you want the App Engine application located. - - For more information about App Engine applications, see - `Managing Projects, Applications, and - Billing `__. - - Returns: - Callable[[~.CreateApplicationRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_application" not in self._stubs: - self._stubs["create_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/CreateApplication", - request_serializer=appengine.CreateApplicationRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["create_application"] - - @property - def update_application( - self, - ) -> Callable[ - [appengine.UpdateApplicationRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the update application method over gRPC. - - Updates the specified Application resource. You can update the - following fields: - - - ``auth_domain`` - Google authentication domain for - controlling user access to the application. - - ``default_cookie_expiration`` - Cookie expiration policy for - the application. - - ``iap`` - Identity-Aware Proxy properties for the - application. - - Returns: - Callable[[~.UpdateApplicationRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_application" not in self._stubs: - self._stubs["update_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/UpdateApplication", - request_serializer=appengine.UpdateApplicationRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_application"] - - @property - def repair_application( - self, - ) -> Callable[ - [appengine.RepairApplicationRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the repair application method over gRPC. - - Recreates the required App Engine features for the specified App - Engine application, for example a Cloud Storage bucket or App - Engine service account. Use this method if you receive an error - message about a missing feature, for example, *Error retrieving - the App Engine service account*. If you have deleted your App - Engine service account, this will not be able to recreate it. - Instead, you should attempt to use the IAM undelete API if - possible at - https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete?apix_params=%7B"name"%3A"projects%2F-%2FserviceAccounts%2Funique_id"%2C"resource"%3A%7B%7D%7D - . If the deletion was recent, the numeric ID can be found in the - Cloud Console Activity Log. - - Returns: - Callable[[~.RepairApplicationRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "repair_application" not in self._stubs: - self._stubs["repair_application"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Applications/RepairApplication", - request_serializer=appengine.RepairApplicationRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["repair_application"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("ApplicationsGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py b/google/cloud/appengine_admin_v1/services/applications/transports/rest.py deleted file mode 100644 index ce1e18a..0000000 --- a/google/cloud/appengine_admin_v1/services/applications/transports/rest.py +++ /dev/null @@ -1,722 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import ( - gapic_v1, - operations_v1, - path_template, - rest_helpers, - rest_streaming, -) -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.longrunning import operations_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, application - -from .base import ApplicationsTransport -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class ApplicationsRestInterceptor: - """Interceptor for Applications. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the ApplicationsRestTransport. - - .. code-block:: python - class MyCustomApplicationsInterceptor(ApplicationsRestInterceptor): - def pre_create_application(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_create_application(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_application(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_application(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_repair_application(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_repair_application(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_application(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_application(self, response): - logging.log(f"Received response: {response}") - return response - - transport = ApplicationsRestTransport(interceptor=MyCustomApplicationsInterceptor()) - client = ApplicationsClient(transport=transport) - - - """ - - def pre_create_application( - self, - request: appengine.CreateApplicationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.CreateApplicationRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for create_application - - Override in a subclass to manipulate the request or metadata - before they are sent to the Applications server. - """ - return request, metadata - - def post_create_application( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for create_application - - Override in a subclass to manipulate the response - after it is returned by the Applications server but before - it is returned to user code. - """ - return response - - def pre_get_application( - self, - request: appengine.GetApplicationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.GetApplicationRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_application - - Override in a subclass to manipulate the request or metadata - before they are sent to the Applications server. - """ - return request, metadata - - def post_get_application( - self, response: application.Application - ) -> application.Application: - """Post-rpc interceptor for get_application - - Override in a subclass to manipulate the response - after it is returned by the Applications server but before - it is returned to user code. - """ - return response - - def pre_repair_application( - self, - request: appengine.RepairApplicationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.RepairApplicationRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for repair_application - - Override in a subclass to manipulate the request or metadata - before they are sent to the Applications server. - """ - return request, metadata - - def post_repair_application( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for repair_application - - Override in a subclass to manipulate the response - after it is returned by the Applications server but before - it is returned to user code. - """ - return response - - def pre_update_application( - self, - request: appengine.UpdateApplicationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.UpdateApplicationRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for update_application - - Override in a subclass to manipulate the request or metadata - before they are sent to the Applications server. - """ - return request, metadata - - def post_update_application( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for update_application - - Override in a subclass to manipulate the response - after it is returned by the Applications server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class ApplicationsRestStub: - _session: AuthorizedSession - _host: str - _interceptor: ApplicationsRestInterceptor - - -class ApplicationsRestTransport(ApplicationsTransport): - """REST backend transport for Applications. - - Manages App Engine applications. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[ApplicationsRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or ApplicationsRestInterceptor() - self._prep_wrapped_messages(client_info) - - @property - def operations_client(self) -> operations_v1.AbstractOperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Only create a new client if we do not already have one. - if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = { - "google.longrunning.Operations.GetOperation": [ - { - "method": "get", - "uri": "/v1/{name=apps/*/operations/*}", - }, - ], - "google.longrunning.Operations.ListOperations": [ - { - "method": "get", - "uri": "/v1/{name=apps/*}/operations", - }, - ], - } - - rest_transport = operations_v1.OperationsRestTransport( - host=self._host, - # use the credentials which are saved - credentials=self._credentials, - scopes=self._scopes, - http_options=http_options, - path_prefix="v1", - ) - - self._operations_client = operations_v1.AbstractOperationsClient( - transport=rest_transport - ) - - # Return the client from cache. - return self._operations_client - - class _CreateApplication(ApplicationsRestStub): - def __hash__(self): - return hash("CreateApplication") - - def __call__( - self, - request: appengine.CreateApplicationRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the create application method over HTTP. - - Args: - request (~.appengine.CreateApplicationRequest): - The request object. Request message for ``Applications.CreateApplication``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/apps", - "body": "application", - }, - ] - request, metadata = self._interceptor.pre_create_application( - request, metadata - ) - pb_request = appengine.CreateApplicationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_application(resp) - return resp - - class _GetApplication(ApplicationsRestStub): - def __hash__(self): - return hash("GetApplication") - - def __call__( - self, - request: appengine.GetApplicationRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> application.Application: - r"""Call the get application method over HTTP. - - Args: - request (~.appengine.GetApplicationRequest): - The request object. Request message for ``Applications.GetApplication``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.application.Application: - An Application resource contains the - top-level configuration of an App Engine - application. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{name=apps/*}", - }, - ] - request, metadata = self._interceptor.pre_get_application(request, metadata) - pb_request = appengine.GetApplicationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = application.Application() - pb_resp = application.Application.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_application(resp) - return resp - - class _RepairApplication(ApplicationsRestStub): - def __hash__(self): - return hash("RepairApplication") - - def __call__( - self, - request: appengine.RepairApplicationRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the repair application method over HTTP. - - Args: - request (~.appengine.RepairApplicationRequest): - The request object. Request message for - 'Applications.RepairApplication'. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/{name=apps/*}:repair", - "body": "*", - }, - ] - request, metadata = self._interceptor.pre_repair_application( - request, metadata - ) - pb_request = appengine.RepairApplicationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_repair_application(resp) - return resp - - class _UpdateApplication(ApplicationsRestStub): - def __hash__(self): - return hash("UpdateApplication") - - def __call__( - self, - request: appengine.UpdateApplicationRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the update application method over HTTP. - - Args: - request (~.appengine.UpdateApplicationRequest): - The request object. Request message for ``Applications.UpdateApplication``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "patch", - "uri": "/v1/{name=apps/*}", - "body": "application", - }, - ] - request, metadata = self._interceptor.pre_update_application( - request, metadata - ) - pb_request = appengine.UpdateApplicationRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_application(resp) - return resp - - @property - def create_application( - self, - ) -> Callable[[appengine.CreateApplicationRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CreateApplication(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_application( - self, - ) -> Callable[[appengine.GetApplicationRequest], application.Application]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetApplication(self._session, self._host, self._interceptor) # type: ignore - - @property - def repair_application( - self, - ) -> Callable[[appengine.RepairApplicationRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._RepairApplication(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_application( - self, - ) -> Callable[[appengine.UpdateApplicationRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateApplication(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("ApplicationsRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py deleted file mode 100644 index 46a8c71..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .async_client import AuthorizedCertificatesAsyncClient -from .client import AuthorizedCertificatesClient - -__all__ = ( - "AuthorizedCertificatesClient", - "AuthorizedCertificatesAsyncClient", -) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py deleted file mode 100644 index 78401e9..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py +++ /dev/null @@ -1,656 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import functools -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core.client_options import ClientOptions -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.protobuf import timestamp_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.authorized_certificates import pagers -from google.cloud.appengine_admin_v1.types import appengine, certificate - -from .client import AuthorizedCertificatesClient -from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport -from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport - - -class AuthorizedCertificatesAsyncClient: - """Manages SSL certificates a user is authorized to administer. - A user can administer any SSL certificates applicable to their - authorized domains. - """ - - _client: AuthorizedCertificatesClient - - DEFAULT_ENDPOINT = AuthorizedCertificatesClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = AuthorizedCertificatesClient.DEFAULT_MTLS_ENDPOINT - - common_billing_account_path = staticmethod( - AuthorizedCertificatesClient.common_billing_account_path - ) - parse_common_billing_account_path = staticmethod( - AuthorizedCertificatesClient.parse_common_billing_account_path - ) - common_folder_path = staticmethod(AuthorizedCertificatesClient.common_folder_path) - parse_common_folder_path = staticmethod( - AuthorizedCertificatesClient.parse_common_folder_path - ) - common_organization_path = staticmethod( - AuthorizedCertificatesClient.common_organization_path - ) - parse_common_organization_path = staticmethod( - AuthorizedCertificatesClient.parse_common_organization_path - ) - common_project_path = staticmethod(AuthorizedCertificatesClient.common_project_path) - parse_common_project_path = staticmethod( - AuthorizedCertificatesClient.parse_common_project_path - ) - common_location_path = staticmethod( - AuthorizedCertificatesClient.common_location_path - ) - parse_common_location_path = staticmethod( - AuthorizedCertificatesClient.parse_common_location_path - ) - - @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: - AuthorizedCertificatesAsyncClient: The constructed client. - """ - return AuthorizedCertificatesClient.from_service_account_info.__func__(AuthorizedCertificatesAsyncClient, 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: - AuthorizedCertificatesAsyncClient: The constructed client. - """ - return AuthorizedCertificatesClient.from_service_account_file.__func__(AuthorizedCertificatesAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return AuthorizedCertificatesClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> AuthorizedCertificatesTransport: - """Returns the transport used by the client instance. - - Returns: - AuthorizedCertificatesTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(AuthorizedCertificatesClient).get_transport_class, - type(AuthorizedCertificatesClient), - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, AuthorizedCertificatesTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the authorized certificates client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.AuthorizedCertificatesTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = AuthorizedCertificatesClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def list_authorized_certificates( - self, - request: Optional[ - Union[appengine.ListAuthorizedCertificatesRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAuthorizedCertificatesAsyncPager: - r"""Lists all SSL certificates the user is authorized to - administer. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_list_authorized_certificates(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedCertificatesRequest( - ) - - # Make the request - page_result = client.list_authorized_certificates(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]]): - The request object. Request message for - ``AuthorizedCertificates.ListAuthorizedCertificates``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.authorized_certificates.pagers.ListAuthorizedCertificatesAsyncPager: - Response message for - AuthorizedCertificates.ListAuthorizedCertificates. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = appengine.ListAuthorizedCertificatesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_authorized_certificates, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListAuthorizedCertificatesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_authorized_certificate( - self, - request: Optional[ - Union[appengine.GetAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Gets the specified SSL certificate. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_get_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetAuthorizedCertificateRequest( - ) - - # Make the request - response = await client.get_authorized_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]]): - The request object. Request message for - ``AuthorizedCertificates.GetAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - # Create or coerce a protobuf request object. - request = appengine.GetAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_authorized_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_authorized_certificate( - self, - request: Optional[ - Union[appengine.CreateAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Uploads the specified SSL certificate. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_create_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateAuthorizedCertificateRequest( - ) - - # Make the request - response = await client.create_authorized_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]]): - The request object. Request message for - ``AuthorizedCertificates.CreateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - # Create or coerce a protobuf request object. - request = appengine.CreateAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_authorized_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_authorized_certificate( - self, - request: Optional[ - Union[appengine.UpdateAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Updates the specified SSL certificate. To renew a certificate - and maintain its existing domain mappings, update - ``certificate_data`` with a new certificate. The new certificate - must be applicable to the same domains as the original - certificate. The certificate ``display_name`` may also be - updated. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_update_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateAuthorizedCertificateRequest( - ) - - # Make the request - response = await client.update_authorized_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]]): - The request object. Request message for - ``AuthorizedCertificates.UpdateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - # Create or coerce a protobuf request object. - request = appengine.UpdateAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_authorized_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_authorized_certificate( - self, - request: Optional[ - Union[appengine.DeleteAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the specified SSL certificate. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_delete_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteAuthorizedCertificateRequest( - ) - - # Make the request - await client.delete_authorized_certificate(request=request) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]]): - The request object. Request message for - ``AuthorizedCertificates.DeleteAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - request = appengine.DeleteAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_authorized_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def __aenter__(self) -> "AuthorizedCertificatesAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("AuthorizedCertificatesAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py deleted file mode 100644 index 004e8ab..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ /dev/null @@ -1,884 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.protobuf import timestamp_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.authorized_certificates import pagers -from google.cloud.appengine_admin_v1.types import appengine, certificate - -from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport -from .transports.grpc import AuthorizedCertificatesGrpcTransport -from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport -from .transports.rest import AuthorizedCertificatesRestTransport - - -class AuthorizedCertificatesClientMeta(type): - """Metaclass for the AuthorizedCertificates client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AuthorizedCertificatesTransport]] - _transport_registry["grpc"] = AuthorizedCertificatesGrpcTransport - _transport_registry["grpc_asyncio"] = AuthorizedCertificatesGrpcAsyncIOTransport - _transport_registry["rest"] = AuthorizedCertificatesRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[AuthorizedCertificatesTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AuthorizedCertificatesClient(metaclass=AuthorizedCertificatesClientMeta): - """Manages SSL certificates a user is authorized to administer. - A user can administer any SSL certificates applicable to their - authorized domains. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - AuthorizedCertificatesClient: 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 - 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: - AuthorizedCertificatesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AuthorizedCertificatesTransport: - """Returns the transport used by the client instance. - - Returns: - AuthorizedCertificatesTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, AuthorizedCertificatesTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the authorized certificates client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, AuthorizedCertificatesTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AuthorizedCertificatesTransport): - # transport is a AuthorizedCertificatesTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_authorized_certificates( - self, - request: Optional[ - Union[appengine.ListAuthorizedCertificatesRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAuthorizedCertificatesPager: - r"""Lists all SSL certificates the user is authorized to - administer. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_list_authorized_certificates(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedCertificatesRequest( - ) - - # Make the request - page_result = client.list_authorized_certificates(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]): - The request object. Request message for - ``AuthorizedCertificates.ListAuthorizedCertificates``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.authorized_certificates.pagers.ListAuthorizedCertificatesPager: - Response message for - AuthorizedCertificates.ListAuthorizedCertificates. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.ListAuthorizedCertificatesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.ListAuthorizedCertificatesRequest): - request = appengine.ListAuthorizedCertificatesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_authorized_certificates - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListAuthorizedCertificatesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_authorized_certificate( - self, - request: Optional[ - Union[appengine.GetAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Gets the specified SSL certificate. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_get_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetAuthorizedCertificateRequest( - ) - - # Make the request - response = client.get_authorized_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]): - The request object. Request message for - ``AuthorizedCertificates.GetAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.GetAuthorizedCertificateRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.GetAuthorizedCertificateRequest): - request = appengine.GetAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_authorized_certificate - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_authorized_certificate( - self, - request: Optional[ - Union[appengine.CreateAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Uploads the specified SSL certificate. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_create_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateAuthorizedCertificateRequest( - ) - - # Make the request - response = client.create_authorized_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]): - The request object. Request message for - ``AuthorizedCertificates.CreateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.CreateAuthorizedCertificateRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.CreateAuthorizedCertificateRequest): - request = appengine.CreateAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_authorized_certificate - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_authorized_certificate( - self, - request: Optional[ - Union[appengine.UpdateAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Updates the specified SSL certificate. To renew a certificate - and maintain its existing domain mappings, update - ``certificate_data`` with a new certificate. The new certificate - must be applicable to the same domains as the original - certificate. The certificate ``display_name`` may also be - updated. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_update_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateAuthorizedCertificateRequest( - ) - - # Make the request - response = client.update_authorized_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]): - The request object. Request message for - ``AuthorizedCertificates.UpdateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.UpdateAuthorizedCertificateRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.UpdateAuthorizedCertificateRequest): - request = appengine.UpdateAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.update_authorized_certificate - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_authorized_certificate( - self, - request: Optional[ - Union[appengine.DeleteAuthorizedCertificateRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the specified SSL certificate. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_delete_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteAuthorizedCertificateRequest( - ) - - # Make the request - client.delete_authorized_certificate(request=request) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): - The request object. Request message for - ``AuthorizedCertificates.DeleteAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.DeleteAuthorizedCertificateRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.DeleteAuthorizedCertificateRequest): - request = appengine.DeleteAuthorizedCertificateRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.delete_authorized_certificate - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def __enter__(self) -> "AuthorizedCertificatesClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("AuthorizedCertificatesClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py deleted file mode 100644 index 8221fc4..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py +++ /dev/null @@ -1,157 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import ( - Any, - AsyncIterator, - Awaitable, - Callable, - Iterator, - Optional, - Sequence, - Tuple, -) - -from google.cloud.appengine_admin_v1.types import appengine, certificate - - -class ListAuthorizedCertificatesPager: - """A pager for iterating through ``list_authorized_certificates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificates`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListAuthorizedCertificates`` requests and continue to iterate - through the ``certificates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., appengine.ListAuthorizedCertificatesResponse], - request: appengine.ListAuthorizedCertificatesRequest, - response: appengine.ListAuthorizedCertificatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListAuthorizedCertificatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[appengine.ListAuthorizedCertificatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[certificate.AuthorizedCertificate]: - for page in self.pages: - yield from page.certificates - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListAuthorizedCertificatesAsyncPager: - """A pager for iterating through ``list_authorized_certificates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificates`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListAuthorizedCertificates`` requests and continue to iterate - through the ``certificates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., Awaitable[appengine.ListAuthorizedCertificatesResponse]], - request: appengine.ListAuthorizedCertificatesRequest, - response: appengine.ListAuthorizedCertificatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListAuthorizedCertificatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages( - self, - ) -> AsyncIterator[appengine.ListAuthorizedCertificatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[certificate.AuthorizedCertificate]: - async def async_generator(): - async for page in self.pages: - for response in page.certificates: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py deleted file mode 100644 index 0886758..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import AuthorizedCertificatesTransport -from .grpc import AuthorizedCertificatesGrpcTransport -from .grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport -from .rest import ( - AuthorizedCertificatesRestInterceptor, - AuthorizedCertificatesRestTransport, -) - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AuthorizedCertificatesTransport]] -_transport_registry["grpc"] = AuthorizedCertificatesGrpcTransport -_transport_registry["grpc_asyncio"] = AuthorizedCertificatesGrpcAsyncIOTransport -_transport_registry["rest"] = AuthorizedCertificatesRestTransport - -__all__ = ( - "AuthorizedCertificatesTransport", - "AuthorizedCertificatesGrpcTransport", - "AuthorizedCertificatesGrpcAsyncIOTransport", - "AuthorizedCertificatesRestTransport", - "AuthorizedCertificatesRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py deleted file mode 100644 index 3987ad2..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py +++ /dev/null @@ -1,228 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine, certificate - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class AuthorizedCertificatesTransport(abc.ABC): - """Abstract transport class for AuthorizedCertificates.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_authorized_certificates: gapic_v1.method.wrap_method( - self.list_authorized_certificates, - default_timeout=None, - client_info=client_info, - ), - self.get_authorized_certificate: gapic_v1.method.wrap_method( - self.get_authorized_certificate, - default_timeout=None, - client_info=client_info, - ), - self.create_authorized_certificate: gapic_v1.method.wrap_method( - self.create_authorized_certificate, - default_timeout=None, - client_info=client_info, - ), - self.update_authorized_certificate: gapic_v1.method.wrap_method( - self.update_authorized_certificate, - default_timeout=None, - client_info=client_info, - ), - self.delete_authorized_certificate: gapic_v1.method.wrap_method( - self.delete_authorized_certificate, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def list_authorized_certificates( - self, - ) -> Callable[ - [appengine.ListAuthorizedCertificatesRequest], - Union[ - appengine.ListAuthorizedCertificatesResponse, - Awaitable[appengine.ListAuthorizedCertificatesResponse], - ], - ]: - raise NotImplementedError() - - @property - def get_authorized_certificate( - self, - ) -> Callable[ - [appengine.GetAuthorizedCertificateRequest], - Union[ - certificate.AuthorizedCertificate, - Awaitable[certificate.AuthorizedCertificate], - ], - ]: - raise NotImplementedError() - - @property - def create_authorized_certificate( - self, - ) -> Callable[ - [appengine.CreateAuthorizedCertificateRequest], - Union[ - certificate.AuthorizedCertificate, - Awaitable[certificate.AuthorizedCertificate], - ], - ]: - raise NotImplementedError() - - @property - def update_authorized_certificate( - self, - ) -> Callable[ - [appengine.UpdateAuthorizedCertificateRequest], - Union[ - certificate.AuthorizedCertificate, - Awaitable[certificate.AuthorizedCertificate], - ], - ]: - raise NotImplementedError() - - @property - def delete_authorized_certificate( - self, - ) -> Callable[ - [appengine.DeleteAuthorizedCertificateRequest], - Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("AuthorizedCertificatesTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py deleted file mode 100644 index ffa2a44..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py +++ /dev/null @@ -1,395 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.protobuf import empty_pb2 # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, certificate - -from .base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport - - -class AuthorizedCertificatesGrpcTransport(AuthorizedCertificatesTransport): - """gRPC backend transport for AuthorizedCertificates. - - Manages SSL certificates a user is authorized to administer. - A user can administer any SSL certificates applicable to their - authorized domains. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def list_authorized_certificates( - self, - ) -> Callable[ - [appengine.ListAuthorizedCertificatesRequest], - appengine.ListAuthorizedCertificatesResponse, - ]: - r"""Return a callable for the list authorized certificates method over gRPC. - - Lists all SSL certificates the user is authorized to - administer. - - Returns: - Callable[[~.ListAuthorizedCertificatesRequest], - ~.ListAuthorizedCertificatesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_authorized_certificates" not in self._stubs: - self._stubs["list_authorized_certificates"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/ListAuthorizedCertificates", - request_serializer=appengine.ListAuthorizedCertificatesRequest.serialize, - response_deserializer=appengine.ListAuthorizedCertificatesResponse.deserialize, - ) - return self._stubs["list_authorized_certificates"] - - @property - def get_authorized_certificate( - self, - ) -> Callable[ - [appengine.GetAuthorizedCertificateRequest], certificate.AuthorizedCertificate - ]: - r"""Return a callable for the get authorized certificate method over gRPC. - - Gets the specified SSL certificate. - - Returns: - Callable[[~.GetAuthorizedCertificateRequest], - ~.AuthorizedCertificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_authorized_certificate" not in self._stubs: - self._stubs["get_authorized_certificate"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/GetAuthorizedCertificate", - request_serializer=appengine.GetAuthorizedCertificateRequest.serialize, - response_deserializer=certificate.AuthorizedCertificate.deserialize, - ) - return self._stubs["get_authorized_certificate"] - - @property - def create_authorized_certificate( - self, - ) -> Callable[ - [appengine.CreateAuthorizedCertificateRequest], - certificate.AuthorizedCertificate, - ]: - r"""Return a callable for the create authorized certificate method over gRPC. - - Uploads the specified SSL certificate. - - Returns: - Callable[[~.CreateAuthorizedCertificateRequest], - ~.AuthorizedCertificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_authorized_certificate" not in self._stubs: - self._stubs[ - "create_authorized_certificate" - ] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/CreateAuthorizedCertificate", - request_serializer=appengine.CreateAuthorizedCertificateRequest.serialize, - response_deserializer=certificate.AuthorizedCertificate.deserialize, - ) - return self._stubs["create_authorized_certificate"] - - @property - def update_authorized_certificate( - self, - ) -> Callable[ - [appengine.UpdateAuthorizedCertificateRequest], - certificate.AuthorizedCertificate, - ]: - r"""Return a callable for the update authorized certificate method over gRPC. - - Updates the specified SSL certificate. To renew a certificate - and maintain its existing domain mappings, update - ``certificate_data`` with a new certificate. The new certificate - must be applicable to the same domains as the original - certificate. The certificate ``display_name`` may also be - updated. - - Returns: - Callable[[~.UpdateAuthorizedCertificateRequest], - ~.AuthorizedCertificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_authorized_certificate" not in self._stubs: - self._stubs[ - "update_authorized_certificate" - ] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/UpdateAuthorizedCertificate", - request_serializer=appengine.UpdateAuthorizedCertificateRequest.serialize, - response_deserializer=certificate.AuthorizedCertificate.deserialize, - ) - return self._stubs["update_authorized_certificate"] - - @property - def delete_authorized_certificate( - self, - ) -> Callable[[appengine.DeleteAuthorizedCertificateRequest], empty_pb2.Empty]: - r"""Return a callable for the delete authorized certificate method over gRPC. - - Deletes the specified SSL certificate. - - Returns: - Callable[[~.DeleteAuthorizedCertificateRequest], - ~.Empty]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_authorized_certificate" not in self._stubs: - self._stubs[ - "delete_authorized_certificate" - ] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/DeleteAuthorizedCertificate", - request_serializer=appengine.DeleteAuthorizedCertificateRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["delete_authorized_certificate"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("AuthorizedCertificatesGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py deleted file mode 100644 index 0ef74c2..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py +++ /dev/null @@ -1,397 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.protobuf import empty_pb2 # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, certificate - -from .base import DEFAULT_CLIENT_INFO, AuthorizedCertificatesTransport -from .grpc import AuthorizedCertificatesGrpcTransport - - -class AuthorizedCertificatesGrpcAsyncIOTransport(AuthorizedCertificatesTransport): - """gRPC AsyncIO backend transport for AuthorizedCertificates. - - Manages SSL certificates a user is authorized to administer. - A user can administer any SSL certificates applicable to their - authorized domains. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def list_authorized_certificates( - self, - ) -> Callable[ - [appengine.ListAuthorizedCertificatesRequest], - Awaitable[appengine.ListAuthorizedCertificatesResponse], - ]: - r"""Return a callable for the list authorized certificates method over gRPC. - - Lists all SSL certificates the user is authorized to - administer. - - Returns: - Callable[[~.ListAuthorizedCertificatesRequest], - Awaitable[~.ListAuthorizedCertificatesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_authorized_certificates" not in self._stubs: - self._stubs["list_authorized_certificates"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/ListAuthorizedCertificates", - request_serializer=appengine.ListAuthorizedCertificatesRequest.serialize, - response_deserializer=appengine.ListAuthorizedCertificatesResponse.deserialize, - ) - return self._stubs["list_authorized_certificates"] - - @property - def get_authorized_certificate( - self, - ) -> Callable[ - [appengine.GetAuthorizedCertificateRequest], - Awaitable[certificate.AuthorizedCertificate], - ]: - r"""Return a callable for the get authorized certificate method over gRPC. - - Gets the specified SSL certificate. - - Returns: - Callable[[~.GetAuthorizedCertificateRequest], - Awaitable[~.AuthorizedCertificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_authorized_certificate" not in self._stubs: - self._stubs["get_authorized_certificate"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/GetAuthorizedCertificate", - request_serializer=appengine.GetAuthorizedCertificateRequest.serialize, - response_deserializer=certificate.AuthorizedCertificate.deserialize, - ) - return self._stubs["get_authorized_certificate"] - - @property - def create_authorized_certificate( - self, - ) -> Callable[ - [appengine.CreateAuthorizedCertificateRequest], - Awaitable[certificate.AuthorizedCertificate], - ]: - r"""Return a callable for the create authorized certificate method over gRPC. - - Uploads the specified SSL certificate. - - Returns: - Callable[[~.CreateAuthorizedCertificateRequest], - Awaitable[~.AuthorizedCertificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_authorized_certificate" not in self._stubs: - self._stubs[ - "create_authorized_certificate" - ] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/CreateAuthorizedCertificate", - request_serializer=appengine.CreateAuthorizedCertificateRequest.serialize, - response_deserializer=certificate.AuthorizedCertificate.deserialize, - ) - return self._stubs["create_authorized_certificate"] - - @property - def update_authorized_certificate( - self, - ) -> Callable[ - [appengine.UpdateAuthorizedCertificateRequest], - Awaitable[certificate.AuthorizedCertificate], - ]: - r"""Return a callable for the update authorized certificate method over gRPC. - - Updates the specified SSL certificate. To renew a certificate - and maintain its existing domain mappings, update - ``certificate_data`` with a new certificate. The new certificate - must be applicable to the same domains as the original - certificate. The certificate ``display_name`` may also be - updated. - - Returns: - Callable[[~.UpdateAuthorizedCertificateRequest], - Awaitable[~.AuthorizedCertificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_authorized_certificate" not in self._stubs: - self._stubs[ - "update_authorized_certificate" - ] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/UpdateAuthorizedCertificate", - request_serializer=appengine.UpdateAuthorizedCertificateRequest.serialize, - response_deserializer=certificate.AuthorizedCertificate.deserialize, - ) - return self._stubs["update_authorized_certificate"] - - @property - def delete_authorized_certificate( - self, - ) -> Callable[ - [appengine.DeleteAuthorizedCertificateRequest], Awaitable[empty_pb2.Empty] - ]: - r"""Return a callable for the delete authorized certificate method over gRPC. - - Deletes the specified SSL certificate. - - Returns: - Callable[[~.DeleteAuthorizedCertificateRequest], - Awaitable[~.Empty]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_authorized_certificate" not in self._stubs: - self._stubs[ - "delete_authorized_certificate" - ] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedCertificates/DeleteAuthorizedCertificate", - request_serializer=appengine.DeleteAuthorizedCertificateRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["delete_authorized_certificate"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("AuthorizedCertificatesGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py deleted file mode 100644 index 5638415..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/rest.py +++ /dev/null @@ -1,790 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, certificate - -from .base import AuthorizedCertificatesTransport -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class AuthorizedCertificatesRestInterceptor: - """Interceptor for AuthorizedCertificates. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the AuthorizedCertificatesRestTransport. - - .. code-block:: python - class MyCustomAuthorizedCertificatesInterceptor(AuthorizedCertificatesRestInterceptor): - def pre_create_authorized_certificate(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_create_authorized_certificate(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_delete_authorized_certificate(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def pre_get_authorized_certificate(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_authorized_certificate(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_authorized_certificates(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_authorized_certificates(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_authorized_certificate(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_authorized_certificate(self, response): - logging.log(f"Received response: {response}") - return response - - transport = AuthorizedCertificatesRestTransport(interceptor=MyCustomAuthorizedCertificatesInterceptor()) - client = AuthorizedCertificatesClient(transport=transport) - - - """ - - def pre_create_authorized_certificate( - self, - request: appengine.CreateAuthorizedCertificateRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.CreateAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for create_authorized_certificate - - Override in a subclass to manipulate the request or metadata - before they are sent to the AuthorizedCertificates server. - """ - return request, metadata - - def post_create_authorized_certificate( - self, response: certificate.AuthorizedCertificate - ) -> certificate.AuthorizedCertificate: - """Post-rpc interceptor for create_authorized_certificate - - Override in a subclass to manipulate the response - after it is returned by the AuthorizedCertificates server but before - it is returned to user code. - """ - return response - - def pre_delete_authorized_certificate( - self, - request: appengine.DeleteAuthorizedCertificateRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.DeleteAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for delete_authorized_certificate - - Override in a subclass to manipulate the request or metadata - before they are sent to the AuthorizedCertificates server. - """ - return request, metadata - - def pre_get_authorized_certificate( - self, - request: appengine.GetAuthorizedCertificateRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.GetAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_authorized_certificate - - Override in a subclass to manipulate the request or metadata - before they are sent to the AuthorizedCertificates server. - """ - return request, metadata - - def post_get_authorized_certificate( - self, response: certificate.AuthorizedCertificate - ) -> certificate.AuthorizedCertificate: - """Post-rpc interceptor for get_authorized_certificate - - Override in a subclass to manipulate the response - after it is returned by the AuthorizedCertificates server but before - it is returned to user code. - """ - return response - - def pre_list_authorized_certificates( - self, - request: appengine.ListAuthorizedCertificatesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.ListAuthorizedCertificatesRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_authorized_certificates - - Override in a subclass to manipulate the request or metadata - before they are sent to the AuthorizedCertificates server. - """ - return request, metadata - - def post_list_authorized_certificates( - self, response: appengine.ListAuthorizedCertificatesResponse - ) -> appengine.ListAuthorizedCertificatesResponse: - """Post-rpc interceptor for list_authorized_certificates - - Override in a subclass to manipulate the response - after it is returned by the AuthorizedCertificates server but before - it is returned to user code. - """ - return response - - def pre_update_authorized_certificate( - self, - request: appengine.UpdateAuthorizedCertificateRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.UpdateAuthorizedCertificateRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for update_authorized_certificate - - Override in a subclass to manipulate the request or metadata - before they are sent to the AuthorizedCertificates server. - """ - return request, metadata - - def post_update_authorized_certificate( - self, response: certificate.AuthorizedCertificate - ) -> certificate.AuthorizedCertificate: - """Post-rpc interceptor for update_authorized_certificate - - Override in a subclass to manipulate the response - after it is returned by the AuthorizedCertificates server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class AuthorizedCertificatesRestStub: - _session: AuthorizedSession - _host: str - _interceptor: AuthorizedCertificatesRestInterceptor - - -class AuthorizedCertificatesRestTransport(AuthorizedCertificatesTransport): - """REST backend transport for AuthorizedCertificates. - - Manages SSL certificates a user is authorized to administer. - A user can administer any SSL certificates applicable to their - authorized domains. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[AuthorizedCertificatesRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or AuthorizedCertificatesRestInterceptor() - self._prep_wrapped_messages(client_info) - - class _CreateAuthorizedCertificate(AuthorizedCertificatesRestStub): - def __hash__(self): - return hash("CreateAuthorizedCertificate") - - def __call__( - self, - request: appengine.CreateAuthorizedCertificateRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Call the create authorized - certificate method over HTTP. - - Args: - request (~.appengine.CreateAuthorizedCertificateRequest): - The request object. Request message for - ``AuthorizedCertificates.CreateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.certificate.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/{parent=apps/*}/authorizedCertificates", - "body": "certificate", - }, - ] - request, metadata = self._interceptor.pre_create_authorized_certificate( - request, metadata - ) - pb_request = appengine.CreateAuthorizedCertificateRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = certificate.AuthorizedCertificate() - pb_resp = certificate.AuthorizedCertificate.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_authorized_certificate(resp) - return resp - - class _DeleteAuthorizedCertificate(AuthorizedCertificatesRestStub): - def __hash__(self): - return hash("DeleteAuthorizedCertificate") - - def __call__( - self, - request: appengine.DeleteAuthorizedCertificateRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ): - r"""Call the delete authorized - certificate method over HTTP. - - Args: - request (~.appengine.DeleteAuthorizedCertificateRequest): - The request object. Request message for - ``AuthorizedCertificates.DeleteAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "delete", - "uri": "/v1/{name=apps/*/authorizedCertificates/*}", - }, - ] - request, metadata = self._interceptor.pre_delete_authorized_certificate( - request, metadata - ) - pb_request = appengine.DeleteAuthorizedCertificateRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - class _GetAuthorizedCertificate(AuthorizedCertificatesRestStub): - def __hash__(self): - return hash("GetAuthorizedCertificate") - - def __call__( - self, - request: appengine.GetAuthorizedCertificateRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Call the get authorized - certificate method over HTTP. - - Args: - request (~.appengine.GetAuthorizedCertificateRequest): - The request object. Request message for - ``AuthorizedCertificates.GetAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.certificate.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{name=apps/*/authorizedCertificates/*}", - }, - ] - request, metadata = self._interceptor.pre_get_authorized_certificate( - request, metadata - ) - pb_request = appengine.GetAuthorizedCertificateRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = certificate.AuthorizedCertificate() - pb_resp = certificate.AuthorizedCertificate.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_authorized_certificate(resp) - return resp - - class _ListAuthorizedCertificates(AuthorizedCertificatesRestStub): - def __hash__(self): - return hash("ListAuthorizedCertificates") - - def __call__( - self, - request: appengine.ListAuthorizedCertificatesRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.ListAuthorizedCertificatesResponse: - r"""Call the list authorized - certificates method over HTTP. - - Args: - request (~.appengine.ListAuthorizedCertificatesRequest): - The request object. Request message for - ``AuthorizedCertificates.ListAuthorizedCertificates``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.ListAuthorizedCertificatesResponse: - Response message for - ``AuthorizedCertificates.ListAuthorizedCertificates``. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{parent=apps/*}/authorizedCertificates", - }, - ] - request, metadata = self._interceptor.pre_list_authorized_certificates( - request, metadata - ) - pb_request = appengine.ListAuthorizedCertificatesRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.ListAuthorizedCertificatesResponse() - pb_resp = appengine.ListAuthorizedCertificatesResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_authorized_certificates(resp) - return resp - - class _UpdateAuthorizedCertificate(AuthorizedCertificatesRestStub): - def __hash__(self): - return hash("UpdateAuthorizedCertificate") - - def __call__( - self, - request: appengine.UpdateAuthorizedCertificateRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> certificate.AuthorizedCertificate: - r"""Call the update authorized - certificate method over HTTP. - - Args: - request (~.appengine.UpdateAuthorizedCertificateRequest): - The request object. Request message for - ``AuthorizedCertificates.UpdateAuthorizedCertificate``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.certificate.AuthorizedCertificate: - An SSL certificate that a user has - been authorized to administer. A user is - authorized to administer any certificate - that applies to one of their authorized - domains. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "patch", - "uri": "/v1/{name=apps/*/authorizedCertificates/*}", - "body": "certificate", - }, - ] - request, metadata = self._interceptor.pre_update_authorized_certificate( - request, metadata - ) - pb_request = appengine.UpdateAuthorizedCertificateRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = certificate.AuthorizedCertificate() - pb_resp = certificate.AuthorizedCertificate.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_authorized_certificate(resp) - return resp - - @property - def create_authorized_certificate( - self, - ) -> Callable[ - [appengine.CreateAuthorizedCertificateRequest], - certificate.AuthorizedCertificate, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CreateAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore - - @property - def delete_authorized_certificate( - self, - ) -> Callable[[appengine.DeleteAuthorizedCertificateRequest], empty_pb2.Empty]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_authorized_certificate( - self, - ) -> Callable[ - [appengine.GetAuthorizedCertificateRequest], certificate.AuthorizedCertificate - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_authorized_certificates( - self, - ) -> Callable[ - [appengine.ListAuthorizedCertificatesRequest], - appengine.ListAuthorizedCertificatesResponse, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListAuthorizedCertificates(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_authorized_certificate( - self, - ) -> Callable[ - [appengine.UpdateAuthorizedCertificateRequest], - certificate.AuthorizedCertificate, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateAuthorizedCertificate(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("AuthorizedCertificatesRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py deleted file mode 100644 index 4a2011c..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .async_client import AuthorizedDomainsAsyncClient -from .client import AuthorizedDomainsClient - -__all__ = ( - "AuthorizedDomainsClient", - "AuthorizedDomainsAsyncClient", -) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py deleted file mode 100644 index c5d95d9..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py +++ /dev/null @@ -1,323 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import functools -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core.client_options import ClientOptions -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.cloud.appengine_admin_v1.services.authorized_domains import pagers -from google.cloud.appengine_admin_v1.types import appengine, domain - -from .client import AuthorizedDomainsClient -from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport -from .transports.grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport - - -class AuthorizedDomainsAsyncClient: - """Manages domains a user is authorized to administer. To authorize use - of a domain, verify ownership via `Webmaster - Central `__. - """ - - _client: AuthorizedDomainsClient - - DEFAULT_ENDPOINT = AuthorizedDomainsClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = AuthorizedDomainsClient.DEFAULT_MTLS_ENDPOINT - - common_billing_account_path = staticmethod( - AuthorizedDomainsClient.common_billing_account_path - ) - parse_common_billing_account_path = staticmethod( - AuthorizedDomainsClient.parse_common_billing_account_path - ) - common_folder_path = staticmethod(AuthorizedDomainsClient.common_folder_path) - parse_common_folder_path = staticmethod( - AuthorizedDomainsClient.parse_common_folder_path - ) - common_organization_path = staticmethod( - AuthorizedDomainsClient.common_organization_path - ) - parse_common_organization_path = staticmethod( - AuthorizedDomainsClient.parse_common_organization_path - ) - common_project_path = staticmethod(AuthorizedDomainsClient.common_project_path) - parse_common_project_path = staticmethod( - AuthorizedDomainsClient.parse_common_project_path - ) - common_location_path = staticmethod(AuthorizedDomainsClient.common_location_path) - parse_common_location_path = staticmethod( - AuthorizedDomainsClient.parse_common_location_path - ) - - @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: - AuthorizedDomainsAsyncClient: The constructed client. - """ - return AuthorizedDomainsClient.from_service_account_info.__func__(AuthorizedDomainsAsyncClient, 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: - AuthorizedDomainsAsyncClient: The constructed client. - """ - return AuthorizedDomainsClient.from_service_account_file.__func__(AuthorizedDomainsAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return AuthorizedDomainsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> AuthorizedDomainsTransport: - """Returns the transport used by the client instance. - - Returns: - AuthorizedDomainsTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(AuthorizedDomainsClient).get_transport_class, type(AuthorizedDomainsClient) - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, AuthorizedDomainsTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the authorized domains client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.AuthorizedDomainsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = AuthorizedDomainsClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def list_authorized_domains( - self, - request: Optional[Union[appengine.ListAuthorizedDomainsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAuthorizedDomainsAsyncPager: - r"""Lists all domains the user is authorized to - administer. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_list_authorized_domains(): - # Create a client - client = appengine_admin_v1.AuthorizedDomainsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedDomainsRequest( - ) - - # Make the request - page_result = client.list_authorized_domains(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]]): - The request object. Request message for - ``AuthorizedDomains.ListAuthorizedDomains``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.authorized_domains.pagers.ListAuthorizedDomainsAsyncPager: - Response message for - AuthorizedDomains.ListAuthorizedDomains. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = appengine.ListAuthorizedDomainsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_authorized_domains, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListAuthorizedDomainsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "AuthorizedDomainsAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("AuthorizedDomainsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py deleted file mode 100644 index 3fafd06..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ /dev/null @@ -1,540 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.cloud.appengine_admin_v1.services.authorized_domains import pagers -from google.cloud.appengine_admin_v1.types import appengine, domain - -from .transports.base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport -from .transports.grpc import AuthorizedDomainsGrpcTransport -from .transports.grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport -from .transports.rest import AuthorizedDomainsRestTransport - - -class AuthorizedDomainsClientMeta(type): - """Metaclass for the AuthorizedDomains client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AuthorizedDomainsTransport]] - _transport_registry["grpc"] = AuthorizedDomainsGrpcTransport - _transport_registry["grpc_asyncio"] = AuthorizedDomainsGrpcAsyncIOTransport - _transport_registry["rest"] = AuthorizedDomainsRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[AuthorizedDomainsTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AuthorizedDomainsClient(metaclass=AuthorizedDomainsClientMeta): - """Manages domains a user is authorized to administer. To authorize use - of a domain, verify ownership via `Webmaster - Central `__. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - AuthorizedDomainsClient: 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 - 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: - AuthorizedDomainsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AuthorizedDomainsTransport: - """Returns the transport used by the client instance. - - Returns: - AuthorizedDomainsTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, AuthorizedDomainsTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the authorized domains client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, AuthorizedDomainsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AuthorizedDomainsTransport): - # transport is a AuthorizedDomainsTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_authorized_domains( - self, - request: Optional[Union[appengine.ListAuthorizedDomainsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAuthorizedDomainsPager: - r"""Lists all domains the user is authorized to - administer. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_list_authorized_domains(): - # Create a client - client = appengine_admin_v1.AuthorizedDomainsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedDomainsRequest( - ) - - # Make the request - page_result = client.list_authorized_domains(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]): - The request object. Request message for - ``AuthorizedDomains.ListAuthorizedDomains``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.authorized_domains.pagers.ListAuthorizedDomainsPager: - Response message for - AuthorizedDomains.ListAuthorizedDomains. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.ListAuthorizedDomainsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.ListAuthorizedDomainsRequest): - request = appengine.ListAuthorizedDomainsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_authorized_domains] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListAuthorizedDomainsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "AuthorizedDomainsClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("AuthorizedDomainsClient",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py b/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py deleted file mode 100644 index 97c4b31..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import ( - Any, - AsyncIterator, - Awaitable, - Callable, - Iterator, - Optional, - Sequence, - Tuple, -) - -from google.cloud.appengine_admin_v1.types import appengine, domain - - -class ListAuthorizedDomainsPager: - """A pager for iterating through ``list_authorized_domains`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``domains`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListAuthorizedDomains`` requests and continue to iterate - through the ``domains`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., appengine.ListAuthorizedDomainsResponse], - request: appengine.ListAuthorizedDomainsRequest, - response: appengine.ListAuthorizedDomainsResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListAuthorizedDomainsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[appengine.ListAuthorizedDomainsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[domain.AuthorizedDomain]: - for page in self.pages: - yield from page.domains - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListAuthorizedDomainsAsyncPager: - """A pager for iterating through ``list_authorized_domains`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``domains`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListAuthorizedDomains`` requests and continue to iterate - through the ``domains`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., Awaitable[appengine.ListAuthorizedDomainsResponse]], - request: appengine.ListAuthorizedDomainsRequest, - response: appengine.ListAuthorizedDomainsResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListAuthorizedDomainsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[appengine.ListAuthorizedDomainsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[domain.AuthorizedDomain]: - async def async_generator(): - async for page in self.pages: - for response in page.domains: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py deleted file mode 100644 index a649173..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import AuthorizedDomainsTransport -from .grpc import AuthorizedDomainsGrpcTransport -from .grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport -from .rest import AuthorizedDomainsRestInterceptor, AuthorizedDomainsRestTransport - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[AuthorizedDomainsTransport]] -_transport_registry["grpc"] = AuthorizedDomainsGrpcTransport -_transport_registry["grpc_asyncio"] = AuthorizedDomainsGrpcAsyncIOTransport -_transport_registry["rest"] = AuthorizedDomainsRestTransport - -__all__ = ( - "AuthorizedDomainsTransport", - "AuthorizedDomainsGrpcTransport", - "AuthorizedDomainsGrpcAsyncIOTransport", - "AuthorizedDomainsRestTransport", - "AuthorizedDomainsRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py deleted file mode 100644 index 292b9bd..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py +++ /dev/null @@ -1,162 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class AuthorizedDomainsTransport(abc.ABC): - """Abstract transport class for AuthorizedDomains.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_authorized_domains: gapic_v1.method.wrap_method( - self.list_authorized_domains, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def list_authorized_domains( - self, - ) -> Callable[ - [appengine.ListAuthorizedDomainsRequest], - Union[ - appengine.ListAuthorizedDomainsResponse, - Awaitable[appengine.ListAuthorizedDomainsResponse], - ], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("AuthorizedDomainsTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py deleted file mode 100644 index 861766a..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine - -from .base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport - - -class AuthorizedDomainsGrpcTransport(AuthorizedDomainsTransport): - """gRPC backend transport for AuthorizedDomains. - - Manages domains a user is authorized to administer. To authorize use - of a domain, verify ownership via `Webmaster - Central `__. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def list_authorized_domains( - self, - ) -> Callable[ - [appengine.ListAuthorizedDomainsRequest], - appengine.ListAuthorizedDomainsResponse, - ]: - r"""Return a callable for the list authorized domains method over gRPC. - - Lists all domains the user is authorized to - administer. - - Returns: - Callable[[~.ListAuthorizedDomainsRequest], - ~.ListAuthorizedDomainsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_authorized_domains" not in self._stubs: - self._stubs["list_authorized_domains"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedDomains/ListAuthorizedDomains", - request_serializer=appengine.ListAuthorizedDomainsRequest.serialize, - response_deserializer=appengine.ListAuthorizedDomainsResponse.deserialize, - ) - return self._stubs["list_authorized_domains"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("AuthorizedDomainsGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py deleted file mode 100644 index 292954c..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py +++ /dev/null @@ -1,270 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine - -from .base import DEFAULT_CLIENT_INFO, AuthorizedDomainsTransport -from .grpc import AuthorizedDomainsGrpcTransport - - -class AuthorizedDomainsGrpcAsyncIOTransport(AuthorizedDomainsTransport): - """gRPC AsyncIO backend transport for AuthorizedDomains. - - Manages domains a user is authorized to administer. To authorize use - of a domain, verify ownership via `Webmaster - Central `__. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def list_authorized_domains( - self, - ) -> Callable[ - [appengine.ListAuthorizedDomainsRequest], - Awaitable[appengine.ListAuthorizedDomainsResponse], - ]: - r"""Return a callable for the list authorized domains method over gRPC. - - Lists all domains the user is authorized to - administer. - - Returns: - Callable[[~.ListAuthorizedDomainsRequest], - Awaitable[~.ListAuthorizedDomainsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_authorized_domains" not in self._stubs: - self._stubs["list_authorized_domains"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.AuthorizedDomains/ListAuthorizedDomains", - request_serializer=appengine.ListAuthorizedDomainsRequest.serialize, - response_deserializer=appengine.ListAuthorizedDomainsResponse.deserialize, - ) - return self._stubs["list_authorized_domains"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("AuthorizedDomainsGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py deleted file mode 100644 index da4097c..0000000 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/transports/rest.py +++ /dev/null @@ -1,301 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.cloud.appengine_admin_v1.types import appengine - -from .base import AuthorizedDomainsTransport -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class AuthorizedDomainsRestInterceptor: - """Interceptor for AuthorizedDomains. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the AuthorizedDomainsRestTransport. - - .. code-block:: python - class MyCustomAuthorizedDomainsInterceptor(AuthorizedDomainsRestInterceptor): - def pre_list_authorized_domains(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_authorized_domains(self, response): - logging.log(f"Received response: {response}") - return response - - transport = AuthorizedDomainsRestTransport(interceptor=MyCustomAuthorizedDomainsInterceptor()) - client = AuthorizedDomainsClient(transport=transport) - - - """ - - def pre_list_authorized_domains( - self, - request: appengine.ListAuthorizedDomainsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.ListAuthorizedDomainsRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_authorized_domains - - Override in a subclass to manipulate the request or metadata - before they are sent to the AuthorizedDomains server. - """ - return request, metadata - - def post_list_authorized_domains( - self, response: appengine.ListAuthorizedDomainsResponse - ) -> appengine.ListAuthorizedDomainsResponse: - """Post-rpc interceptor for list_authorized_domains - - Override in a subclass to manipulate the response - after it is returned by the AuthorizedDomains server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class AuthorizedDomainsRestStub: - _session: AuthorizedSession - _host: str - _interceptor: AuthorizedDomainsRestInterceptor - - -class AuthorizedDomainsRestTransport(AuthorizedDomainsTransport): - """REST backend transport for AuthorizedDomains. - - Manages domains a user is authorized to administer. To authorize use - of a domain, verify ownership via `Webmaster - Central `__. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[AuthorizedDomainsRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or AuthorizedDomainsRestInterceptor() - self._prep_wrapped_messages(client_info) - - class _ListAuthorizedDomains(AuthorizedDomainsRestStub): - def __hash__(self): - return hash("ListAuthorizedDomains") - - def __call__( - self, - request: appengine.ListAuthorizedDomainsRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.ListAuthorizedDomainsResponse: - r"""Call the list authorized domains method over HTTP. - - Args: - request (~.appengine.ListAuthorizedDomainsRequest): - The request object. Request message for - ``AuthorizedDomains.ListAuthorizedDomains``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.ListAuthorizedDomainsResponse: - Response message for - ``AuthorizedDomains.ListAuthorizedDomains``. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{parent=apps/*}/authorizedDomains", - }, - ] - request, metadata = self._interceptor.pre_list_authorized_domains( - request, metadata - ) - pb_request = appengine.ListAuthorizedDomainsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.ListAuthorizedDomainsResponse() - pb_resp = appengine.ListAuthorizedDomainsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_authorized_domains(resp) - return resp - - @property - def list_authorized_domains( - self, - ) -> Callable[ - [appengine.ListAuthorizedDomainsRequest], - appengine.ListAuthorizedDomainsResponse, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListAuthorizedDomains(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("AuthorizedDomainsRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py b/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py deleted file mode 100644 index 5494732..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .async_client import DomainMappingsAsyncClient -from .client import DomainMappingsClient - -__all__ = ( - "DomainMappingsClient", - "DomainMappingsAsyncClient", -) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py deleted file mode 100644 index 2344a23..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py +++ /dev/null @@ -1,699 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import functools -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core.client_options import ClientOptions -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.domain_mappings import pagers -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping -from google.cloud.appengine_admin_v1.types import operation as ga_operation - -from .client import DomainMappingsClient -from .transports.base import DEFAULT_CLIENT_INFO, DomainMappingsTransport -from .transports.grpc_asyncio import DomainMappingsGrpcAsyncIOTransport - - -class DomainMappingsAsyncClient: - """Manages domains serving an application.""" - - _client: DomainMappingsClient - - DEFAULT_ENDPOINT = DomainMappingsClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = DomainMappingsClient.DEFAULT_MTLS_ENDPOINT - - common_billing_account_path = staticmethod( - DomainMappingsClient.common_billing_account_path - ) - parse_common_billing_account_path = staticmethod( - DomainMappingsClient.parse_common_billing_account_path - ) - common_folder_path = staticmethod(DomainMappingsClient.common_folder_path) - parse_common_folder_path = staticmethod( - DomainMappingsClient.parse_common_folder_path - ) - common_organization_path = staticmethod( - DomainMappingsClient.common_organization_path - ) - parse_common_organization_path = staticmethod( - DomainMappingsClient.parse_common_organization_path - ) - common_project_path = staticmethod(DomainMappingsClient.common_project_path) - parse_common_project_path = staticmethod( - DomainMappingsClient.parse_common_project_path - ) - common_location_path = staticmethod(DomainMappingsClient.common_location_path) - parse_common_location_path = staticmethod( - DomainMappingsClient.parse_common_location_path - ) - - @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: - DomainMappingsAsyncClient: The constructed client. - """ - return DomainMappingsClient.from_service_account_info.__func__(DomainMappingsAsyncClient, 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: - DomainMappingsAsyncClient: The constructed client. - """ - return DomainMappingsClient.from_service_account_file.__func__(DomainMappingsAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return DomainMappingsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> DomainMappingsTransport: - """Returns the transport used by the client instance. - - Returns: - DomainMappingsTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(DomainMappingsClient).get_transport_class, type(DomainMappingsClient) - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DomainMappingsTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the domain mappings client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.DomainMappingsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = DomainMappingsClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def list_domain_mappings( - self, - request: Optional[Union[appengine.ListDomainMappingsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDomainMappingsAsyncPager: - r"""Lists the domain mappings on an application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_list_domain_mappings(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListDomainMappingsRequest( - ) - - # Make the request - page_result = client.list_domain_mappings(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]]): - The request object. Request message for - ``DomainMappings.ListDomainMappings``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.domain_mappings.pagers.ListDomainMappingsAsyncPager: - Response message for DomainMappings.ListDomainMappings. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = appengine.ListDomainMappingsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_domain_mappings, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListDomainMappingsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_domain_mapping( - self, - request: Optional[Union[appengine.GetDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> domain_mapping.DomainMapping: - r"""Gets the specified domain mapping. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_get_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetDomainMappingRequest( - ) - - # Make the request - response = await client.get_domain_mapping(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]]): - The request object. Request message for ``DomainMappings.GetDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.DomainMapping: - A domain serving an App Engine - application. - - """ - # Create or coerce a protobuf request object. - request = appengine.GetDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_domain_mapping, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_domain_mapping( - self, - request: Optional[Union[appengine.CreateDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Maps a domain to an application. A user must be authorized to - administer a domain in order to map it to an application. For a - list of available authorized domains, see - ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_create_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateDomainMappingRequest( - ) - - # Make the request - operation = client.create_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]]): - The request object. Request message for - ``DomainMappings.CreateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.appengine_admin_v1.types.DomainMapping` - A domain serving an App Engine application. - - """ - # Create or coerce a protobuf request object. - request = appengine.CreateDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_domain_mapping, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - domain_mapping.DomainMapping, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def update_domain_mapping( - self, - request: Optional[Union[appengine.UpdateDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the specified domain mapping. To map an SSL certificate - to a domain mapping, update ``certificate_id`` to point to an - ``AuthorizedCertificate`` resource. A user must be authorized to - administer the associated domain in order to update a - ``DomainMapping`` resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_update_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateDomainMappingRequest( - ) - - # Make the request - operation = client.update_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]]): - The request object. Request message for - ``DomainMappings.UpdateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.appengine_admin_v1.types.DomainMapping` - A domain serving an App Engine application. - - """ - # Create or coerce a protobuf request object. - request = appengine.UpdateDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_domain_mapping, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - domain_mapping.DomainMapping, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def delete_domain_mapping( - self, - request: Optional[Union[appengine.DeleteDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Deletes the specified domain mapping. A user must be authorized - to administer the associated domain in order to delete a - ``DomainMapping`` resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_delete_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteDomainMappingRequest( - ) - - # Make the request - operation = client.delete_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]]): - The request object. Request message for - ``DomainMappings.DeleteDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - request = appengine.DeleteDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_domain_mapping, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "DomainMappingsAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("DomainMappingsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py deleted file mode 100644 index 686d61f..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ /dev/null @@ -1,920 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.domain_mappings import pagers -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping -from google.cloud.appengine_admin_v1.types import operation as ga_operation - -from .transports.base import DEFAULT_CLIENT_INFO, DomainMappingsTransport -from .transports.grpc import DomainMappingsGrpcTransport -from .transports.grpc_asyncio import DomainMappingsGrpcAsyncIOTransport -from .transports.rest import DomainMappingsRestTransport - - -class DomainMappingsClientMeta(type): - """Metaclass for the DomainMappings client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[DomainMappingsTransport]] - _transport_registry["grpc"] = DomainMappingsGrpcTransport - _transport_registry["grpc_asyncio"] = DomainMappingsGrpcAsyncIOTransport - _transport_registry["rest"] = DomainMappingsRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[DomainMappingsTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DomainMappingsClient(metaclass=DomainMappingsClientMeta): - """Manages domains serving an application.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - DomainMappingsClient: 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 - 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: - DomainMappingsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DomainMappingsTransport: - """Returns the transport used by the client instance. - - Returns: - DomainMappingsTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, DomainMappingsTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the domain mappings client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, DomainMappingsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, DomainMappingsTransport): - # transport is a DomainMappingsTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_domain_mappings( - self, - request: Optional[Union[appengine.ListDomainMappingsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDomainMappingsPager: - r"""Lists the domain mappings on an application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_list_domain_mappings(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListDomainMappingsRequest( - ) - - # Make the request - page_result = client.list_domain_mappings(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]): - The request object. Request message for - ``DomainMappings.ListDomainMappings``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.domain_mappings.pagers.ListDomainMappingsPager: - Response message for DomainMappings.ListDomainMappings. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.ListDomainMappingsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.ListDomainMappingsRequest): - request = appengine.ListDomainMappingsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_domain_mappings] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListDomainMappingsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_domain_mapping( - self, - request: Optional[Union[appengine.GetDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> domain_mapping.DomainMapping: - r"""Gets the specified domain mapping. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_get_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetDomainMappingRequest( - ) - - # Make the request - response = client.get_domain_mapping(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]): - The request object. Request message for ``DomainMappings.GetDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.DomainMapping: - A domain serving an App Engine - application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.GetDomainMappingRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.GetDomainMappingRequest): - request = appengine.GetDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_domain_mapping] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_domain_mapping( - self, - request: Optional[Union[appengine.CreateDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Maps a domain to an application. A user must be authorized to - administer a domain in order to map it to an application. For a - list of available authorized domains, see - ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_create_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateDomainMappingRequest( - ) - - # Make the request - operation = client.create_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]): - The request object. Request message for - ``DomainMappings.CreateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.appengine_admin_v1.types.DomainMapping` - A domain serving an App Engine application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.CreateDomainMappingRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.CreateDomainMappingRequest): - request = appengine.CreateDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_domain_mapping] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - domain_mapping.DomainMapping, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def update_domain_mapping( - self, - request: Optional[Union[appengine.UpdateDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Updates the specified domain mapping. To map an SSL certificate - to a domain mapping, update ``certificate_id`` to point to an - ``AuthorizedCertificate`` resource. A user must be authorized to - administer the associated domain in order to update a - ``DomainMapping`` resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_update_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateDomainMappingRequest( - ) - - # Make the request - operation = client.update_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]): - The request object. Request message for - ``DomainMappings.UpdateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.appengine_admin_v1.types.DomainMapping` - A domain serving an App Engine application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.UpdateDomainMappingRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.UpdateDomainMappingRequest): - request = appengine.UpdateDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_domain_mapping] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - domain_mapping.DomainMapping, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def delete_domain_mapping( - self, - request: Optional[Union[appengine.DeleteDomainMappingRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Deletes the specified domain mapping. A user must be authorized - to administer the associated domain in order to delete a - ``DomainMapping`` resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_delete_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteDomainMappingRequest( - ) - - # Make the request - operation = client.delete_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]): - The request object. Request message for - ``DomainMappings.DeleteDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.DeleteDomainMappingRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.DeleteDomainMappingRequest): - request = appengine.DeleteDomainMappingRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_domain_mapping] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "DomainMappingsClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("DomainMappingsClient",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py b/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py deleted file mode 100644 index b1b6f53..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import ( - Any, - AsyncIterator, - Awaitable, - Callable, - Iterator, - Optional, - Sequence, - Tuple, -) - -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping - - -class ListDomainMappingsPager: - """A pager for iterating through ``list_domain_mappings`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListDomainMappingsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``domain_mappings`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListDomainMappings`` requests and continue to iterate - through the ``domain_mappings`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListDomainMappingsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., appengine.ListDomainMappingsResponse], - request: appengine.ListDomainMappingsRequest, - response: appengine.ListDomainMappingsResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListDomainMappingsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListDomainMappingsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[appengine.ListDomainMappingsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[domain_mapping.DomainMapping]: - for page in self.pages: - yield from page.domain_mappings - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListDomainMappingsAsyncPager: - """A pager for iterating through ``list_domain_mappings`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListDomainMappingsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``domain_mappings`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListDomainMappings`` requests and continue to iterate - through the ``domain_mappings`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListDomainMappingsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., Awaitable[appengine.ListDomainMappingsResponse]], - request: appengine.ListDomainMappingsRequest, - response: appengine.ListDomainMappingsResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListDomainMappingsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListDomainMappingsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[appengine.ListDomainMappingsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[domain_mapping.DomainMapping]: - async def async_generator(): - async for page in self.pages: - for response in page.domain_mappings: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py deleted file mode 100644 index c57349d..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import DomainMappingsTransport -from .grpc import DomainMappingsGrpcTransport -from .grpc_asyncio import DomainMappingsGrpcAsyncIOTransport -from .rest import DomainMappingsRestInterceptor, DomainMappingsRestTransport - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[DomainMappingsTransport]] -_transport_registry["grpc"] = DomainMappingsGrpcTransport -_transport_registry["grpc_asyncio"] = DomainMappingsGrpcAsyncIOTransport -_transport_registry["rest"] = DomainMappingsRestTransport - -__all__ = ( - "DomainMappingsTransport", - "DomainMappingsGrpcTransport", - "DomainMappingsGrpcAsyncIOTransport", - "DomainMappingsRestTransport", - "DomainMappingsRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py deleted file mode 100644 index edf6be5..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py +++ /dev/null @@ -1,224 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1, operations_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class DomainMappingsTransport(abc.ABC): - """Abstract transport class for DomainMappings.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_domain_mappings: gapic_v1.method.wrap_method( - self.list_domain_mappings, - default_timeout=None, - client_info=client_info, - ), - self.get_domain_mapping: gapic_v1.method.wrap_method( - self.get_domain_mapping, - default_timeout=None, - client_info=client_info, - ), - self.create_domain_mapping: gapic_v1.method.wrap_method( - self.create_domain_mapping, - default_timeout=None, - client_info=client_info, - ), - self.update_domain_mapping: gapic_v1.method.wrap_method( - self.update_domain_mapping, - default_timeout=None, - client_info=client_info, - ), - self.delete_domain_mapping: gapic_v1.method.wrap_method( - self.delete_domain_mapping, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_domain_mappings( - self, - ) -> Callable[ - [appengine.ListDomainMappingsRequest], - Union[ - appengine.ListDomainMappingsResponse, - Awaitable[appengine.ListDomainMappingsResponse], - ], - ]: - raise NotImplementedError() - - @property - def get_domain_mapping( - self, - ) -> Callable[ - [appengine.GetDomainMappingRequest], - Union[domain_mapping.DomainMapping, Awaitable[domain_mapping.DomainMapping]], - ]: - raise NotImplementedError() - - @property - def create_domain_mapping( - self, - ) -> Callable[ - [appengine.CreateDomainMappingRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def update_domain_mapping( - self, - ) -> Callable[ - [appengine.UpdateDomainMappingRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def delete_domain_mapping( - self, - ) -> Callable[ - [appengine.DeleteDomainMappingRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("DomainMappingsTransport",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py deleted file mode 100644 index 4c3ca85..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py +++ /dev/null @@ -1,396 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers, operations_v1 -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping - -from .base import DEFAULT_CLIENT_INFO, DomainMappingsTransport - - -class DomainMappingsGrpcTransport(DomainMappingsTransport): - """gRPC backend transport for DomainMappings. - - Manages domains serving an application. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient(self.grpc_channel) - - # Return the client from cache. - return self._operations_client - - @property - def list_domain_mappings( - self, - ) -> Callable[ - [appengine.ListDomainMappingsRequest], appengine.ListDomainMappingsResponse - ]: - r"""Return a callable for the list domain mappings method over gRPC. - - Lists the domain mappings on an application. - - Returns: - Callable[[~.ListDomainMappingsRequest], - ~.ListDomainMappingsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_domain_mappings" not in self._stubs: - self._stubs["list_domain_mappings"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/ListDomainMappings", - request_serializer=appengine.ListDomainMappingsRequest.serialize, - response_deserializer=appengine.ListDomainMappingsResponse.deserialize, - ) - return self._stubs["list_domain_mappings"] - - @property - def get_domain_mapping( - self, - ) -> Callable[[appengine.GetDomainMappingRequest], domain_mapping.DomainMapping]: - r"""Return a callable for the get domain mapping method over gRPC. - - Gets the specified domain mapping. - - Returns: - Callable[[~.GetDomainMappingRequest], - ~.DomainMapping]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_domain_mapping" not in self._stubs: - self._stubs["get_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/GetDomainMapping", - request_serializer=appengine.GetDomainMappingRequest.serialize, - response_deserializer=domain_mapping.DomainMapping.deserialize, - ) - return self._stubs["get_domain_mapping"] - - @property - def create_domain_mapping( - self, - ) -> Callable[[appengine.CreateDomainMappingRequest], operations_pb2.Operation]: - r"""Return a callable for the create domain mapping method over gRPC. - - Maps a domain to an application. A user must be authorized to - administer a domain in order to map it to an application. For a - list of available authorized domains, see - ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - - Returns: - Callable[[~.CreateDomainMappingRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_domain_mapping" not in self._stubs: - self._stubs["create_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/CreateDomainMapping", - request_serializer=appengine.CreateDomainMappingRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["create_domain_mapping"] - - @property - def update_domain_mapping( - self, - ) -> Callable[[appengine.UpdateDomainMappingRequest], operations_pb2.Operation]: - r"""Return a callable for the update domain mapping method over gRPC. - - Updates the specified domain mapping. To map an SSL certificate - to a domain mapping, update ``certificate_id`` to point to an - ``AuthorizedCertificate`` resource. A user must be authorized to - administer the associated domain in order to update a - ``DomainMapping`` resource. - - Returns: - Callable[[~.UpdateDomainMappingRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_domain_mapping" not in self._stubs: - self._stubs["update_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/UpdateDomainMapping", - request_serializer=appengine.UpdateDomainMappingRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_domain_mapping"] - - @property - def delete_domain_mapping( - self, - ) -> Callable[[appengine.DeleteDomainMappingRequest], operations_pb2.Operation]: - r"""Return a callable for the delete domain mapping method over gRPC. - - Deletes the specified domain mapping. A user must be authorized - to administer the associated domain in order to delete a - ``DomainMapping`` resource. - - Returns: - Callable[[~.DeleteDomainMappingRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_domain_mapping" not in self._stubs: - self._stubs["delete_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/DeleteDomainMapping", - request_serializer=appengine.DeleteDomainMappingRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_domain_mapping"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("DomainMappingsGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py deleted file mode 100644 index 354aa54..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py +++ /dev/null @@ -1,406 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping - -from .base import DEFAULT_CLIENT_INFO, DomainMappingsTransport -from .grpc import DomainMappingsGrpcTransport - - -class DomainMappingsGrpcAsyncIOTransport(DomainMappingsTransport): - """gRPC AsyncIO backend transport for DomainMappings. - - Manages domains serving an application. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_domain_mappings( - self, - ) -> Callable[ - [appengine.ListDomainMappingsRequest], - Awaitable[appengine.ListDomainMappingsResponse], - ]: - r"""Return a callable for the list domain mappings method over gRPC. - - Lists the domain mappings on an application. - - Returns: - Callable[[~.ListDomainMappingsRequest], - Awaitable[~.ListDomainMappingsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_domain_mappings" not in self._stubs: - self._stubs["list_domain_mappings"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/ListDomainMappings", - request_serializer=appengine.ListDomainMappingsRequest.serialize, - response_deserializer=appengine.ListDomainMappingsResponse.deserialize, - ) - return self._stubs["list_domain_mappings"] - - @property - def get_domain_mapping( - self, - ) -> Callable[ - [appengine.GetDomainMappingRequest], Awaitable[domain_mapping.DomainMapping] - ]: - r"""Return a callable for the get domain mapping method over gRPC. - - Gets the specified domain mapping. - - Returns: - Callable[[~.GetDomainMappingRequest], - Awaitable[~.DomainMapping]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_domain_mapping" not in self._stubs: - self._stubs["get_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/GetDomainMapping", - request_serializer=appengine.GetDomainMappingRequest.serialize, - response_deserializer=domain_mapping.DomainMapping.deserialize, - ) - return self._stubs["get_domain_mapping"] - - @property - def create_domain_mapping( - self, - ) -> Callable[ - [appengine.CreateDomainMappingRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the create domain mapping method over gRPC. - - Maps a domain to an application. A user must be authorized to - administer a domain in order to map it to an application. For a - list of available authorized domains, see - ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - - Returns: - Callable[[~.CreateDomainMappingRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_domain_mapping" not in self._stubs: - self._stubs["create_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/CreateDomainMapping", - request_serializer=appengine.CreateDomainMappingRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["create_domain_mapping"] - - @property - def update_domain_mapping( - self, - ) -> Callable[ - [appengine.UpdateDomainMappingRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the update domain mapping method over gRPC. - - Updates the specified domain mapping. To map an SSL certificate - to a domain mapping, update ``certificate_id`` to point to an - ``AuthorizedCertificate`` resource. A user must be authorized to - administer the associated domain in order to update a - ``DomainMapping`` resource. - - Returns: - Callable[[~.UpdateDomainMappingRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_domain_mapping" not in self._stubs: - self._stubs["update_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/UpdateDomainMapping", - request_serializer=appengine.UpdateDomainMappingRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_domain_mapping"] - - @property - def delete_domain_mapping( - self, - ) -> Callable[ - [appengine.DeleteDomainMappingRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the delete domain mapping method over gRPC. - - Deletes the specified domain mapping. A user must be authorized - to administer the associated domain in order to delete a - ``DomainMapping`` resource. - - Returns: - Callable[[~.DeleteDomainMappingRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_domain_mapping" not in self._stubs: - self._stubs["delete_domain_mapping"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.DomainMappings/DeleteDomainMapping", - request_serializer=appengine.DeleteDomainMappingRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_domain_mapping"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("DomainMappingsGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py b/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py deleted file mode 100644 index 1b5f8b0..0000000 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/transports/rest.py +++ /dev/null @@ -1,837 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import ( - gapic_v1, - operations_v1, - path_template, - rest_helpers, - rest_streaming, -) -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.longrunning import operations_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping - -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO -from .base import DomainMappingsTransport - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class DomainMappingsRestInterceptor: - """Interceptor for DomainMappings. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the DomainMappingsRestTransport. - - .. code-block:: python - class MyCustomDomainMappingsInterceptor(DomainMappingsRestInterceptor): - def pre_create_domain_mapping(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_create_domain_mapping(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_delete_domain_mapping(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_delete_domain_mapping(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_domain_mapping(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_domain_mapping(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_domain_mappings(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_domain_mappings(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_domain_mapping(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_domain_mapping(self, response): - logging.log(f"Received response: {response}") - return response - - transport = DomainMappingsRestTransport(interceptor=MyCustomDomainMappingsInterceptor()) - client = DomainMappingsClient(transport=transport) - - - """ - - def pre_create_domain_mapping( - self, - request: appengine.CreateDomainMappingRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.CreateDomainMappingRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for create_domain_mapping - - Override in a subclass to manipulate the request or metadata - before they are sent to the DomainMappings server. - """ - return request, metadata - - def post_create_domain_mapping( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for create_domain_mapping - - Override in a subclass to manipulate the response - after it is returned by the DomainMappings server but before - it is returned to user code. - """ - return response - - def pre_delete_domain_mapping( - self, - request: appengine.DeleteDomainMappingRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.DeleteDomainMappingRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for delete_domain_mapping - - Override in a subclass to manipulate the request or metadata - before they are sent to the DomainMappings server. - """ - return request, metadata - - def post_delete_domain_mapping( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for delete_domain_mapping - - Override in a subclass to manipulate the response - after it is returned by the DomainMappings server but before - it is returned to user code. - """ - return response - - def pre_get_domain_mapping( - self, - request: appengine.GetDomainMappingRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.GetDomainMappingRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_domain_mapping - - Override in a subclass to manipulate the request or metadata - before they are sent to the DomainMappings server. - """ - return request, metadata - - def post_get_domain_mapping( - self, response: domain_mapping.DomainMapping - ) -> domain_mapping.DomainMapping: - """Post-rpc interceptor for get_domain_mapping - - Override in a subclass to manipulate the response - after it is returned by the DomainMappings server but before - it is returned to user code. - """ - return response - - def pre_list_domain_mappings( - self, - request: appengine.ListDomainMappingsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.ListDomainMappingsRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_domain_mappings - - Override in a subclass to manipulate the request or metadata - before they are sent to the DomainMappings server. - """ - return request, metadata - - def post_list_domain_mappings( - self, response: appengine.ListDomainMappingsResponse - ) -> appengine.ListDomainMappingsResponse: - """Post-rpc interceptor for list_domain_mappings - - Override in a subclass to manipulate the response - after it is returned by the DomainMappings server but before - it is returned to user code. - """ - return response - - def pre_update_domain_mapping( - self, - request: appengine.UpdateDomainMappingRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.UpdateDomainMappingRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for update_domain_mapping - - Override in a subclass to manipulate the request or metadata - before they are sent to the DomainMappings server. - """ - return request, metadata - - def post_update_domain_mapping( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for update_domain_mapping - - Override in a subclass to manipulate the response - after it is returned by the DomainMappings server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class DomainMappingsRestStub: - _session: AuthorizedSession - _host: str - _interceptor: DomainMappingsRestInterceptor - - -class DomainMappingsRestTransport(DomainMappingsTransport): - """REST backend transport for DomainMappings. - - Manages domains serving an application. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[DomainMappingsRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or DomainMappingsRestInterceptor() - self._prep_wrapped_messages(client_info) - - @property - def operations_client(self) -> operations_v1.AbstractOperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Only create a new client if we do not already have one. - if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = { - "google.longrunning.Operations.GetOperation": [ - { - "method": "get", - "uri": "/v1/{name=apps/*/operations/*}", - }, - ], - "google.longrunning.Operations.ListOperations": [ - { - "method": "get", - "uri": "/v1/{name=apps/*}/operations", - }, - ], - } - - rest_transport = operations_v1.OperationsRestTransport( - host=self._host, - # use the credentials which are saved - credentials=self._credentials, - scopes=self._scopes, - http_options=http_options, - path_prefix="v1", - ) - - self._operations_client = operations_v1.AbstractOperationsClient( - transport=rest_transport - ) - - # Return the client from cache. - return self._operations_client - - class _CreateDomainMapping(DomainMappingsRestStub): - def __hash__(self): - return hash("CreateDomainMapping") - - def __call__( - self, - request: appengine.CreateDomainMappingRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the create domain mapping method over HTTP. - - Args: - request (~.appengine.CreateDomainMappingRequest): - The request object. Request message for - ``DomainMappings.CreateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/{parent=apps/*}/domainMappings", - "body": "domain_mapping", - }, - ] - request, metadata = self._interceptor.pre_create_domain_mapping( - request, metadata - ) - pb_request = appengine.CreateDomainMappingRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_domain_mapping(resp) - return resp - - class _DeleteDomainMapping(DomainMappingsRestStub): - def __hash__(self): - return hash("DeleteDomainMapping") - - def __call__( - self, - request: appengine.DeleteDomainMappingRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the delete domain mapping method over HTTP. - - Args: - request (~.appengine.DeleteDomainMappingRequest): - The request object. Request message for - ``DomainMappings.DeleteDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "delete", - "uri": "/v1/{name=apps/*/domainMappings/*}", - }, - ] - request, metadata = self._interceptor.pre_delete_domain_mapping( - request, metadata - ) - pb_request = appengine.DeleteDomainMappingRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_delete_domain_mapping(resp) - return resp - - class _GetDomainMapping(DomainMappingsRestStub): - def __hash__(self): - return hash("GetDomainMapping") - - def __call__( - self, - request: appengine.GetDomainMappingRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> domain_mapping.DomainMapping: - r"""Call the get domain mapping method over HTTP. - - Args: - request (~.appengine.GetDomainMappingRequest): - The request object. Request message for ``DomainMappings.GetDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.domain_mapping.DomainMapping: - A domain serving an App Engine - application. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{name=apps/*/domainMappings/*}", - }, - ] - request, metadata = self._interceptor.pre_get_domain_mapping( - request, metadata - ) - pb_request = appengine.GetDomainMappingRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = domain_mapping.DomainMapping() - pb_resp = domain_mapping.DomainMapping.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_domain_mapping(resp) - return resp - - class _ListDomainMappings(DomainMappingsRestStub): - def __hash__(self): - return hash("ListDomainMappings") - - def __call__( - self, - request: appengine.ListDomainMappingsRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.ListDomainMappingsResponse: - r"""Call the list domain mappings method over HTTP. - - Args: - request (~.appengine.ListDomainMappingsRequest): - The request object. Request message for - ``DomainMappings.ListDomainMappings``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.ListDomainMappingsResponse: - Response message for - ``DomainMappings.ListDomainMappings``. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{parent=apps/*}/domainMappings", - }, - ] - request, metadata = self._interceptor.pre_list_domain_mappings( - request, metadata - ) - pb_request = appengine.ListDomainMappingsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.ListDomainMappingsResponse() - pb_resp = appengine.ListDomainMappingsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_domain_mappings(resp) - return resp - - class _UpdateDomainMapping(DomainMappingsRestStub): - def __hash__(self): - return hash("UpdateDomainMapping") - - def __call__( - self, - request: appengine.UpdateDomainMappingRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the update domain mapping method over HTTP. - - Args: - request (~.appengine.UpdateDomainMappingRequest): - The request object. Request message for - ``DomainMappings.UpdateDomainMapping``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "patch", - "uri": "/v1/{name=apps/*/domainMappings/*}", - "body": "domain_mapping", - }, - ] - request, metadata = self._interceptor.pre_update_domain_mapping( - request, metadata - ) - pb_request = appengine.UpdateDomainMappingRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_domain_mapping(resp) - return resp - - @property - def create_domain_mapping( - self, - ) -> Callable[[appengine.CreateDomainMappingRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CreateDomainMapping(self._session, self._host, self._interceptor) # type: ignore - - @property - def delete_domain_mapping( - self, - ) -> Callable[[appengine.DeleteDomainMappingRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteDomainMapping(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_domain_mapping( - self, - ) -> Callable[[appengine.GetDomainMappingRequest], domain_mapping.DomainMapping]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetDomainMapping(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_domain_mappings( - self, - ) -> Callable[ - [appengine.ListDomainMappingsRequest], appengine.ListDomainMappingsResponse - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListDomainMappings(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_domain_mapping( - self, - ) -> Callable[[appengine.UpdateDomainMappingRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateDomainMapping(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("DomainMappingsRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/__init__.py deleted file mode 100644 index 60b9383..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .async_client import FirewallAsyncClient -from .client import FirewallClient - -__all__ = ( - "FirewallClient", - "FirewallAsyncClient", -) diff --git a/google/cloud/appengine_admin_v1/services/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py deleted file mode 100644 index 8eb483c..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ /dev/null @@ -1,710 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import functools -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core.client_options import ClientOptions -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.cloud.appengine_admin_v1.services.firewall import pagers -from google.cloud.appengine_admin_v1.types import appengine, firewall - -from .client import FirewallClient -from .transports.base import DEFAULT_CLIENT_INFO, FirewallTransport -from .transports.grpc_asyncio import FirewallGrpcAsyncIOTransport - - -class FirewallAsyncClient: - """Firewall resources are used to define a collection of access - control rules for an Application. Each rule is defined with a - position which specifies the rule's order in the sequence of - rules, an IP range to be matched against requests, and an action - to take upon matching requests. - - Every request is evaluated against the Firewall rules in - priority order. Processesing stops at the first rule which - matches the request's IP address. A final rule always specifies - an action that applies to all remaining IP addresses. The - default final rule for a newly-created application will be set - to "allow" if not otherwise specified by the user. - """ - - _client: FirewallClient - - DEFAULT_ENDPOINT = FirewallClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = FirewallClient.DEFAULT_MTLS_ENDPOINT - - common_billing_account_path = staticmethod( - FirewallClient.common_billing_account_path - ) - parse_common_billing_account_path = staticmethod( - FirewallClient.parse_common_billing_account_path - ) - common_folder_path = staticmethod(FirewallClient.common_folder_path) - parse_common_folder_path = staticmethod(FirewallClient.parse_common_folder_path) - common_organization_path = staticmethod(FirewallClient.common_organization_path) - parse_common_organization_path = staticmethod( - FirewallClient.parse_common_organization_path - ) - common_project_path = staticmethod(FirewallClient.common_project_path) - parse_common_project_path = staticmethod(FirewallClient.parse_common_project_path) - common_location_path = staticmethod(FirewallClient.common_location_path) - parse_common_location_path = staticmethod(FirewallClient.parse_common_location_path) - - @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: - FirewallAsyncClient: The constructed client. - """ - return FirewallClient.from_service_account_info.__func__(FirewallAsyncClient, 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: - FirewallAsyncClient: The constructed client. - """ - return FirewallClient.from_service_account_file.__func__(FirewallAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return FirewallClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> FirewallTransport: - """Returns the transport used by the client instance. - - Returns: - FirewallTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(FirewallClient).get_transport_class, type(FirewallClient) - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, FirewallTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the firewall client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.FirewallTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = FirewallClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def list_ingress_rules( - self, - request: Optional[Union[appengine.ListIngressRulesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListIngressRulesAsyncPager: - r"""Lists the firewall rules of an application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_list_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListIngressRulesRequest( - ) - - # Make the request - page_result = client.list_ingress_rules(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]]): - The request object. Request message for ``Firewall.ListIngressRules``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.firewall.pagers.ListIngressRulesAsyncPager: - Response message for Firewall.ListIngressRules. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = appengine.ListIngressRulesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_ingress_rules, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListIngressRulesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def batch_update_ingress_rules( - self, - request: Optional[Union[appengine.BatchUpdateIngressRulesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.BatchUpdateIngressRulesResponse: - r"""Replaces the entire firewall ruleset in one bulk operation. This - overrides and replaces the rules of an existing firewall with - the new rules. - - If the final rule does not match traffic with the '*' wildcard - IP range, then an "allow all" rule is explicitly added to the - end of the list. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_batch_update_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.BatchUpdateIngressRulesRequest( - ) - - # Make the request - response = await client.batch_update_ingress_rules(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]]): - The request object. Request message for - ``Firewall.BatchUpdateIngressRules``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesResponse: - Response message for Firewall.UpdateAllIngressRules. - """ - # Create or coerce a protobuf request object. - request = appengine.BatchUpdateIngressRulesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_update_ingress_rules, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_ingress_rule( - self, - request: Optional[Union[appengine.CreateIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Creates a firewall rule for the application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_create_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateIngressRuleRequest( - ) - - # Make the request - response = await client.create_ingress_rule(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]]): - The request object. Request message for ``Firewall.CreateIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - # Create or coerce a protobuf request object. - request = appengine.CreateIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_ingress_rule, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_ingress_rule( - self, - request: Optional[Union[appengine.GetIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Gets the specified firewall rule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_get_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetIngressRuleRequest( - ) - - # Make the request - response = await client.get_ingress_rule(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]]): - The request object. Request message for ``Firewall.GetIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - # Create or coerce a protobuf request object. - request = appengine.GetIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_ingress_rule, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_ingress_rule( - self, - request: Optional[Union[appengine.UpdateIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Updates the specified firewall rule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_update_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateIngressRuleRequest( - ) - - # Make the request - response = await client.update_ingress_rule(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]]): - The request object. Request message for ``Firewall.UpdateIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - # Create or coerce a protobuf request object. - request = appengine.UpdateIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_ingress_rule, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_ingress_rule( - self, - request: Optional[Union[appengine.DeleteIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the specified firewall rule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_delete_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteIngressRuleRequest( - ) - - # Make the request - await client.delete_ingress_rule(request=request) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]]): - The request object. Request message for ``Firewall.DeleteIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - request = appengine.DeleteIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_ingress_rule, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def __aenter__(self) -> "FirewallAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("FirewallAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py deleted file mode 100644 index 4acd108..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ /dev/null @@ -1,940 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.cloud.appengine_admin_v1.services.firewall import pagers -from google.cloud.appengine_admin_v1.types import appengine, firewall - -from .transports.base import DEFAULT_CLIENT_INFO, FirewallTransport -from .transports.grpc import FirewallGrpcTransport -from .transports.grpc_asyncio import FirewallGrpcAsyncIOTransport -from .transports.rest import FirewallRestTransport - - -class FirewallClientMeta(type): - """Metaclass for the Firewall client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = OrderedDict() # type: Dict[str, Type[FirewallTransport]] - _transport_registry["grpc"] = FirewallGrpcTransport - _transport_registry["grpc_asyncio"] = FirewallGrpcAsyncIOTransport - _transport_registry["rest"] = FirewallRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[FirewallTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FirewallClient(metaclass=FirewallClientMeta): - """Firewall resources are used to define a collection of access - control rules for an Application. Each rule is defined with a - position which specifies the rule's order in the sequence of - rules, an IP range to be matched against requests, and an action - to take upon matching requests. - - Every request is evaluated against the Firewall rules in - priority order. Processesing stops at the first rule which - matches the request's IP address. A final rule always specifies - an action that applies to all remaining IP addresses. The - default final rule for a newly-created application will be set - to "allow" if not otherwise specified by the user. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - FirewallClient: 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 - 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: - FirewallClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FirewallTransport: - """Returns the transport used by the client instance. - - Returns: - FirewallTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, FirewallTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the firewall client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, FirewallTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FirewallTransport): - # transport is a FirewallTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_ingress_rules( - self, - request: Optional[Union[appengine.ListIngressRulesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListIngressRulesPager: - r"""Lists the firewall rules of an application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_list_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListIngressRulesRequest( - ) - - # Make the request - page_result = client.list_ingress_rules(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]): - The request object. Request message for ``Firewall.ListIngressRules``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.firewall.pagers.ListIngressRulesPager: - Response message for Firewall.ListIngressRules. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.ListIngressRulesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.ListIngressRulesRequest): - request = appengine.ListIngressRulesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_ingress_rules] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListIngressRulesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def batch_update_ingress_rules( - self, - request: Optional[Union[appengine.BatchUpdateIngressRulesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.BatchUpdateIngressRulesResponse: - r"""Replaces the entire firewall ruleset in one bulk operation. This - overrides and replaces the rules of an existing firewall with - the new rules. - - If the final rule does not match traffic with the '*' wildcard - IP range, then an "allow all" rule is explicitly added to the - end of the list. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_batch_update_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.BatchUpdateIngressRulesRequest( - ) - - # Make the request - response = client.batch_update_ingress_rules(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]): - The request object. Request message for - ``Firewall.BatchUpdateIngressRules``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesResponse: - Response message for Firewall.UpdateAllIngressRules. - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.BatchUpdateIngressRulesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.BatchUpdateIngressRulesRequest): - request = appengine.BatchUpdateIngressRulesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.batch_update_ingress_rules - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_ingress_rule( - self, - request: Optional[Union[appengine.CreateIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Creates a firewall rule for the application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_create_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateIngressRuleRequest( - ) - - # Make the request - response = client.create_ingress_rule(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]): - The request object. Request message for ``Firewall.CreateIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.CreateIngressRuleRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.CreateIngressRuleRequest): - request = appengine.CreateIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_ingress_rule] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_ingress_rule( - self, - request: Optional[Union[appengine.GetIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Gets the specified firewall rule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_get_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetIngressRuleRequest( - ) - - # Make the request - response = client.get_ingress_rule(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]): - The request object. Request message for ``Firewall.GetIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.GetIngressRuleRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.GetIngressRuleRequest): - request = appengine.GetIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_ingress_rule] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_ingress_rule( - self, - request: Optional[Union[appengine.UpdateIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Updates the specified firewall rule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_update_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateIngressRuleRequest( - ) - - # Make the request - response = client.update_ingress_rule(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]): - The request object. Request message for ``Firewall.UpdateIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.UpdateIngressRuleRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.UpdateIngressRuleRequest): - request = appengine.UpdateIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_ingress_rule] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_ingress_rule( - self, - request: Optional[Union[appengine.DeleteIngressRuleRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the specified firewall rule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_delete_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteIngressRuleRequest( - ) - - # Make the request - client.delete_ingress_rule(request=request) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): - The request object. Request message for ``Firewall.DeleteIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.DeleteIngressRuleRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.DeleteIngressRuleRequest): - request = appengine.DeleteIngressRuleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_ingress_rule] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def __enter__(self) -> "FirewallClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("FirewallClient",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/pagers.py b/google/cloud/appengine_admin_v1/services/firewall/pagers.py deleted file mode 100644 index 2cc3feb..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/pagers.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import ( - Any, - AsyncIterator, - Awaitable, - Callable, - Iterator, - Optional, - Sequence, - Tuple, -) - -from google.cloud.appengine_admin_v1.types import appengine, firewall - - -class ListIngressRulesPager: - """A pager for iterating through ``list_ingress_rules`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListIngressRulesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``ingress_rules`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListIngressRules`` requests and continue to iterate - through the ``ingress_rules`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListIngressRulesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., appengine.ListIngressRulesResponse], - request: appengine.ListIngressRulesRequest, - response: appengine.ListIngressRulesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListIngressRulesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListIngressRulesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListIngressRulesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[appengine.ListIngressRulesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[firewall.FirewallRule]: - for page in self.pages: - yield from page.ingress_rules - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListIngressRulesAsyncPager: - """A pager for iterating through ``list_ingress_rules`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListIngressRulesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``ingress_rules`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListIngressRules`` requests and continue to iterate - through the ``ingress_rules`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListIngressRulesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., Awaitable[appengine.ListIngressRulesResponse]], - request: appengine.ListIngressRulesRequest, - response: appengine.ListIngressRulesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListIngressRulesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListIngressRulesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListIngressRulesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[appengine.ListIngressRulesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[firewall.FirewallRule]: - async def async_generator(): - async for page in self.pages: - for response in page.ingress_rules: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py deleted file mode 100644 index 0e3e919..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import FirewallTransport -from .grpc import FirewallGrpcTransport -from .grpc_asyncio import FirewallGrpcAsyncIOTransport -from .rest import FirewallRestInterceptor, FirewallRestTransport - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[FirewallTransport]] -_transport_registry["grpc"] = FirewallGrpcTransport -_transport_registry["grpc_asyncio"] = FirewallGrpcAsyncIOTransport -_transport_registry["rest"] = FirewallRestTransport - -__all__ = ( - "FirewallTransport", - "FirewallGrpcTransport", - "FirewallGrpcAsyncIOTransport", - "FirewallRestTransport", - "FirewallRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py deleted file mode 100644 index 4789796..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ /dev/null @@ -1,236 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine, firewall - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class FirewallTransport(abc.ABC): - """Abstract transport class for Firewall.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_ingress_rules: gapic_v1.method.wrap_method( - self.list_ingress_rules, - default_timeout=None, - client_info=client_info, - ), - self.batch_update_ingress_rules: gapic_v1.method.wrap_method( - self.batch_update_ingress_rules, - default_timeout=None, - client_info=client_info, - ), - self.create_ingress_rule: gapic_v1.method.wrap_method( - self.create_ingress_rule, - default_timeout=None, - client_info=client_info, - ), - self.get_ingress_rule: gapic_v1.method.wrap_method( - self.get_ingress_rule, - default_timeout=None, - client_info=client_info, - ), - self.update_ingress_rule: gapic_v1.method.wrap_method( - self.update_ingress_rule, - default_timeout=None, - client_info=client_info, - ), - self.delete_ingress_rule: gapic_v1.method.wrap_method( - self.delete_ingress_rule, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def list_ingress_rules( - self, - ) -> Callable[ - [appengine.ListIngressRulesRequest], - Union[ - appengine.ListIngressRulesResponse, - Awaitable[appengine.ListIngressRulesResponse], - ], - ]: - raise NotImplementedError() - - @property - def batch_update_ingress_rules( - self, - ) -> Callable[ - [appengine.BatchUpdateIngressRulesRequest], - Union[ - appengine.BatchUpdateIngressRulesResponse, - Awaitable[appengine.BatchUpdateIngressRulesResponse], - ], - ]: - raise NotImplementedError() - - @property - def create_ingress_rule( - self, - ) -> Callable[ - [appengine.CreateIngressRuleRequest], - Union[firewall.FirewallRule, Awaitable[firewall.FirewallRule]], - ]: - raise NotImplementedError() - - @property - def get_ingress_rule( - self, - ) -> Callable[ - [appengine.GetIngressRuleRequest], - Union[firewall.FirewallRule, Awaitable[firewall.FirewallRule]], - ]: - raise NotImplementedError() - - @property - def update_ingress_rule( - self, - ) -> Callable[ - [appengine.UpdateIngressRuleRequest], - Union[firewall.FirewallRule, Awaitable[firewall.FirewallRule]], - ]: - raise NotImplementedError() - - @property - def delete_ingress_rule( - self, - ) -> Callable[ - [appengine.DeleteIngressRuleRequest], - Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("FirewallTransport",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py deleted file mode 100644 index eb28eed..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ /dev/null @@ -1,418 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.protobuf import empty_pb2 # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, firewall - -from .base import DEFAULT_CLIENT_INFO, FirewallTransport - - -class FirewallGrpcTransport(FirewallTransport): - """gRPC backend transport for Firewall. - - Firewall resources are used to define a collection of access - control rules for an Application. Each rule is defined with a - position which specifies the rule's order in the sequence of - rules, an IP range to be matched against requests, and an action - to take upon matching requests. - - Every request is evaluated against the Firewall rules in - priority order. Processesing stops at the first rule which - matches the request's IP address. A final rule always specifies - an action that applies to all remaining IP addresses. The - default final rule for a newly-created application will be set - to "allow" if not otherwise specified by the user. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def list_ingress_rules( - self, - ) -> Callable[ - [appengine.ListIngressRulesRequest], appengine.ListIngressRulesResponse - ]: - r"""Return a callable for the list ingress rules method over gRPC. - - Lists the firewall rules of an application. - - Returns: - Callable[[~.ListIngressRulesRequest], - ~.ListIngressRulesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_ingress_rules" not in self._stubs: - self._stubs["list_ingress_rules"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/ListIngressRules", - request_serializer=appengine.ListIngressRulesRequest.serialize, - response_deserializer=appengine.ListIngressRulesResponse.deserialize, - ) - return self._stubs["list_ingress_rules"] - - @property - def batch_update_ingress_rules( - self, - ) -> Callable[ - [appengine.BatchUpdateIngressRulesRequest], - appengine.BatchUpdateIngressRulesResponse, - ]: - r"""Return a callable for the batch update ingress rules method over gRPC. - - Replaces the entire firewall ruleset in one bulk operation. This - overrides and replaces the rules of an existing firewall with - the new rules. - - If the final rule does not match traffic with the '*' wildcard - IP range, then an "allow all" rule is explicitly added to the - end of the list. - - Returns: - Callable[[~.BatchUpdateIngressRulesRequest], - ~.BatchUpdateIngressRulesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "batch_update_ingress_rules" not in self._stubs: - self._stubs["batch_update_ingress_rules"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/BatchUpdateIngressRules", - request_serializer=appengine.BatchUpdateIngressRulesRequest.serialize, - response_deserializer=appengine.BatchUpdateIngressRulesResponse.deserialize, - ) - return self._stubs["batch_update_ingress_rules"] - - @property - def create_ingress_rule( - self, - ) -> Callable[[appengine.CreateIngressRuleRequest], firewall.FirewallRule]: - r"""Return a callable for the create ingress rule method over gRPC. - - Creates a firewall rule for the application. - - Returns: - Callable[[~.CreateIngressRuleRequest], - ~.FirewallRule]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_ingress_rule" not in self._stubs: - self._stubs["create_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/CreateIngressRule", - request_serializer=appengine.CreateIngressRuleRequest.serialize, - response_deserializer=firewall.FirewallRule.deserialize, - ) - return self._stubs["create_ingress_rule"] - - @property - def get_ingress_rule( - self, - ) -> Callable[[appengine.GetIngressRuleRequest], firewall.FirewallRule]: - r"""Return a callable for the get ingress rule method over gRPC. - - Gets the specified firewall rule. - - Returns: - Callable[[~.GetIngressRuleRequest], - ~.FirewallRule]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ingress_rule" not in self._stubs: - self._stubs["get_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/GetIngressRule", - request_serializer=appengine.GetIngressRuleRequest.serialize, - response_deserializer=firewall.FirewallRule.deserialize, - ) - return self._stubs["get_ingress_rule"] - - @property - def update_ingress_rule( - self, - ) -> Callable[[appengine.UpdateIngressRuleRequest], firewall.FirewallRule]: - r"""Return a callable for the update ingress rule method over gRPC. - - Updates the specified firewall rule. - - Returns: - Callable[[~.UpdateIngressRuleRequest], - ~.FirewallRule]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_ingress_rule" not in self._stubs: - self._stubs["update_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/UpdateIngressRule", - request_serializer=appengine.UpdateIngressRuleRequest.serialize, - response_deserializer=firewall.FirewallRule.deserialize, - ) - return self._stubs["update_ingress_rule"] - - @property - def delete_ingress_rule( - self, - ) -> Callable[[appengine.DeleteIngressRuleRequest], empty_pb2.Empty]: - r"""Return a callable for the delete ingress rule method over gRPC. - - Deletes the specified firewall rule. - - Returns: - Callable[[~.DeleteIngressRuleRequest], - ~.Empty]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_ingress_rule" not in self._stubs: - self._stubs["delete_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/DeleteIngressRule", - request_serializer=appengine.DeleteIngressRuleRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["delete_ingress_rule"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("FirewallGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py deleted file mode 100644 index 595906f..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py +++ /dev/null @@ -1,422 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.protobuf import empty_pb2 # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, firewall - -from .base import DEFAULT_CLIENT_INFO, FirewallTransport -from .grpc import FirewallGrpcTransport - - -class FirewallGrpcAsyncIOTransport(FirewallTransport): - """gRPC AsyncIO backend transport for Firewall. - - Firewall resources are used to define a collection of access - control rules for an Application. Each rule is defined with a - position which specifies the rule's order in the sequence of - rules, an IP range to be matched against requests, and an action - to take upon matching requests. - - Every request is evaluated against the Firewall rules in - priority order. Processesing stops at the first rule which - matches the request's IP address. A final rule always specifies - an action that applies to all remaining IP addresses. The - default final rule for a newly-created application will be set - to "allow" if not otherwise specified by the user. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def list_ingress_rules( - self, - ) -> Callable[ - [appengine.ListIngressRulesRequest], - Awaitable[appengine.ListIngressRulesResponse], - ]: - r"""Return a callable for the list ingress rules method over gRPC. - - Lists the firewall rules of an application. - - Returns: - Callable[[~.ListIngressRulesRequest], - Awaitable[~.ListIngressRulesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_ingress_rules" not in self._stubs: - self._stubs["list_ingress_rules"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/ListIngressRules", - request_serializer=appengine.ListIngressRulesRequest.serialize, - response_deserializer=appengine.ListIngressRulesResponse.deserialize, - ) - return self._stubs["list_ingress_rules"] - - @property - def batch_update_ingress_rules( - self, - ) -> Callable[ - [appengine.BatchUpdateIngressRulesRequest], - Awaitable[appengine.BatchUpdateIngressRulesResponse], - ]: - r"""Return a callable for the batch update ingress rules method over gRPC. - - Replaces the entire firewall ruleset in one bulk operation. This - overrides and replaces the rules of an existing firewall with - the new rules. - - If the final rule does not match traffic with the '*' wildcard - IP range, then an "allow all" rule is explicitly added to the - end of the list. - - Returns: - Callable[[~.BatchUpdateIngressRulesRequest], - Awaitable[~.BatchUpdateIngressRulesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "batch_update_ingress_rules" not in self._stubs: - self._stubs["batch_update_ingress_rules"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/BatchUpdateIngressRules", - request_serializer=appengine.BatchUpdateIngressRulesRequest.serialize, - response_deserializer=appengine.BatchUpdateIngressRulesResponse.deserialize, - ) - return self._stubs["batch_update_ingress_rules"] - - @property - def create_ingress_rule( - self, - ) -> Callable[ - [appengine.CreateIngressRuleRequest], Awaitable[firewall.FirewallRule] - ]: - r"""Return a callable for the create ingress rule method over gRPC. - - Creates a firewall rule for the application. - - Returns: - Callable[[~.CreateIngressRuleRequest], - Awaitable[~.FirewallRule]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_ingress_rule" not in self._stubs: - self._stubs["create_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/CreateIngressRule", - request_serializer=appengine.CreateIngressRuleRequest.serialize, - response_deserializer=firewall.FirewallRule.deserialize, - ) - return self._stubs["create_ingress_rule"] - - @property - def get_ingress_rule( - self, - ) -> Callable[[appengine.GetIngressRuleRequest], Awaitable[firewall.FirewallRule]]: - r"""Return a callable for the get ingress rule method over gRPC. - - Gets the specified firewall rule. - - Returns: - Callable[[~.GetIngressRuleRequest], - Awaitable[~.FirewallRule]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ingress_rule" not in self._stubs: - self._stubs["get_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/GetIngressRule", - request_serializer=appengine.GetIngressRuleRequest.serialize, - response_deserializer=firewall.FirewallRule.deserialize, - ) - return self._stubs["get_ingress_rule"] - - @property - def update_ingress_rule( - self, - ) -> Callable[ - [appengine.UpdateIngressRuleRequest], Awaitable[firewall.FirewallRule] - ]: - r"""Return a callable for the update ingress rule method over gRPC. - - Updates the specified firewall rule. - - Returns: - Callable[[~.UpdateIngressRuleRequest], - Awaitable[~.FirewallRule]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_ingress_rule" not in self._stubs: - self._stubs["update_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/UpdateIngressRule", - request_serializer=appengine.UpdateIngressRuleRequest.serialize, - response_deserializer=firewall.FirewallRule.deserialize, - ) - return self._stubs["update_ingress_rule"] - - @property - def delete_ingress_rule( - self, - ) -> Callable[[appengine.DeleteIngressRuleRequest], Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the delete ingress rule method over gRPC. - - Deletes the specified firewall rule. - - Returns: - Callable[[~.DeleteIngressRuleRequest], - Awaitable[~.Empty]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_ingress_rule" not in self._stubs: - self._stubs["delete_ingress_rule"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Firewall/DeleteIngressRule", - request_serializer=appengine.DeleteIngressRuleRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["delete_ingress_rule"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("FirewallGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py b/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py deleted file mode 100644 index f217721..0000000 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/rest.py +++ /dev/null @@ -1,905 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, firewall - -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO -from .base import FirewallTransport - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class FirewallRestInterceptor: - """Interceptor for Firewall. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the FirewallRestTransport. - - .. code-block:: python - class MyCustomFirewallInterceptor(FirewallRestInterceptor): - def pre_batch_update_ingress_rules(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_batch_update_ingress_rules(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_create_ingress_rule(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_create_ingress_rule(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_delete_ingress_rule(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def pre_get_ingress_rule(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_ingress_rule(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_ingress_rules(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_ingress_rules(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_ingress_rule(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_ingress_rule(self, response): - logging.log(f"Received response: {response}") - return response - - transport = FirewallRestTransport(interceptor=MyCustomFirewallInterceptor()) - client = FirewallClient(transport=transport) - - - """ - - def pre_batch_update_ingress_rules( - self, - request: appengine.BatchUpdateIngressRulesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.BatchUpdateIngressRulesRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for batch_update_ingress_rules - - Override in a subclass to manipulate the request or metadata - before they are sent to the Firewall server. - """ - return request, metadata - - def post_batch_update_ingress_rules( - self, response: appengine.BatchUpdateIngressRulesResponse - ) -> appengine.BatchUpdateIngressRulesResponse: - """Post-rpc interceptor for batch_update_ingress_rules - - Override in a subclass to manipulate the response - after it is returned by the Firewall server but before - it is returned to user code. - """ - return response - - def pre_create_ingress_rule( - self, - request: appengine.CreateIngressRuleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.CreateIngressRuleRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for create_ingress_rule - - Override in a subclass to manipulate the request or metadata - before they are sent to the Firewall server. - """ - return request, metadata - - def post_create_ingress_rule( - self, response: firewall.FirewallRule - ) -> firewall.FirewallRule: - """Post-rpc interceptor for create_ingress_rule - - Override in a subclass to manipulate the response - after it is returned by the Firewall server but before - it is returned to user code. - """ - return response - - def pre_delete_ingress_rule( - self, - request: appengine.DeleteIngressRuleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.DeleteIngressRuleRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for delete_ingress_rule - - Override in a subclass to manipulate the request or metadata - before they are sent to the Firewall server. - """ - return request, metadata - - def pre_get_ingress_rule( - self, - request: appengine.GetIngressRuleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.GetIngressRuleRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_ingress_rule - - Override in a subclass to manipulate the request or metadata - before they are sent to the Firewall server. - """ - return request, metadata - - def post_get_ingress_rule( - self, response: firewall.FirewallRule - ) -> firewall.FirewallRule: - """Post-rpc interceptor for get_ingress_rule - - Override in a subclass to manipulate the response - after it is returned by the Firewall server but before - it is returned to user code. - """ - return response - - def pre_list_ingress_rules( - self, - request: appengine.ListIngressRulesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.ListIngressRulesRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_ingress_rules - - Override in a subclass to manipulate the request or metadata - before they are sent to the Firewall server. - """ - return request, metadata - - def post_list_ingress_rules( - self, response: appengine.ListIngressRulesResponse - ) -> appengine.ListIngressRulesResponse: - """Post-rpc interceptor for list_ingress_rules - - Override in a subclass to manipulate the response - after it is returned by the Firewall server but before - it is returned to user code. - """ - return response - - def pre_update_ingress_rule( - self, - request: appengine.UpdateIngressRuleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.UpdateIngressRuleRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for update_ingress_rule - - Override in a subclass to manipulate the request or metadata - before they are sent to the Firewall server. - """ - return request, metadata - - def post_update_ingress_rule( - self, response: firewall.FirewallRule - ) -> firewall.FirewallRule: - """Post-rpc interceptor for update_ingress_rule - - Override in a subclass to manipulate the response - after it is returned by the Firewall server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class FirewallRestStub: - _session: AuthorizedSession - _host: str - _interceptor: FirewallRestInterceptor - - -class FirewallRestTransport(FirewallTransport): - """REST backend transport for Firewall. - - Firewall resources are used to define a collection of access - control rules for an Application. Each rule is defined with a - position which specifies the rule's order in the sequence of - rules, an IP range to be matched against requests, and an action - to take upon matching requests. - - Every request is evaluated against the Firewall rules in - priority order. Processesing stops at the first rule which - matches the request's IP address. A final rule always specifies - an action that applies to all remaining IP addresses. The - default final rule for a newly-created application will be set - to "allow" if not otherwise specified by the user. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[FirewallRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or FirewallRestInterceptor() - self._prep_wrapped_messages(client_info) - - class _BatchUpdateIngressRules(FirewallRestStub): - def __hash__(self): - return hash("BatchUpdateIngressRules") - - def __call__( - self, - request: appengine.BatchUpdateIngressRulesRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.BatchUpdateIngressRulesResponse: - r"""Call the batch update ingress - rules method over HTTP. - - Args: - request (~.appengine.BatchUpdateIngressRulesRequest): - The request object. Request message for - ``Firewall.BatchUpdateIngressRules``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.BatchUpdateIngressRulesResponse: - Response message for ``Firewall.UpdateAllIngressRules``. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/{name=apps/*/firewall/ingressRules}:batchUpdate", - "body": "*", - }, - ] - request, metadata = self._interceptor.pre_batch_update_ingress_rules( - request, metadata - ) - pb_request = appengine.BatchUpdateIngressRulesRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.BatchUpdateIngressRulesResponse() - pb_resp = appengine.BatchUpdateIngressRulesResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_batch_update_ingress_rules(resp) - return resp - - class _CreateIngressRule(FirewallRestStub): - def __hash__(self): - return hash("CreateIngressRule") - - def __call__( - self, - request: appengine.CreateIngressRuleRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Call the create ingress rule method over HTTP. - - Args: - request (~.appengine.CreateIngressRuleRequest): - The request object. Request message for ``Firewall.CreateIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.firewall.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/{parent=apps/*}/firewall/ingressRules", - "body": "rule", - }, - ] - request, metadata = self._interceptor.pre_create_ingress_rule( - request, metadata - ) - pb_request = appengine.CreateIngressRuleRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = firewall.FirewallRule() - pb_resp = firewall.FirewallRule.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_ingress_rule(resp) - return resp - - class _DeleteIngressRule(FirewallRestStub): - def __hash__(self): - return hash("DeleteIngressRule") - - def __call__( - self, - request: appengine.DeleteIngressRuleRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ): - r"""Call the delete ingress rule method over HTTP. - - Args: - request (~.appengine.DeleteIngressRuleRequest): - The request object. Request message for ``Firewall.DeleteIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "delete", - "uri": "/v1/{name=apps/*/firewall/ingressRules/*}", - }, - ] - request, metadata = self._interceptor.pre_delete_ingress_rule( - request, metadata - ) - pb_request = appengine.DeleteIngressRuleRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - class _GetIngressRule(FirewallRestStub): - def __hash__(self): - return hash("GetIngressRule") - - def __call__( - self, - request: appengine.GetIngressRuleRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Call the get ingress rule method over HTTP. - - Args: - request (~.appengine.GetIngressRuleRequest): - The request object. Request message for ``Firewall.GetIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.firewall.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{name=apps/*/firewall/ingressRules/*}", - }, - ] - request, metadata = self._interceptor.pre_get_ingress_rule( - request, metadata - ) - pb_request = appengine.GetIngressRuleRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = firewall.FirewallRule() - pb_resp = firewall.FirewallRule.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_ingress_rule(resp) - return resp - - class _ListIngressRules(FirewallRestStub): - def __hash__(self): - return hash("ListIngressRules") - - def __call__( - self, - request: appengine.ListIngressRulesRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.ListIngressRulesResponse: - r"""Call the list ingress rules method over HTTP. - - Args: - request (~.appengine.ListIngressRulesRequest): - The request object. Request message for ``Firewall.ListIngressRules``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.ListIngressRulesResponse: - Response message for ``Firewall.ListIngressRules``. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{parent=apps/*}/firewall/ingressRules", - }, - ] - request, metadata = self._interceptor.pre_list_ingress_rules( - request, metadata - ) - pb_request = appengine.ListIngressRulesRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.ListIngressRulesResponse() - pb_resp = appengine.ListIngressRulesResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_ingress_rules(resp) - return resp - - class _UpdateIngressRule(FirewallRestStub): - def __hash__(self): - return hash("UpdateIngressRule") - - def __call__( - self, - request: appengine.UpdateIngressRuleRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> firewall.FirewallRule: - r"""Call the update ingress rule method over HTTP. - - Args: - request (~.appengine.UpdateIngressRuleRequest): - The request object. Request message for ``Firewall.UpdateIngressRule``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.firewall.FirewallRule: - A single firewall rule that is - evaluated against incoming traffic and - provides an action to take on matched - requests. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "patch", - "uri": "/v1/{name=apps/*/firewall/ingressRules/*}", - "body": "rule", - }, - ] - request, metadata = self._interceptor.pre_update_ingress_rule( - request, metadata - ) - pb_request = appengine.UpdateIngressRuleRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = firewall.FirewallRule() - pb_resp = firewall.FirewallRule.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_ingress_rule(resp) - return resp - - @property - def batch_update_ingress_rules( - self, - ) -> Callable[ - [appengine.BatchUpdateIngressRulesRequest], - appengine.BatchUpdateIngressRulesResponse, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._BatchUpdateIngressRules(self._session, self._host, self._interceptor) # type: ignore - - @property - def create_ingress_rule( - self, - ) -> Callable[[appengine.CreateIngressRuleRequest], firewall.FirewallRule]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CreateIngressRule(self._session, self._host, self._interceptor) # type: ignore - - @property - def delete_ingress_rule( - self, - ) -> Callable[[appengine.DeleteIngressRuleRequest], empty_pb2.Empty]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteIngressRule(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_ingress_rule( - self, - ) -> Callable[[appengine.GetIngressRuleRequest], firewall.FirewallRule]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetIngressRule(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_ingress_rules( - self, - ) -> Callable[ - [appengine.ListIngressRulesRequest], appengine.ListIngressRulesResponse - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListIngressRules(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_ingress_rule( - self, - ) -> Callable[[appengine.UpdateIngressRuleRequest], firewall.FirewallRule]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateIngressRule(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("FirewallRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/instances/__init__.py b/google/cloud/appengine_admin_v1/services/instances/__init__.py deleted file mode 100644 index c006d66..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .async_client import InstancesAsyncClient -from .client import InstancesClient - -__all__ = ( - "InstancesClient", - "InstancesAsyncClient", -) diff --git a/google/cloud/appengine_admin_v1/services/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py deleted file mode 100644 index aaf0899..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ /dev/null @@ -1,617 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import functools -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core.client_options import ClientOptions -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.instances import pagers -from google.cloud.appengine_admin_v1.types import appengine, instance -from google.cloud.appengine_admin_v1.types import operation as ga_operation - -from .client import InstancesClient -from .transports.base import DEFAULT_CLIENT_INFO, InstancesTransport -from .transports.grpc_asyncio import InstancesGrpcAsyncIOTransport - - -class InstancesAsyncClient: - """Manages instances of a version.""" - - _client: InstancesClient - - DEFAULT_ENDPOINT = InstancesClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = InstancesClient.DEFAULT_MTLS_ENDPOINT - - instance_path = staticmethod(InstancesClient.instance_path) - parse_instance_path = staticmethod(InstancesClient.parse_instance_path) - common_billing_account_path = staticmethod( - InstancesClient.common_billing_account_path - ) - parse_common_billing_account_path = staticmethod( - InstancesClient.parse_common_billing_account_path - ) - common_folder_path = staticmethod(InstancesClient.common_folder_path) - parse_common_folder_path = staticmethod(InstancesClient.parse_common_folder_path) - common_organization_path = staticmethod(InstancesClient.common_organization_path) - parse_common_organization_path = staticmethod( - InstancesClient.parse_common_organization_path - ) - common_project_path = staticmethod(InstancesClient.common_project_path) - parse_common_project_path = staticmethod(InstancesClient.parse_common_project_path) - common_location_path = staticmethod(InstancesClient.common_location_path) - parse_common_location_path = staticmethod( - InstancesClient.parse_common_location_path - ) - - @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: - InstancesAsyncClient: The constructed client. - """ - return InstancesClient.from_service_account_info.__func__(InstancesAsyncClient, 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: - InstancesAsyncClient: The constructed client. - """ - return InstancesClient.from_service_account_file.__func__(InstancesAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return InstancesClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> InstancesTransport: - """Returns the transport used by the client instance. - - Returns: - InstancesTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(InstancesClient).get_transport_class, type(InstancesClient) - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, InstancesTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the instances client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.InstancesTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = InstancesClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def list_instances( - self, - request: Optional[Union[appengine.ListInstancesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListInstancesAsyncPager: - r"""Lists the instances of a version. - - Tip: To aggregate details about instances over time, see the - `Stackdriver Monitoring - API `__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_list_instances(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListInstancesRequest( - ) - - # Make the request - page_result = client.list_instances(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]]): - The request object. Request message for ``Instances.ListInstances``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.instances.pagers.ListInstancesAsyncPager: - Response message for Instances.ListInstances. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = appengine.ListInstancesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_instances, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListInstancesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_instance( - self, - request: Optional[Union[appengine.GetInstanceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> instance.Instance: - r"""Gets instance information. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_get_instance(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetInstanceRequest( - ) - - # Make the request - response = await client.get_instance(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]]): - The request object. Request message for ``Instances.GetInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Instance: - An Instance resource is the computing - unit that App Engine uses to - automatically scale an application. - - """ - # Create or coerce a protobuf request object. - request = appengine.GetInstanceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_instance, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_instance( - self, - request: Optional[Union[appengine.DeleteInstanceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Stops a running instance. - - The instance might be automatically recreated based on the - scaling settings of the version. For more information, see "How - Instances are Managed" (`standard - environment `__ - \| `flexible - environment `__). - - To ensure that instances are not re-created and avoid getting - billed, you can stop all instances within the target version by - changing the serving status of the version to ``STOPPED`` with - the - ```apps.services.versions.patch`` `__ - method. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_delete_instance(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteInstanceRequest( - ) - - # Make the request - operation = client.delete_instance(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]]): - The request object. Request message for ``Instances.DeleteInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - request = appengine.DeleteInstanceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_instance, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def debug_instance( - self, - request: Optional[Union[appengine.DebugInstanceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Enables debugging on a VM instance. This allows you - to use the SSH command to connect to the virtual machine - where the instance lives. While in "debug mode", the - instance continues to serve live traffic. You should - delete the instance when you are done debugging and then - allow the system to take over and determine if another - instance should be started. - - Only applicable for instances in App Engine flexible - environment. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_debug_instance(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DebugInstanceRequest( - ) - - # Make the request - operation = client.debug_instance(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]]): - The request object. Request message for ``Instances.DebugInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Instance` An Instance resource is the computing unit that App Engine uses to - automatically scale an application. - - """ - # Create or coerce a protobuf request object. - request = appengine.DebugInstanceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.debug_instance, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - instance.Instance, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "InstancesAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("InstancesAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py deleted file mode 100644 index 5de20d6..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ /dev/null @@ -1,863 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.instances import pagers -from google.cloud.appengine_admin_v1.types import appengine, instance -from google.cloud.appengine_admin_v1.types import operation as ga_operation - -from .transports.base import DEFAULT_CLIENT_INFO, InstancesTransport -from .transports.grpc import InstancesGrpcTransport -from .transports.grpc_asyncio import InstancesGrpcAsyncIOTransport -from .transports.rest import InstancesRestTransport - - -class InstancesClientMeta(type): - """Metaclass for the Instances client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = OrderedDict() # type: Dict[str, Type[InstancesTransport]] - _transport_registry["grpc"] = InstancesGrpcTransport - _transport_registry["grpc_asyncio"] = InstancesGrpcAsyncIOTransport - _transport_registry["rest"] = InstancesRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[InstancesTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class InstancesClient(metaclass=InstancesClientMeta): - """Manages instances of a version.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - InstancesClient: 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 - 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: - InstancesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> InstancesTransport: - """Returns the transport used by the client instance. - - Returns: - InstancesTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def instance_path( - app: str, - service: str, - version: str, - instance: str, - ) -> str: - """Returns a fully-qualified instance string.""" - return "apps/{app}/services/{service}/versions/{version}/instances/{instance}".format( - app=app, - service=service, - version=version, - instance=instance, - ) - - @staticmethod - def parse_instance_path(path: str) -> Dict[str, str]: - """Parses a instance path into its component segments.""" - m = re.match( - r"^apps/(?P.+?)/services/(?P.+?)/versions/(?P.+?)/instances/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, InstancesTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the instances client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, InstancesTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, InstancesTransport): - # transport is a InstancesTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_instances( - self, - request: Optional[Union[appengine.ListInstancesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListInstancesPager: - r"""Lists the instances of a version. - - Tip: To aggregate details about instances over time, see the - `Stackdriver Monitoring - API `__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_list_instances(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListInstancesRequest( - ) - - # Make the request - page_result = client.list_instances(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]): - The request object. Request message for ``Instances.ListInstances``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.instances.pagers.ListInstancesPager: - Response message for Instances.ListInstances. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.ListInstancesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.ListInstancesRequest): - request = appengine.ListInstancesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_instances] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListInstancesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_instance( - self, - request: Optional[Union[appengine.GetInstanceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> instance.Instance: - r"""Gets instance information. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_get_instance(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetInstanceRequest( - ) - - # Make the request - response = client.get_instance(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]): - The request object. Request message for ``Instances.GetInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Instance: - An Instance resource is the computing - unit that App Engine uses to - automatically scale an application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.GetInstanceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.GetInstanceRequest): - request = appengine.GetInstanceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_instance] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_instance( - self, - request: Optional[Union[appengine.DeleteInstanceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Stops a running instance. - - The instance might be automatically recreated based on the - scaling settings of the version. For more information, see "How - Instances are Managed" (`standard - environment `__ - \| `flexible - environment `__). - - To ensure that instances are not re-created and avoid getting - billed, you can stop all instances within the target version by - changing the serving status of the version to ``STOPPED`` with - the - ```apps.services.versions.patch`` `__ - method. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_delete_instance(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteInstanceRequest( - ) - - # Make the request - operation = client.delete_instance(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]): - The request object. Request message for ``Instances.DeleteInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.DeleteInstanceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.DeleteInstanceRequest): - request = appengine.DeleteInstanceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_instance] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def debug_instance( - self, - request: Optional[Union[appengine.DebugInstanceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Enables debugging on a VM instance. This allows you - to use the SSH command to connect to the virtual machine - where the instance lives. While in "debug mode", the - instance continues to serve live traffic. You should - delete the instance when you are done debugging and then - allow the system to take over and determine if another - instance should be started. - - Only applicable for instances in App Engine flexible - environment. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_debug_instance(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DebugInstanceRequest( - ) - - # Make the request - operation = client.debug_instance(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]): - The request object. Request message for ``Instances.DebugInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Instance` An Instance resource is the computing unit that App Engine uses to - automatically scale an application. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.DebugInstanceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.DebugInstanceRequest): - request = appengine.DebugInstanceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.debug_instance] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - instance.Instance, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "InstancesClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("InstancesClient",) diff --git a/google/cloud/appengine_admin_v1/services/instances/pagers.py b/google/cloud/appengine_admin_v1/services/instances/pagers.py deleted file mode 100644 index 7e52068..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/pagers.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import ( - Any, - AsyncIterator, - Awaitable, - Callable, - Iterator, - Optional, - Sequence, - Tuple, -) - -from google.cloud.appengine_admin_v1.types import appengine, instance - - -class ListInstancesPager: - """A pager for iterating through ``list_instances`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListInstancesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``instances`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListInstances`` requests and continue to iterate - through the ``instances`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListInstancesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., appengine.ListInstancesResponse], - request: appengine.ListInstancesRequest, - response: appengine.ListInstancesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListInstancesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListInstancesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListInstancesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[appengine.ListInstancesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[instance.Instance]: - for page in self.pages: - yield from page.instances - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListInstancesAsyncPager: - """A pager for iterating through ``list_instances`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListInstancesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``instances`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListInstances`` requests and continue to iterate - through the ``instances`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListInstancesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., Awaitable[appengine.ListInstancesResponse]], - request: appengine.ListInstancesRequest, - response: appengine.ListInstancesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListInstancesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListInstancesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListInstancesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[appengine.ListInstancesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[instance.Instance]: - async def async_generator(): - async for page in self.pages: - for response in page.instances: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py b/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py deleted file mode 100644 index 0a69646..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import InstancesTransport -from .grpc import InstancesGrpcTransport -from .grpc_asyncio import InstancesGrpcAsyncIOTransport -from .rest import InstancesRestInterceptor, InstancesRestTransport - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[InstancesTransport]] -_transport_registry["grpc"] = InstancesGrpcTransport -_transport_registry["grpc_asyncio"] = InstancesGrpcAsyncIOTransport -_transport_registry["rest"] = InstancesRestTransport - -__all__ = ( - "InstancesTransport", - "InstancesGrpcTransport", - "InstancesGrpcAsyncIOTransport", - "InstancesRestTransport", - "InstancesRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/base.py b/google/cloud/appengine_admin_v1/services/instances/transports/base.py deleted file mode 100644 index 12469df..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ /dev/null @@ -1,209 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1, operations_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine, instance - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class InstancesTransport(abc.ABC): - """Abstract transport class for Instances.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_instances: gapic_v1.method.wrap_method( - self.list_instances, - default_timeout=None, - client_info=client_info, - ), - self.get_instance: gapic_v1.method.wrap_method( - self.get_instance, - default_timeout=None, - client_info=client_info, - ), - self.delete_instance: gapic_v1.method.wrap_method( - self.delete_instance, - default_timeout=None, - client_info=client_info, - ), - self.debug_instance: gapic_v1.method.wrap_method( - self.debug_instance, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_instances( - self, - ) -> Callable[ - [appengine.ListInstancesRequest], - Union[ - appengine.ListInstancesResponse, Awaitable[appengine.ListInstancesResponse] - ], - ]: - raise NotImplementedError() - - @property - def get_instance( - self, - ) -> Callable[ - [appengine.GetInstanceRequest], - Union[instance.Instance, Awaitable[instance.Instance]], - ]: - raise NotImplementedError() - - @property - def delete_instance( - self, - ) -> Callable[ - [appengine.DeleteInstanceRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def debug_instance( - self, - ) -> Callable[ - [appengine.DebugInstanceRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("InstancesTransport",) diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py deleted file mode 100644 index d04d71b..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ /dev/null @@ -1,386 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers, operations_v1 -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, instance - -from .base import DEFAULT_CLIENT_INFO, InstancesTransport - - -class InstancesGrpcTransport(InstancesTransport): - """gRPC backend transport for Instances. - - Manages instances of a version. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient(self.grpc_channel) - - # Return the client from cache. - return self._operations_client - - @property - def list_instances( - self, - ) -> Callable[[appengine.ListInstancesRequest], appengine.ListInstancesResponse]: - r"""Return a callable for the list instances method over gRPC. - - Lists the instances of a version. - - Tip: To aggregate details about instances over time, see the - `Stackdriver Monitoring - API `__. - - Returns: - Callable[[~.ListInstancesRequest], - ~.ListInstancesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_instances" not in self._stubs: - self._stubs["list_instances"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/ListInstances", - request_serializer=appengine.ListInstancesRequest.serialize, - response_deserializer=appengine.ListInstancesResponse.deserialize, - ) - return self._stubs["list_instances"] - - @property - def get_instance( - self, - ) -> Callable[[appengine.GetInstanceRequest], instance.Instance]: - r"""Return a callable for the get instance method over gRPC. - - Gets instance information. - - Returns: - Callable[[~.GetInstanceRequest], - ~.Instance]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_instance" not in self._stubs: - self._stubs["get_instance"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/GetInstance", - request_serializer=appengine.GetInstanceRequest.serialize, - response_deserializer=instance.Instance.deserialize, - ) - return self._stubs["get_instance"] - - @property - def delete_instance( - self, - ) -> Callable[[appengine.DeleteInstanceRequest], operations_pb2.Operation]: - r"""Return a callable for the delete instance method over gRPC. - - Stops a running instance. - - The instance might be automatically recreated based on the - scaling settings of the version. For more information, see "How - Instances are Managed" (`standard - environment `__ - \| `flexible - environment `__). - - To ensure that instances are not re-created and avoid getting - billed, you can stop all instances within the target version by - changing the serving status of the version to ``STOPPED`` with - the - ```apps.services.versions.patch`` `__ - method. - - Returns: - Callable[[~.DeleteInstanceRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_instance" not in self._stubs: - self._stubs["delete_instance"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/DeleteInstance", - request_serializer=appengine.DeleteInstanceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_instance"] - - @property - def debug_instance( - self, - ) -> Callable[[appengine.DebugInstanceRequest], operations_pb2.Operation]: - r"""Return a callable for the debug instance method over gRPC. - - Enables debugging on a VM instance. This allows you - to use the SSH command to connect to the virtual machine - where the instance lives. While in "debug mode", the - instance continues to serve live traffic. You should - delete the instance when you are done debugging and then - allow the system to take over and determine if another - instance should be started. - - Only applicable for instances in App Engine flexible - environment. - - Returns: - Callable[[~.DebugInstanceRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "debug_instance" not in self._stubs: - self._stubs["debug_instance"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/DebugInstance", - request_serializer=appengine.DebugInstanceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["debug_instance"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("InstancesGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py deleted file mode 100644 index bd7b7a6..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py +++ /dev/null @@ -1,393 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, instance - -from .base import DEFAULT_CLIENT_INFO, InstancesTransport -from .grpc import InstancesGrpcTransport - - -class InstancesGrpcAsyncIOTransport(InstancesTransport): - """gRPC AsyncIO backend transport for Instances. - - Manages instances of a version. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_instances( - self, - ) -> Callable[ - [appengine.ListInstancesRequest], Awaitable[appengine.ListInstancesResponse] - ]: - r"""Return a callable for the list instances method over gRPC. - - Lists the instances of a version. - - Tip: To aggregate details about instances over time, see the - `Stackdriver Monitoring - API `__. - - Returns: - Callable[[~.ListInstancesRequest], - Awaitable[~.ListInstancesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_instances" not in self._stubs: - self._stubs["list_instances"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/ListInstances", - request_serializer=appengine.ListInstancesRequest.serialize, - response_deserializer=appengine.ListInstancesResponse.deserialize, - ) - return self._stubs["list_instances"] - - @property - def get_instance( - self, - ) -> Callable[[appengine.GetInstanceRequest], Awaitable[instance.Instance]]: - r"""Return a callable for the get instance method over gRPC. - - Gets instance information. - - Returns: - Callable[[~.GetInstanceRequest], - Awaitable[~.Instance]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_instance" not in self._stubs: - self._stubs["get_instance"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/GetInstance", - request_serializer=appengine.GetInstanceRequest.serialize, - response_deserializer=instance.Instance.deserialize, - ) - return self._stubs["get_instance"] - - @property - def delete_instance( - self, - ) -> Callable[ - [appengine.DeleteInstanceRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the delete instance method over gRPC. - - Stops a running instance. - - The instance might be automatically recreated based on the - scaling settings of the version. For more information, see "How - Instances are Managed" (`standard - environment `__ - \| `flexible - environment `__). - - To ensure that instances are not re-created and avoid getting - billed, you can stop all instances within the target version by - changing the serving status of the version to ``STOPPED`` with - the - ```apps.services.versions.patch`` `__ - method. - - Returns: - Callable[[~.DeleteInstanceRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_instance" not in self._stubs: - self._stubs["delete_instance"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/DeleteInstance", - request_serializer=appengine.DeleteInstanceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_instance"] - - @property - def debug_instance( - self, - ) -> Callable[ - [appengine.DebugInstanceRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the debug instance method over gRPC. - - Enables debugging on a VM instance. This allows you - to use the SSH command to connect to the virtual machine - where the instance lives. While in "debug mode", the - instance continues to serve live traffic. You should - delete the instance when you are done debugging and then - allow the system to take over and determine if another - instance should be started. - - Only applicable for instances in App Engine flexible - environment. - - Returns: - Callable[[~.DebugInstanceRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "debug_instance" not in self._stubs: - self._stubs["debug_instance"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Instances/DebugInstance", - request_serializer=appengine.DebugInstanceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["debug_instance"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("InstancesGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py b/google/cloud/appengine_admin_v1/services/instances/transports/rest.py deleted file mode 100644 index 85f1031..0000000 --- a/google/cloud/appengine_admin_v1/services/instances/transports/rest.py +++ /dev/null @@ -1,692 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import ( - gapic_v1, - operations_v1, - path_template, - rest_helpers, - rest_streaming, -) -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.longrunning import operations_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, instance - -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO -from .base import InstancesTransport - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class InstancesRestInterceptor: - """Interceptor for Instances. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the InstancesRestTransport. - - .. code-block:: python - class MyCustomInstancesInterceptor(InstancesRestInterceptor): - def pre_debug_instance(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_debug_instance(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_delete_instance(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_delete_instance(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_instance(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_instance(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_instances(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_instances(self, response): - logging.log(f"Received response: {response}") - return response - - transport = InstancesRestTransport(interceptor=MyCustomInstancesInterceptor()) - client = InstancesClient(transport=transport) - - - """ - - def pre_debug_instance( - self, - request: appengine.DebugInstanceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.DebugInstanceRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for debug_instance - - Override in a subclass to manipulate the request or metadata - before they are sent to the Instances server. - """ - return request, metadata - - def post_debug_instance( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for debug_instance - - Override in a subclass to manipulate the response - after it is returned by the Instances server but before - it is returned to user code. - """ - return response - - def pre_delete_instance( - self, - request: appengine.DeleteInstanceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.DeleteInstanceRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for delete_instance - - Override in a subclass to manipulate the request or metadata - before they are sent to the Instances server. - """ - return request, metadata - - def post_delete_instance( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for delete_instance - - Override in a subclass to manipulate the response - after it is returned by the Instances server but before - it is returned to user code. - """ - return response - - def pre_get_instance( - self, request: appengine.GetInstanceRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[appengine.GetInstanceRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_instance - - Override in a subclass to manipulate the request or metadata - before they are sent to the Instances server. - """ - return request, metadata - - def post_get_instance(self, response: instance.Instance) -> instance.Instance: - """Post-rpc interceptor for get_instance - - Override in a subclass to manipulate the response - after it is returned by the Instances server but before - it is returned to user code. - """ - return response - - def pre_list_instances( - self, - request: appengine.ListInstancesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.ListInstancesRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_instances - - Override in a subclass to manipulate the request or metadata - before they are sent to the Instances server. - """ - return request, metadata - - def post_list_instances( - self, response: appengine.ListInstancesResponse - ) -> appengine.ListInstancesResponse: - """Post-rpc interceptor for list_instances - - Override in a subclass to manipulate the response - after it is returned by the Instances server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class InstancesRestStub: - _session: AuthorizedSession - _host: str - _interceptor: InstancesRestInterceptor - - -class InstancesRestTransport(InstancesTransport): - """REST backend transport for Instances. - - Manages instances of a version. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[InstancesRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or InstancesRestInterceptor() - self._prep_wrapped_messages(client_info) - - @property - def operations_client(self) -> operations_v1.AbstractOperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Only create a new client if we do not already have one. - if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = { - "google.longrunning.Operations.GetOperation": [ - { - "method": "get", - "uri": "/v1/{name=apps/*/operations/*}", - }, - ], - "google.longrunning.Operations.ListOperations": [ - { - "method": "get", - "uri": "/v1/{name=apps/*}/operations", - }, - ], - } - - rest_transport = operations_v1.OperationsRestTransport( - host=self._host, - # use the credentials which are saved - credentials=self._credentials, - scopes=self._scopes, - http_options=http_options, - path_prefix="v1", - ) - - self._operations_client = operations_v1.AbstractOperationsClient( - transport=rest_transport - ) - - # Return the client from cache. - return self._operations_client - - class _DebugInstance(InstancesRestStub): - def __hash__(self): - return hash("DebugInstance") - - def __call__( - self, - request: appengine.DebugInstanceRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the debug instance method over HTTP. - - Args: - request (~.appengine.DebugInstanceRequest): - The request object. Request message for ``Instances.DebugInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/{name=apps/*/services/*/versions/*/instances/*}:debug", - "body": "*", - }, - ] - request, metadata = self._interceptor.pre_debug_instance(request, metadata) - pb_request = appengine.DebugInstanceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_debug_instance(resp) - return resp - - class _DeleteInstance(InstancesRestStub): - def __hash__(self): - return hash("DeleteInstance") - - def __call__( - self, - request: appengine.DeleteInstanceRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the delete instance method over HTTP. - - Args: - request (~.appengine.DeleteInstanceRequest): - The request object. Request message for ``Instances.DeleteInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "delete", - "uri": "/v1/{name=apps/*/services/*/versions/*/instances/*}", - }, - ] - request, metadata = self._interceptor.pre_delete_instance(request, metadata) - pb_request = appengine.DeleteInstanceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_delete_instance(resp) - return resp - - class _GetInstance(InstancesRestStub): - def __hash__(self): - return hash("GetInstance") - - def __call__( - self, - request: appengine.GetInstanceRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> instance.Instance: - r"""Call the get instance method over HTTP. - - Args: - request (~.appengine.GetInstanceRequest): - The request object. Request message for ``Instances.GetInstance``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.instance.Instance: - An Instance resource is the computing - unit that App Engine uses to - automatically scale an application. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{name=apps/*/services/*/versions/*/instances/*}", - }, - ] - request, metadata = self._interceptor.pre_get_instance(request, metadata) - pb_request = appengine.GetInstanceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = instance.Instance() - pb_resp = instance.Instance.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_instance(resp) - return resp - - class _ListInstances(InstancesRestStub): - def __hash__(self): - return hash("ListInstances") - - def __call__( - self, - request: appengine.ListInstancesRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.ListInstancesResponse: - r"""Call the list instances method over HTTP. - - Args: - request (~.appengine.ListInstancesRequest): - The request object. Request message for ``Instances.ListInstances``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.ListInstancesResponse: - Response message for ``Instances.ListInstances``. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{parent=apps/*/services/*/versions/*}/instances", - }, - ] - request, metadata = self._interceptor.pre_list_instances(request, metadata) - pb_request = appengine.ListInstancesRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.ListInstancesResponse() - pb_resp = appengine.ListInstancesResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_instances(resp) - return resp - - @property - def debug_instance( - self, - ) -> Callable[[appengine.DebugInstanceRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DebugInstance(self._session, self._host, self._interceptor) # type: ignore - - @property - def delete_instance( - self, - ) -> Callable[[appengine.DeleteInstanceRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteInstance(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_instance( - self, - ) -> Callable[[appengine.GetInstanceRequest], instance.Instance]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetInstance(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_instances( - self, - ) -> Callable[[appengine.ListInstancesRequest], appengine.ListInstancesResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListInstances(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("InstancesRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/services/__init__.py b/google/cloud/appengine_admin_v1/services/services/__init__.py deleted file mode 100644 index 274540b..0000000 --- a/google/cloud/appengine_admin_v1/services/services/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .async_client import ServicesAsyncClient -from .client import ServicesClient - -__all__ = ( - "ServicesClient", - "ServicesAsyncClient", -) diff --git a/google/cloud/appengine_admin_v1/services/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py deleted file mode 100644 index d7df912..0000000 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ /dev/null @@ -1,604 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import functools -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core.client_options import ClientOptions -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.services import pagers -from google.cloud.appengine_admin_v1.types import appengine, network_settings -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import service - -from .client import ServicesClient -from .transports.base import DEFAULT_CLIENT_INFO, ServicesTransport -from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport - - -class ServicesAsyncClient: - """Manages services of an application.""" - - _client: ServicesClient - - DEFAULT_ENDPOINT = ServicesClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = ServicesClient.DEFAULT_MTLS_ENDPOINT - - common_billing_account_path = staticmethod( - ServicesClient.common_billing_account_path - ) - parse_common_billing_account_path = staticmethod( - ServicesClient.parse_common_billing_account_path - ) - common_folder_path = staticmethod(ServicesClient.common_folder_path) - parse_common_folder_path = staticmethod(ServicesClient.parse_common_folder_path) - common_organization_path = staticmethod(ServicesClient.common_organization_path) - parse_common_organization_path = staticmethod( - ServicesClient.parse_common_organization_path - ) - common_project_path = staticmethod(ServicesClient.common_project_path) - parse_common_project_path = staticmethod(ServicesClient.parse_common_project_path) - common_location_path = staticmethod(ServicesClient.common_location_path) - parse_common_location_path = staticmethod(ServicesClient.parse_common_location_path) - - @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: - ServicesAsyncClient: The constructed client. - """ - return ServicesClient.from_service_account_info.__func__(ServicesAsyncClient, 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: - ServicesAsyncClient: The constructed client. - """ - return ServicesClient.from_service_account_file.__func__(ServicesAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return ServicesClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> ServicesTransport: - """Returns the transport used by the client instance. - - Returns: - ServicesTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(ServicesClient).get_transport_class, type(ServicesClient) - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ServicesTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the services client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.ServicesTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = ServicesClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def list_services( - self, - request: Optional[Union[appengine.ListServicesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListServicesAsyncPager: - r"""Lists all the services in the application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_list_services(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListServicesRequest( - ) - - # Make the request - page_result = client.list_services(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]]): - The request object. Request message for ``Services.ListServices``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.services.pagers.ListServicesAsyncPager: - Response message for Services.ListServices. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = appengine.ListServicesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_services, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListServicesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_service( - self, - request: Optional[Union[appengine.GetServiceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.Service: - r"""Gets the current configuration of the specified - service. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_get_service(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetServiceRequest( - ) - - # Make the request - response = await client.get_service(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]]): - The request object. Request message for ``Services.GetService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Service: - A Service resource is a logical - component of an application that can - share state and communicate in a secure - fashion with other services. For - example, an application that handles - customer requests might include separate - services to handle tasks such as backend - data analysis or API requests from - mobile devices. Each service has a - collection of versions that define a - specific set of code used to implement - the functionality of that service. - - """ - # Create or coerce a protobuf request object. - request = appengine.GetServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_service, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_service( - self, - request: Optional[Union[appengine.UpdateServiceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the configuration of the specified service. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_update_service(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateServiceRequest( - ) - - # Make the request - operation = client.update_service(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]]): - The request object. Request message for ``Services.UpdateService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Service` A Service resource is a logical component of an application that can share - state and communicate in a secure fashion with other - services. For example, an application that handles - customer requests might include separate services to - handle tasks such as backend data analysis or API - requests from mobile devices. Each service has a - collection of versions that define a specific set of - code used to implement the functionality of that - service. - - """ - # Create or coerce a protobuf request object. - request = appengine.UpdateServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_service, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - service.Service, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def delete_service( - self, - request: Optional[Union[appengine.DeleteServiceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Deletes the specified service and all enclosed - versions. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_delete_service(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteServiceRequest( - ) - - # Make the request - operation = client.delete_service(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]]): - The request object. Request message for ``Services.DeleteService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - request = appengine.DeleteServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_service, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "ServicesAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("ServicesAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py deleted file mode 100644 index 4a4fe68..0000000 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ /dev/null @@ -1,830 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.services import pagers -from google.cloud.appengine_admin_v1.types import appengine, network_settings -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import service - -from .transports.base import DEFAULT_CLIENT_INFO, ServicesTransport -from .transports.grpc import ServicesGrpcTransport -from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport -from .transports.rest import ServicesRestTransport - - -class ServicesClientMeta(type): - """Metaclass for the Services client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = OrderedDict() # type: Dict[str, Type[ServicesTransport]] - _transport_registry["grpc"] = ServicesGrpcTransport - _transport_registry["grpc_asyncio"] = ServicesGrpcAsyncIOTransport - _transport_registry["rest"] = ServicesRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[ServicesTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ServicesClient(metaclass=ServicesClientMeta): - """Manages services of an application.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - ServicesClient: 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 - 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: - ServicesClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ServicesTransport: - """Returns the transport used by the client instance. - - Returns: - ServicesTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, ServicesTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the services client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ServicesTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ServicesTransport): - # transport is a ServicesTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_services( - self, - request: Optional[Union[appengine.ListServicesRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListServicesPager: - r"""Lists all the services in the application. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_list_services(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListServicesRequest( - ) - - # Make the request - page_result = client.list_services(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]): - The request object. Request message for ``Services.ListServices``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.services.pagers.ListServicesPager: - Response message for Services.ListServices. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.ListServicesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.ListServicesRequest): - request = appengine.ListServicesRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_services] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListServicesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_service( - self, - request: Optional[Union[appengine.GetServiceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.Service: - r"""Gets the current configuration of the specified - service. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_get_service(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetServiceRequest( - ) - - # Make the request - response = client.get_service(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]): - The request object. Request message for ``Services.GetService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Service: - A Service resource is a logical - component of an application that can - share state and communicate in a secure - fashion with other services. For - example, an application that handles - customer requests might include separate - services to handle tasks such as backend - data analysis or API requests from - mobile devices. Each service has a - collection of versions that define a - specific set of code used to implement - the functionality of that service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.GetServiceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.GetServiceRequest): - request = appengine.GetServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_service] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_service( - self, - request: Optional[Union[appengine.UpdateServiceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Updates the configuration of the specified service. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_update_service(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateServiceRequest( - ) - - # Make the request - operation = client.update_service(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]): - The request object. Request message for ``Services.UpdateService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Service` A Service resource is a logical component of an application that can share - state and communicate in a secure fashion with other - services. For example, an application that handles - customer requests might include separate services to - handle tasks such as backend data analysis or API - requests from mobile devices. Each service has a - collection of versions that define a specific set of - code used to implement the functionality of that - service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.UpdateServiceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.UpdateServiceRequest): - request = appengine.UpdateServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_service] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - service.Service, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def delete_service( - self, - request: Optional[Union[appengine.DeleteServiceRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Deletes the specified service and all enclosed - versions. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_delete_service(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteServiceRequest( - ) - - # Make the request - operation = client.delete_service(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]): - The request object. Request message for ``Services.DeleteService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.DeleteServiceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.DeleteServiceRequest): - request = appengine.DeleteServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_service] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "ServicesClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("ServicesClient",) diff --git a/google/cloud/appengine_admin_v1/services/services/pagers.py b/google/cloud/appengine_admin_v1/services/services/pagers.py deleted file mode 100644 index dabb002..0000000 --- a/google/cloud/appengine_admin_v1/services/services/pagers.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import ( - Any, - AsyncIterator, - Awaitable, - Callable, - Iterator, - Optional, - Sequence, - Tuple, -) - -from google.cloud.appengine_admin_v1.types import appengine, service - - -class ListServicesPager: - """A pager for iterating through ``list_services`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListServicesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``services`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListServices`` requests and continue to iterate - through the ``services`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListServicesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., appengine.ListServicesResponse], - request: appengine.ListServicesRequest, - response: appengine.ListServicesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListServicesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListServicesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListServicesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[appengine.ListServicesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[service.Service]: - for page in self.pages: - yield from page.services - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListServicesAsyncPager: - """A pager for iterating through ``list_services`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListServicesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``services`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListServices`` requests and continue to iterate - through the ``services`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListServicesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., Awaitable[appengine.ListServicesResponse]], - request: appengine.ListServicesRequest, - response: appengine.ListServicesResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListServicesRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListServicesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListServicesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[appengine.ListServicesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[service.Service]: - async def async_generator(): - async for page in self.pages: - for response in page.services: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py b/google/cloud/appengine_admin_v1/services/services/transports/__init__.py deleted file mode 100644 index 75a0c0e..0000000 --- a/google/cloud/appengine_admin_v1/services/services/transports/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import ServicesTransport -from .grpc import ServicesGrpcTransport -from .grpc_asyncio import ServicesGrpcAsyncIOTransport -from .rest import ServicesRestInterceptor, ServicesRestTransport - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[ServicesTransport]] -_transport_registry["grpc"] = ServicesGrpcTransport -_transport_registry["grpc_asyncio"] = ServicesGrpcAsyncIOTransport -_transport_registry["rest"] = ServicesRestTransport - -__all__ = ( - "ServicesTransport", - "ServicesGrpcTransport", - "ServicesGrpcAsyncIOTransport", - "ServicesRestTransport", - "ServicesRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/services/transports/base.py b/google/cloud/appengine_admin_v1/services/services/transports/base.py deleted file mode 100644 index ad65cf2..0000000 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ /dev/null @@ -1,209 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1, operations_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine, service - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class ServicesTransport(abc.ABC): - """Abstract transport class for Services.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_services: gapic_v1.method.wrap_method( - self.list_services, - default_timeout=None, - client_info=client_info, - ), - self.get_service: gapic_v1.method.wrap_method( - self.get_service, - default_timeout=None, - client_info=client_info, - ), - self.update_service: gapic_v1.method.wrap_method( - self.update_service, - default_timeout=None, - client_info=client_info, - ), - self.delete_service: gapic_v1.method.wrap_method( - self.delete_service, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_services( - self, - ) -> Callable[ - [appengine.ListServicesRequest], - Union[ - appengine.ListServicesResponse, Awaitable[appengine.ListServicesResponse] - ], - ]: - raise NotImplementedError() - - @property - def get_service( - self, - ) -> Callable[ - [appengine.GetServiceRequest], - Union[service.Service, Awaitable[service.Service]], - ]: - raise NotImplementedError() - - @property - def update_service( - self, - ) -> Callable[ - [appengine.UpdateServiceRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def delete_service( - self, - ) -> Callable[ - [appengine.DeleteServiceRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("ServicesTransport",) diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py deleted file mode 100644 index 38a408c..0000000 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ /dev/null @@ -1,359 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers, operations_v1 -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, service - -from .base import DEFAULT_CLIENT_INFO, ServicesTransport - - -class ServicesGrpcTransport(ServicesTransport): - """gRPC backend transport for Services. - - Manages services of an application. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient(self.grpc_channel) - - # Return the client from cache. - return self._operations_client - - @property - def list_services( - self, - ) -> Callable[[appengine.ListServicesRequest], appengine.ListServicesResponse]: - r"""Return a callable for the list services method over gRPC. - - Lists all the services in the application. - - Returns: - Callable[[~.ListServicesRequest], - ~.ListServicesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_services" not in self._stubs: - self._stubs["list_services"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/ListServices", - request_serializer=appengine.ListServicesRequest.serialize, - response_deserializer=appengine.ListServicesResponse.deserialize, - ) - return self._stubs["list_services"] - - @property - def get_service(self) -> Callable[[appengine.GetServiceRequest], service.Service]: - r"""Return a callable for the get service method over gRPC. - - Gets the current configuration of the specified - service. - - Returns: - Callable[[~.GetServiceRequest], - ~.Service]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_service" not in self._stubs: - self._stubs["get_service"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/GetService", - request_serializer=appengine.GetServiceRequest.serialize, - response_deserializer=service.Service.deserialize, - ) - return self._stubs["get_service"] - - @property - def update_service( - self, - ) -> Callable[[appengine.UpdateServiceRequest], operations_pb2.Operation]: - r"""Return a callable for the update service method over gRPC. - - Updates the configuration of the specified service. - - Returns: - Callable[[~.UpdateServiceRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_service" not in self._stubs: - self._stubs["update_service"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/UpdateService", - request_serializer=appengine.UpdateServiceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_service"] - - @property - def delete_service( - self, - ) -> Callable[[appengine.DeleteServiceRequest], operations_pb2.Operation]: - r"""Return a callable for the delete service method over gRPC. - - Deletes the specified service and all enclosed - versions. - - Returns: - Callable[[~.DeleteServiceRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_service" not in self._stubs: - self._stubs["delete_service"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/DeleteService", - request_serializer=appengine.DeleteServiceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_service"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("ServicesGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py deleted file mode 100644 index a6a43b4..0000000 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py +++ /dev/null @@ -1,368 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, service - -from .base import DEFAULT_CLIENT_INFO, ServicesTransport -from .grpc import ServicesGrpcTransport - - -class ServicesGrpcAsyncIOTransport(ServicesTransport): - """gRPC AsyncIO backend transport for Services. - - Manages services of an application. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_services( - self, - ) -> Callable[ - [appengine.ListServicesRequest], Awaitable[appengine.ListServicesResponse] - ]: - r"""Return a callable for the list services method over gRPC. - - Lists all the services in the application. - - Returns: - Callable[[~.ListServicesRequest], - Awaitable[~.ListServicesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_services" not in self._stubs: - self._stubs["list_services"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/ListServices", - request_serializer=appengine.ListServicesRequest.serialize, - response_deserializer=appengine.ListServicesResponse.deserialize, - ) - return self._stubs["list_services"] - - @property - def get_service( - self, - ) -> Callable[[appengine.GetServiceRequest], Awaitable[service.Service]]: - r"""Return a callable for the get service method over gRPC. - - Gets the current configuration of the specified - service. - - Returns: - Callable[[~.GetServiceRequest], - Awaitable[~.Service]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_service" not in self._stubs: - self._stubs["get_service"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/GetService", - request_serializer=appengine.GetServiceRequest.serialize, - response_deserializer=service.Service.deserialize, - ) - return self._stubs["get_service"] - - @property - def update_service( - self, - ) -> Callable[ - [appengine.UpdateServiceRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the update service method over gRPC. - - Updates the configuration of the specified service. - - Returns: - Callable[[~.UpdateServiceRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_service" not in self._stubs: - self._stubs["update_service"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/UpdateService", - request_serializer=appengine.UpdateServiceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_service"] - - @property - def delete_service( - self, - ) -> Callable[ - [appengine.DeleteServiceRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the delete service method over gRPC. - - Deletes the specified service and all enclosed - versions. - - Returns: - Callable[[~.DeleteServiceRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_service" not in self._stubs: - self._stubs["delete_service"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Services/DeleteService", - request_serializer=appengine.DeleteServiceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_service"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("ServicesGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/services/transports/rest.py b/google/cloud/appengine_admin_v1/services/services/transports/rest.py deleted file mode 100644 index a497793..0000000 --- a/google/cloud/appengine_admin_v1/services/services/transports/rest.py +++ /dev/null @@ -1,699 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import ( - gapic_v1, - operations_v1, - path_template, - rest_helpers, - rest_streaming, -) -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.longrunning import operations_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, service - -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO -from .base import ServicesTransport - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class ServicesRestInterceptor: - """Interceptor for Services. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the ServicesRestTransport. - - .. code-block:: python - class MyCustomServicesInterceptor(ServicesRestInterceptor): - def pre_delete_service(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_delete_service(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_service(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_service(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_services(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_services(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_service(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_service(self, response): - logging.log(f"Received response: {response}") - return response - - transport = ServicesRestTransport(interceptor=MyCustomServicesInterceptor()) - client = ServicesClient(transport=transport) - - - """ - - def pre_delete_service( - self, - request: appengine.DeleteServiceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.DeleteServiceRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for delete_service - - Override in a subclass to manipulate the request or metadata - before they are sent to the Services server. - """ - return request, metadata - - def post_delete_service( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for delete_service - - Override in a subclass to manipulate the response - after it is returned by the Services server but before - it is returned to user code. - """ - return response - - def pre_get_service( - self, request: appengine.GetServiceRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[appengine.GetServiceRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_service - - Override in a subclass to manipulate the request or metadata - before they are sent to the Services server. - """ - return request, metadata - - def post_get_service(self, response: service.Service) -> service.Service: - """Post-rpc interceptor for get_service - - Override in a subclass to manipulate the response - after it is returned by the Services server but before - it is returned to user code. - """ - return response - - def pre_list_services( - self, - request: appengine.ListServicesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.ListServicesRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_services - - Override in a subclass to manipulate the request or metadata - before they are sent to the Services server. - """ - return request, metadata - - def post_list_services( - self, response: appengine.ListServicesResponse - ) -> appengine.ListServicesResponse: - """Post-rpc interceptor for list_services - - Override in a subclass to manipulate the response - after it is returned by the Services server but before - it is returned to user code. - """ - return response - - def pre_update_service( - self, - request: appengine.UpdateServiceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.UpdateServiceRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for update_service - - Override in a subclass to manipulate the request or metadata - before they are sent to the Services server. - """ - return request, metadata - - def post_update_service( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for update_service - - Override in a subclass to manipulate the response - after it is returned by the Services server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class ServicesRestStub: - _session: AuthorizedSession - _host: str - _interceptor: ServicesRestInterceptor - - -class ServicesRestTransport(ServicesTransport): - """REST backend transport for Services. - - Manages services of an application. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[ServicesRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or ServicesRestInterceptor() - self._prep_wrapped_messages(client_info) - - @property - def operations_client(self) -> operations_v1.AbstractOperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Only create a new client if we do not already have one. - if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = { - "google.longrunning.Operations.GetOperation": [ - { - "method": "get", - "uri": "/v1/{name=apps/*/operations/*}", - }, - ], - "google.longrunning.Operations.ListOperations": [ - { - "method": "get", - "uri": "/v1/{name=apps/*}/operations", - }, - ], - } - - rest_transport = operations_v1.OperationsRestTransport( - host=self._host, - # use the credentials which are saved - credentials=self._credentials, - scopes=self._scopes, - http_options=http_options, - path_prefix="v1", - ) - - self._operations_client = operations_v1.AbstractOperationsClient( - transport=rest_transport - ) - - # Return the client from cache. - return self._operations_client - - class _DeleteService(ServicesRestStub): - def __hash__(self): - return hash("DeleteService") - - def __call__( - self, - request: appengine.DeleteServiceRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the delete service method over HTTP. - - Args: - request (~.appengine.DeleteServiceRequest): - The request object. Request message for ``Services.DeleteService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "delete", - "uri": "/v1/{name=apps/*/services/*}", - }, - ] - request, metadata = self._interceptor.pre_delete_service(request, metadata) - pb_request = appengine.DeleteServiceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_delete_service(resp) - return resp - - class _GetService(ServicesRestStub): - def __hash__(self): - return hash("GetService") - - def __call__( - self, - request: appengine.GetServiceRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.Service: - r"""Call the get service method over HTTP. - - Args: - request (~.appengine.GetServiceRequest): - The request object. Request message for ``Services.GetService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.service.Service: - A Service resource is a logical - component of an application that can - share state and communicate in a secure - fashion with other services. For - example, an application that handles - customer requests might include separate - services to handle tasks such as backend - data analysis or API requests from - mobile devices. Each service has a - collection of versions that define a - specific set of code used to implement - the functionality of that service. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{name=apps/*/services/*}", - }, - ] - request, metadata = self._interceptor.pre_get_service(request, metadata) - pb_request = appengine.GetServiceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = service.Service() - pb_resp = service.Service.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_service(resp) - return resp - - class _ListServices(ServicesRestStub): - def __hash__(self): - return hash("ListServices") - - def __call__( - self, - request: appengine.ListServicesRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.ListServicesResponse: - r"""Call the list services method over HTTP. - - Args: - request (~.appengine.ListServicesRequest): - The request object. Request message for ``Services.ListServices``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.ListServicesResponse: - Response message for ``Services.ListServices``. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{parent=apps/*}/services", - }, - ] - request, metadata = self._interceptor.pre_list_services(request, metadata) - pb_request = appengine.ListServicesRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.ListServicesResponse() - pb_resp = appengine.ListServicesResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_services(resp) - return resp - - class _UpdateService(ServicesRestStub): - def __hash__(self): - return hash("UpdateService") - - def __call__( - self, - request: appengine.UpdateServiceRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the update service method over HTTP. - - Args: - request (~.appengine.UpdateServiceRequest): - The request object. Request message for ``Services.UpdateService``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "patch", - "uri": "/v1/{name=apps/*/services/*}", - "body": "service", - }, - ] - request, metadata = self._interceptor.pre_update_service(request, metadata) - pb_request = appengine.UpdateServiceRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_service(resp) - return resp - - @property - def delete_service( - self, - ) -> Callable[[appengine.DeleteServiceRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteService(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_service(self) -> Callable[[appengine.GetServiceRequest], service.Service]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetService(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_services( - self, - ) -> Callable[[appengine.ListServicesRequest], appengine.ListServicesResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListServices(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_service( - self, - ) -> Callable[[appengine.UpdateServiceRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateService(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("ServicesRestTransport",) diff --git a/google/cloud/appengine_admin_v1/services/versions/__init__.py b/google/cloud/appengine_admin_v1/services/versions/__init__.py deleted file mode 100644 index 1072721..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .async_client import VersionsAsyncClient -from .client import VersionsClient - -__all__ = ( - "VersionsClient", - "VersionsAsyncClient", -) diff --git a/google/cloud/appengine_admin_v1/services/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py deleted file mode 100644 index 04ce197..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ /dev/null @@ -1,717 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import functools -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, -) - -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core.client_options import ClientOptions -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.versions import pagers -from google.cloud.appengine_admin_v1.types import app_yaml, appengine, deploy -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import version - -from .client import VersionsClient -from .transports.base import DEFAULT_CLIENT_INFO, VersionsTransport -from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport - - -class VersionsAsyncClient: - """Manages versions of a service.""" - - _client: VersionsClient - - DEFAULT_ENDPOINT = VersionsClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = VersionsClient.DEFAULT_MTLS_ENDPOINT - - common_billing_account_path = staticmethod( - VersionsClient.common_billing_account_path - ) - parse_common_billing_account_path = staticmethod( - VersionsClient.parse_common_billing_account_path - ) - common_folder_path = staticmethod(VersionsClient.common_folder_path) - parse_common_folder_path = staticmethod(VersionsClient.parse_common_folder_path) - common_organization_path = staticmethod(VersionsClient.common_organization_path) - parse_common_organization_path = staticmethod( - VersionsClient.parse_common_organization_path - ) - common_project_path = staticmethod(VersionsClient.common_project_path) - parse_common_project_path = staticmethod(VersionsClient.parse_common_project_path) - common_location_path = staticmethod(VersionsClient.common_location_path) - parse_common_location_path = staticmethod(VersionsClient.parse_common_location_path) - - @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: - VersionsAsyncClient: The constructed client. - """ - return VersionsClient.from_service_account_info.__func__(VersionsAsyncClient, 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: - VersionsAsyncClient: The constructed client. - """ - return VersionsClient.from_service_account_file.__func__(VersionsAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return VersionsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> VersionsTransport: - """Returns the transport used by the client instance. - - Returns: - VersionsTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial( - type(VersionsClient).get_transport_class, type(VersionsClient) - ) - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, VersionsTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the versions client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, ~.VersionsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = VersionsClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - ) - - async def list_versions( - self, - request: Optional[Union[appengine.ListVersionsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListVersionsAsyncPager: - r"""Lists the versions of a service. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_list_versions(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListVersionsRequest( - ) - - # Make the request - page_result = client.list_versions(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]]): - The request object. Request message for ``Versions.ListVersions``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.versions.pagers.ListVersionsAsyncPager: - Response message for Versions.ListVersions. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = appengine.ListVersionsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_versions, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListVersionsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_version( - self, - request: Optional[Union[appengine.GetVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> version.Version: - r"""Gets the specified Version resource. By default, only a - ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` - parameter to get the full resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_get_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetVersionRequest( - ) - - # Make the request - response = await client.get_version(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]]): - The request object. Request message for ``Versions.GetVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Version: - A Version resource is a specific set - of source code and configuration files - that are deployed into a service. - - """ - # Create or coerce a protobuf request object. - request = appengine.GetVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_version, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_version( - self, - request: Optional[Union[appengine.CreateVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Deploys code and resource files to a new version. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_create_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateVersionRequest( - ) - - # Make the request - operation = client.create_version(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]]): - The request object. Request message for ``Versions.CreateVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Version` A Version resource is a specific set of source code and configuration files - that are deployed into a service. - - """ - # Create or coerce a protobuf request object. - request = appengine.CreateVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_version, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - version.Version, - metadata_type=ga_operation.CreateVersionMetadataV1, - ) - - # Done; return the response. - return response - - async def update_version( - self, - request: Optional[Union[appengine.UpdateVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the specified Version resource. You can specify the - following fields depending on the App Engine environment and - type of scaling that the version resource uses: - - **Standard environment** - - - ```instance_class`` `__ - - *automatic scaling* in the standard environment: - - - ```automatic_scaling.min_idle_instances`` `__ - - ```automatic_scaling.max_idle_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.max_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.min_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.target_cpu_utilization`` `__ - - ```automaticScaling.standard_scheduler_settings.target_throughput_utilization`` `__ - - *basic scaling* or *manual scaling* in the standard environment: - - - ```serving_status`` `__ - - ```manual_scaling.instances`` `__ - - **Flexible environment** - - - ```serving_status`` `__ - - *automatic scaling* in the flexible environment: - - - ```automatic_scaling.min_total_instances`` `__ - - ```automatic_scaling.max_total_instances`` `__ - - ```automatic_scaling.cool_down_period_sec`` `__ - - ```automatic_scaling.cpu_utilization.target_utilization`` `__ - - *manual scaling* in the flexible environment: - - - ```manual_scaling.instances`` `__ - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_update_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateVersionRequest( - ) - - # Make the request - operation = client.update_version(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]]): - The request object. Request message for ``Versions.UpdateVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Version` A Version resource is a specific set of source code and configuration files - that are deployed into a service. - - """ - # Create or coerce a protobuf request object. - request = appengine.UpdateVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_version, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - version.Version, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def delete_version( - self, - request: Optional[Union[appengine.DeleteVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Deletes an existing Version resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - async def sample_delete_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteVersionRequest( - ) - - # Make the request - operation = client.delete_version(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]]): - The request object. Request message for ``Versions.DeleteVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - request = appengine.DeleteVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_version, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - async def __aenter__(self) -> "VersionsAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("VersionsAsyncClient",) diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py deleted file mode 100644 index 5cb28f2..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ /dev/null @@ -1,944 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -import os -import re -from typing import ( - Dict, - Mapping, - MutableMapping, - MutableSequence, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation as gac_operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.services.versions import pagers -from google.cloud.appengine_admin_v1.types import app_yaml, appengine, deploy -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import version - -from .transports.base import DEFAULT_CLIENT_INFO, VersionsTransport -from .transports.grpc import VersionsGrpcTransport -from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport -from .transports.rest import VersionsRestTransport - - -class VersionsClientMeta(type): - """Metaclass for the Versions client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = OrderedDict() # type: Dict[str, Type[VersionsTransport]] - _transport_registry["grpc"] = VersionsGrpcTransport - _transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport - _transport_registry["rest"] = VersionsRestTransport - - def get_transport_class( - cls, - label: Optional[str] = None, - ) -> Type[VersionsTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class VersionsClient(metaclass=VersionsClientMeta): - """Manages versions of a service.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "appengine.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - 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: - VersionsClient: 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 - 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: - VersionsClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> VersionsTransport: - """Returns the transport used by the client instance. - - Returns: - VersionsTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path( - billing_account: str, - ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path( - folder: str, - ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format( - folder=folder, - ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path( - organization: str, - ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format( - organization=organization, - ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path( - project: str, - ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format( - project=project, - ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source( - cls, client_options: Optional[client_options_lib.ClientOptions] = None - ): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError( - "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" - ) - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or ( - use_mtls_endpoint == "auto" and client_cert_source - ): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__( - self, - *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, VersionsTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the versions client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - 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, VersionsTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - 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: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( - client_options - ) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError( - "client_options.api_key and credentials are mutually exclusive" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, VersionsTransport): - # transport is a VersionsTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr( - google.auth._default, "get_api_key_credentials" - ): - credentials = google.auth._default.get_api_key_credentials( - api_key_value - ) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_versions( - self, - request: Optional[Union[appengine.ListVersionsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListVersionsPager: - r"""Lists the versions of a service. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_list_versions(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListVersionsRequest( - ) - - # Make the request - page_result = client.list_versions(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]): - The request object. Request message for ``Versions.ListVersions``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.services.versions.pagers.ListVersionsPager: - Response message for Versions.ListVersions. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.ListVersionsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.ListVersionsRequest): - request = appengine.ListVersionsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_versions] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListVersionsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_version( - self, - request: Optional[Union[appengine.GetVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> version.Version: - r"""Gets the specified Version resource. By default, only a - ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` - parameter to get the full resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_get_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetVersionRequest( - ) - - # Make the request - response = client.get_version(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]): - The request object. Request message for ``Versions.GetVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.appengine_admin_v1.types.Version: - A Version resource is a specific set - of source code and configuration files - that are deployed into a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.GetVersionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.GetVersionRequest): - request = appengine.GetVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_version] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_version( - self, - request: Optional[Union[appengine.CreateVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Deploys code and resource files to a new version. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_create_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateVersionRequest( - ) - - # Make the request - operation = client.create_version(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]): - The request object. Request message for ``Versions.CreateVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Version` A Version resource is a specific set of source code and configuration files - that are deployed into a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.CreateVersionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.CreateVersionRequest): - request = appengine.CreateVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_version] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - version.Version, - metadata_type=ga_operation.CreateVersionMetadataV1, - ) - - # Done; return the response. - return response - - def update_version( - self, - request: Optional[Union[appengine.UpdateVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Updates the specified Version resource. You can specify the - following fields depending on the App Engine environment and - type of scaling that the version resource uses: - - **Standard environment** - - - ```instance_class`` `__ - - *automatic scaling* in the standard environment: - - - ```automatic_scaling.min_idle_instances`` `__ - - ```automatic_scaling.max_idle_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.max_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.min_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.target_cpu_utilization`` `__ - - ```automaticScaling.standard_scheduler_settings.target_throughput_utilization`` `__ - - *basic scaling* or *manual scaling* in the standard environment: - - - ```serving_status`` `__ - - ```manual_scaling.instances`` `__ - - **Flexible environment** - - - ```serving_status`` `__ - - *automatic scaling* in the flexible environment: - - - ```automatic_scaling.min_total_instances`` `__ - - ```automatic_scaling.max_total_instances`` `__ - - ```automatic_scaling.cool_down_period_sec`` `__ - - ```automatic_scaling.cpu_utilization.target_utilization`` `__ - - *manual scaling* in the flexible environment: - - - ```manual_scaling.instances`` `__ - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_update_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateVersionRequest( - ) - - # Make the request - operation = client.update_version(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]): - The request object. Request message for ``Versions.UpdateVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Version` A Version resource is a specific set of source code and configuration files - that are deployed into a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.UpdateVersionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.UpdateVersionRequest): - request = appengine.UpdateVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_version] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - version.Version, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def delete_version( - self, - request: Optional[Union[appengine.DeleteVersionRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gac_operation.Operation: - r"""Deletes an existing Version resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import appengine_admin_v1 - - def sample_delete_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteVersionRequest( - ) - - # Make the request - operation = client.delete_version(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]): - The request object. Request message for ``Versions.DeleteVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a appengine.DeleteVersionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, appengine.DeleteVersionRequest): - request = appengine.DeleteVersionRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_version] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = gac_operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=ga_operation.OperationMetadataV1, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "VersionsClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -__all__ = ("VersionsClient",) diff --git a/google/cloud/appengine_admin_v1/services/versions/pagers.py b/google/cloud/appengine_admin_v1/services/versions/pagers.py deleted file mode 100644 index 6c43d9e..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/pagers.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import ( - Any, - AsyncIterator, - Awaitable, - Callable, - Iterator, - Optional, - Sequence, - Tuple, -) - -from google.cloud.appengine_admin_v1.types import appengine, version - - -class ListVersionsPager: - """A pager for iterating through ``list_versions`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListVersionsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``versions`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListVersions`` requests and continue to iterate - through the ``versions`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListVersionsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., appengine.ListVersionsResponse], - request: appengine.ListVersionsRequest, - response: appengine.ListVersionsResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListVersionsRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListVersionsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListVersionsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[appengine.ListVersionsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[version.Version]: - for page in self.pages: - yield from page.versions - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListVersionsAsyncPager: - """A pager for iterating through ``list_versions`` requests. - - This class thinly wraps an initial - :class:`google.cloud.appengine_admin_v1.types.ListVersionsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``versions`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListVersions`` requests and continue to iterate - through the ``versions`` field on the - corresponding responses. - - All the usual :class:`google.cloud.appengine_admin_v1.types.ListVersionsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., Awaitable[appengine.ListVersionsResponse]], - request: appengine.ListVersionsRequest, - response: appengine.ListVersionsResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.appengine_admin_v1.types.ListVersionsRequest): - The initial request object. - response (google.cloud.appengine_admin_v1.types.ListVersionsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = appengine.ListVersionsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[appengine.ListVersionsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[version.Version]: - async def async_generator(): - async for page in self.pages: - for response in page.versions: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py b/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py deleted file mode 100644 index a4b6bc5..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import VersionsTransport -from .grpc import VersionsGrpcTransport -from .grpc_asyncio import VersionsGrpcAsyncIOTransport -from .rest import VersionsRestInterceptor, VersionsRestTransport - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[VersionsTransport]] -_transport_registry["grpc"] = VersionsGrpcTransport -_transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport -_transport_registry["rest"] = VersionsRestTransport - -__all__ = ( - "VersionsTransport", - "VersionsGrpcTransport", - "VersionsGrpcAsyncIOTransport", - "VersionsRestTransport", - "VersionsRestInterceptor", -) diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/base.py b/google/cloud/appengine_admin_v1/services/versions/transports/base.py deleted file mode 100644 index bda3ac2..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ /dev/null @@ -1,223 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1, operations_v1 -from google.api_core import retry as retries -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.appengine_admin_v1 import gapic_version as package_version -from google.cloud.appengine_admin_v1.types import appengine, version - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=package_version.__version__ -) - - -class VersionsTransport(abc.ABC): - """Abstract transport class for Versions.""" - - AUTH_SCOPES = ( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ) - - DEFAULT_HOST: str = "appengine.googleapis.com" - - def __init__( - self, - *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs( - "'credentials_file' and 'credentials' are mutually exclusive" - ) - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id - ) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience( - api_audience if api_audience else host - ) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if ( - always_use_jwt_access - and isinstance(credentials, service_account.Credentials) - and hasattr(service_account.Credentials, "with_always_use_jwt_access") - ): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_versions: gapic_v1.method.wrap_method( - self.list_versions, - default_timeout=None, - client_info=client_info, - ), - self.get_version: gapic_v1.method.wrap_method( - self.get_version, - default_timeout=None, - client_info=client_info, - ), - self.create_version: gapic_v1.method.wrap_method( - self.create_version, - default_timeout=None, - client_info=client_info, - ), - self.update_version: gapic_v1.method.wrap_method( - self.update_version, - default_timeout=None, - client_info=client_info, - ), - self.delete_version: gapic_v1.method.wrap_method( - self.delete_version, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_versions( - self, - ) -> Callable[ - [appengine.ListVersionsRequest], - Union[ - appengine.ListVersionsResponse, Awaitable[appengine.ListVersionsResponse] - ], - ]: - raise NotImplementedError() - - @property - def get_version( - self, - ) -> Callable[ - [appengine.GetVersionRequest], - Union[version.Version, Awaitable[version.Version]], - ]: - raise NotImplementedError() - - @property - def create_version( - self, - ) -> Callable[ - [appengine.CreateVersionRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def update_version( - self, - ) -> Callable[ - [appengine.UpdateVersionRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def delete_version( - self, - ) -> Callable[ - [appengine.DeleteVersionRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ("VersionsTransport",) diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py deleted file mode 100644 index 3090a75..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ /dev/null @@ -1,420 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers, operations_v1 -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, version - -from .base import DEFAULT_CLIENT_INFO, VersionsTransport - - -class VersionsGrpcTransport(VersionsTransport): - """gRPC backend transport for Versions. - - Manages versions of a service. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _stubs: Dict[str, Callable] - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - 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: - # 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 - - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service.""" - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient(self.grpc_channel) - - # Return the client from cache. - return self._operations_client - - @property - def list_versions( - self, - ) -> Callable[[appengine.ListVersionsRequest], appengine.ListVersionsResponse]: - r"""Return a callable for the list versions method over gRPC. - - Lists the versions of a service. - - Returns: - Callable[[~.ListVersionsRequest], - ~.ListVersionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_versions" not in self._stubs: - self._stubs["list_versions"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/ListVersions", - request_serializer=appengine.ListVersionsRequest.serialize, - response_deserializer=appengine.ListVersionsResponse.deserialize, - ) - return self._stubs["list_versions"] - - @property - def get_version(self) -> Callable[[appengine.GetVersionRequest], version.Version]: - r"""Return a callable for the get version method over gRPC. - - Gets the specified Version resource. By default, only a - ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` - parameter to get the full resource. - - Returns: - Callable[[~.GetVersionRequest], - ~.Version]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_version" not in self._stubs: - self._stubs["get_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/GetVersion", - request_serializer=appengine.GetVersionRequest.serialize, - response_deserializer=version.Version.deserialize, - ) - return self._stubs["get_version"] - - @property - def create_version( - self, - ) -> Callable[[appengine.CreateVersionRequest], operations_pb2.Operation]: - r"""Return a callable for the create version method over gRPC. - - Deploys code and resource files to a new version. - - Returns: - Callable[[~.CreateVersionRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_version" not in self._stubs: - self._stubs["create_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/CreateVersion", - request_serializer=appengine.CreateVersionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["create_version"] - - @property - def update_version( - self, - ) -> Callable[[appengine.UpdateVersionRequest], operations_pb2.Operation]: - r"""Return a callable for the update version method over gRPC. - - Updates the specified Version resource. You can specify the - following fields depending on the App Engine environment and - type of scaling that the version resource uses: - - **Standard environment** - - - ```instance_class`` `__ - - *automatic scaling* in the standard environment: - - - ```automatic_scaling.min_idle_instances`` `__ - - ```automatic_scaling.max_idle_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.max_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.min_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.target_cpu_utilization`` `__ - - ```automaticScaling.standard_scheduler_settings.target_throughput_utilization`` `__ - - *basic scaling* or *manual scaling* in the standard environment: - - - ```serving_status`` `__ - - ```manual_scaling.instances`` `__ - - **Flexible environment** - - - ```serving_status`` `__ - - *automatic scaling* in the flexible environment: - - - ```automatic_scaling.min_total_instances`` `__ - - ```automatic_scaling.max_total_instances`` `__ - - ```automatic_scaling.cool_down_period_sec`` `__ - - ```automatic_scaling.cpu_utilization.target_utilization`` `__ - - *manual scaling* in the flexible environment: - - - ```manual_scaling.instances`` `__ - - Returns: - Callable[[~.UpdateVersionRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_version" not in self._stubs: - self._stubs["update_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/UpdateVersion", - request_serializer=appengine.UpdateVersionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_version"] - - @property - def delete_version( - self, - ) -> Callable[[appengine.DeleteVersionRequest], operations_pb2.Operation]: - r"""Return a callable for the delete version method over gRPC. - - Deletes an existing Version resource. - - Returns: - Callable[[~.DeleteVersionRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_version" not in self._stubs: - self._stubs["delete_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/DeleteVersion", - request_serializer=appengine.DeleteVersionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_version"] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ("VersionsGrpcTransport",) diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py b/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py deleted file mode 100644 index a8903c8..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py +++ /dev/null @@ -1,431 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.longrunning import operations_pb2 # type: ignore -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, version - -from .base import DEFAULT_CLIENT_INFO, VersionsTransport -from .grpc import VersionsGrpcTransport - - -class VersionsGrpcAsyncIOTransport(VersionsTransport): - """gRPC AsyncIO backend transport for Versions. - - Manages versions of a service. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel( - cls, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs, - ) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - 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 - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs, - ) - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the 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 a 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 - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - 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] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - 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: - # 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 - 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 - - else: - 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 - ) - - # 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, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_versions( - self, - ) -> Callable[ - [appengine.ListVersionsRequest], Awaitable[appengine.ListVersionsResponse] - ]: - r"""Return a callable for the list versions method over gRPC. - - Lists the versions of a service. - - Returns: - Callable[[~.ListVersionsRequest], - Awaitable[~.ListVersionsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_versions" not in self._stubs: - self._stubs["list_versions"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/ListVersions", - request_serializer=appengine.ListVersionsRequest.serialize, - response_deserializer=appengine.ListVersionsResponse.deserialize, - ) - return self._stubs["list_versions"] - - @property - def get_version( - self, - ) -> Callable[[appengine.GetVersionRequest], Awaitable[version.Version]]: - r"""Return a callable for the get version method over gRPC. - - Gets the specified Version resource. By default, only a - ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` - parameter to get the full resource. - - Returns: - Callable[[~.GetVersionRequest], - Awaitable[~.Version]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_version" not in self._stubs: - self._stubs["get_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/GetVersion", - request_serializer=appengine.GetVersionRequest.serialize, - response_deserializer=version.Version.deserialize, - ) - return self._stubs["get_version"] - - @property - def create_version( - self, - ) -> Callable[ - [appengine.CreateVersionRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the create version method over gRPC. - - Deploys code and resource files to a new version. - - Returns: - Callable[[~.CreateVersionRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_version" not in self._stubs: - self._stubs["create_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/CreateVersion", - request_serializer=appengine.CreateVersionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["create_version"] - - @property - def update_version( - self, - ) -> Callable[ - [appengine.UpdateVersionRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the update version method over gRPC. - - Updates the specified Version resource. You can specify the - following fields depending on the App Engine environment and - type of scaling that the version resource uses: - - **Standard environment** - - - ```instance_class`` `__ - - *automatic scaling* in the standard environment: - - - ```automatic_scaling.min_idle_instances`` `__ - - ```automatic_scaling.max_idle_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.max_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.min_instances`` `__ - - ```automaticScaling.standard_scheduler_settings.target_cpu_utilization`` `__ - - ```automaticScaling.standard_scheduler_settings.target_throughput_utilization`` `__ - - *basic scaling* or *manual scaling* in the standard environment: - - - ```serving_status`` `__ - - ```manual_scaling.instances`` `__ - - **Flexible environment** - - - ```serving_status`` `__ - - *automatic scaling* in the flexible environment: - - - ```automatic_scaling.min_total_instances`` `__ - - ```automatic_scaling.max_total_instances`` `__ - - ```automatic_scaling.cool_down_period_sec`` `__ - - ```automatic_scaling.cpu_utilization.target_utilization`` `__ - - *manual scaling* in the flexible environment: - - - ```manual_scaling.instances`` `__ - - Returns: - Callable[[~.UpdateVersionRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_version" not in self._stubs: - self._stubs["update_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/UpdateVersion", - request_serializer=appengine.UpdateVersionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["update_version"] - - @property - def delete_version( - self, - ) -> Callable[ - [appengine.DeleteVersionRequest], Awaitable[operations_pb2.Operation] - ]: - r"""Return a callable for the delete version method over gRPC. - - Deletes an existing Version resource. - - Returns: - Callable[[~.DeleteVersionRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_version" not in self._stubs: - self._stubs["delete_version"] = self.grpc_channel.unary_unary( - "/google.appengine.v1.Versions/DeleteVersion", - request_serializer=appengine.DeleteVersionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["delete_version"] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ("VersionsGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py b/google/cloud/appengine_admin_v1/services/versions/transports/rest.py deleted file mode 100644 index 0e59c57..0000000 --- a/google/cloud/appengine_admin_v1/services/versions/transports/rest.py +++ /dev/null @@ -1,814 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import dataclasses -import json # type: ignore -import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import warnings - -from google.api_core import ( - gapic_v1, - operations_v1, - path_template, - rest_helpers, - rest_streaming, -) -from google.api_core import exceptions as core_exceptions -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.transport.requests import AuthorizedSession # type: ignore -from google.protobuf import json_format -import grpc # type: ignore -from requests import __version__ as requests_version - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - - -from google.longrunning import operations_pb2 # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine, version - -from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO -from .base import VersionsTransport - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, - grpc_version=None, - rest_version=requests_version, -) - - -class VersionsRestInterceptor: - """Interceptor for Versions. - - Interceptors are used to manipulate requests, request metadata, and responses - in arbitrary ways. - Example use cases include: - * Logging - * Verifying requests according to service or custom semantics - * Stripping extraneous information from responses - - These use cases and more can be enabled by injecting an - instance of a custom subclass when constructing the VersionsRestTransport. - - .. code-block:: python - class MyCustomVersionsInterceptor(VersionsRestInterceptor): - def pre_create_version(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_create_version(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_delete_version(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_delete_version(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_get_version(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_get_version(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_list_versions(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_list_versions(self, response): - logging.log(f"Received response: {response}") - return response - - def pre_update_version(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_version(self, response): - logging.log(f"Received response: {response}") - return response - - transport = VersionsRestTransport(interceptor=MyCustomVersionsInterceptor()) - client = VersionsClient(transport=transport) - - - """ - - def pre_create_version( - self, - request: appengine.CreateVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.CreateVersionRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for create_version - - Override in a subclass to manipulate the request or metadata - before they are sent to the Versions server. - """ - return request, metadata - - def post_create_version( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for create_version - - Override in a subclass to manipulate the response - after it is returned by the Versions server but before - it is returned to user code. - """ - return response - - def pre_delete_version( - self, - request: appengine.DeleteVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.DeleteVersionRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for delete_version - - Override in a subclass to manipulate the request or metadata - before they are sent to the Versions server. - """ - return request, metadata - - def post_delete_version( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for delete_version - - Override in a subclass to manipulate the response - after it is returned by the Versions server but before - it is returned to user code. - """ - return response - - def pre_get_version( - self, request: appengine.GetVersionRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[appengine.GetVersionRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_version - - Override in a subclass to manipulate the request or metadata - before they are sent to the Versions server. - """ - return request, metadata - - def post_get_version(self, response: version.Version) -> version.Version: - """Post-rpc interceptor for get_version - - Override in a subclass to manipulate the response - after it is returned by the Versions server but before - it is returned to user code. - """ - return response - - def pre_list_versions( - self, - request: appengine.ListVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.ListVersionsRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_versions - - Override in a subclass to manipulate the request or metadata - before they are sent to the Versions server. - """ - return request, metadata - - def post_list_versions( - self, response: appengine.ListVersionsResponse - ) -> appengine.ListVersionsResponse: - """Post-rpc interceptor for list_versions - - Override in a subclass to manipulate the response - after it is returned by the Versions server but before - it is returned to user code. - """ - return response - - def pre_update_version( - self, - request: appengine.UpdateVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[appengine.UpdateVersionRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for update_version - - Override in a subclass to manipulate the request or metadata - before they are sent to the Versions server. - """ - return request, metadata - - def post_update_version( - self, response: operations_pb2.Operation - ) -> operations_pb2.Operation: - """Post-rpc interceptor for update_version - - Override in a subclass to manipulate the response - after it is returned by the Versions server but before - it is returned to user code. - """ - return response - - -@dataclasses.dataclass -class VersionsRestStub: - _session: AuthorizedSession - _host: str - _interceptor: VersionsRestInterceptor - - -class VersionsRestTransport(VersionsTransport): - """REST backend transport for Versions. - - Manages versions of a service. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends JSON representations of protocol buffers over HTTP/1.1 - - """ - - def __init__( - self, - *, - host: str = "appengine.googleapis.com", - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - url_scheme: str = "https", - interceptor: Optional[VersionsRestInterceptor] = None, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client - certificate to configure mutual TLS HTTP channel. It is ignored - if ``channel`` 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 are developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - url_scheme: the protocol scheme for the API endpoint. Normally - "https", but for testing or local servers, - "http" can be specified. - """ - # Run the base constructor - # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. - # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the - # credentials object - maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) - if maybe_url_match is None: - raise ValueError( - f"Unexpected hostname structure: {host}" - ) # pragma: NO COVER - - url_match_items = maybe_url_match.groupdict() - - host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host - - super().__init__( - host=host, - credentials=credentials, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - self._session = AuthorizedSession( - self._credentials, default_host=self.DEFAULT_HOST - ) - self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None - if client_cert_source_for_mtls: - self._session.configure_mtls_channel(client_cert_source_for_mtls) - self._interceptor = interceptor or VersionsRestInterceptor() - self._prep_wrapped_messages(client_info) - - @property - def operations_client(self) -> operations_v1.AbstractOperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Only create a new client if we do not already have one. - if self._operations_client is None: - http_options: Dict[str, List[Dict[str, str]]] = { - "google.longrunning.Operations.GetOperation": [ - { - "method": "get", - "uri": "/v1/{name=apps/*/operations/*}", - }, - ], - "google.longrunning.Operations.ListOperations": [ - { - "method": "get", - "uri": "/v1/{name=apps/*}/operations", - }, - ], - } - - rest_transport = operations_v1.OperationsRestTransport( - host=self._host, - # use the credentials which are saved - credentials=self._credentials, - scopes=self._scopes, - http_options=http_options, - path_prefix="v1", - ) - - self._operations_client = operations_v1.AbstractOperationsClient( - transport=rest_transport - ) - - # Return the client from cache. - return self._operations_client - - class _CreateVersion(VersionsRestStub): - def __hash__(self): - return hash("CreateVersion") - - def __call__( - self, - request: appengine.CreateVersionRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the create version method over HTTP. - - Args: - request (~.appengine.CreateVersionRequest): - The request object. Request message for ``Versions.CreateVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1/{parent=apps/*/services/*}/versions", - "body": "version", - }, - ] - request, metadata = self._interceptor.pre_create_version(request, metadata) - pb_request = appengine.CreateVersionRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_version(resp) - return resp - - class _DeleteVersion(VersionsRestStub): - def __hash__(self): - return hash("DeleteVersion") - - def __call__( - self, - request: appengine.DeleteVersionRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the delete version method over HTTP. - - Args: - request (~.appengine.DeleteVersionRequest): - The request object. Request message for ``Versions.DeleteVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "delete", - "uri": "/v1/{name=apps/*/services/*/versions/*}", - }, - ] - request, metadata = self._interceptor.pre_delete_version(request, metadata) - pb_request = appengine.DeleteVersionRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_delete_version(resp) - return resp - - class _GetVersion(VersionsRestStub): - def __hash__(self): - return hash("GetVersion") - - def __call__( - self, - request: appengine.GetVersionRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> version.Version: - r"""Call the get version method over HTTP. - - Args: - request (~.appengine.GetVersionRequest): - The request object. Request message for ``Versions.GetVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.version.Version: - A Version resource is a specific set - of source code and configuration files - that are deployed into a service. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{name=apps/*/services/*/versions/*}", - }, - ] - request, metadata = self._interceptor.pre_get_version(request, metadata) - pb_request = appengine.GetVersionRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = version.Version() - pb_resp = version.Version.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_version(resp) - return resp - - class _ListVersions(VersionsRestStub): - def __hash__(self): - return hash("ListVersions") - - def __call__( - self, - request: appengine.ListVersionsRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> appengine.ListVersionsResponse: - r"""Call the list versions method over HTTP. - - Args: - request (~.appengine.ListVersionsRequest): - The request object. Request message for ``Versions.ListVersions``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.appengine.ListVersionsResponse: - Response message for ``Versions.ListVersions``. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1/{parent=apps/*/services/*}/versions", - }, - ] - request, metadata = self._interceptor.pre_list_versions(request, metadata) - pb_request = appengine.ListVersionsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = appengine.ListVersionsResponse() - pb_resp = appengine.ListVersionsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_versions(resp) - return resp - - class _UpdateVersion(VersionsRestStub): - def __hash__(self): - return hash("UpdateVersion") - - def __call__( - self, - request: appengine.UpdateVersionRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Call the update version method over HTTP. - - Args: - request (~.appengine.UpdateVersionRequest): - The request object. Request message for ``Versions.UpdateVersion``. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - ~.operations_pb2.Operation: - This resource represents a - long-running operation that is the - result of a network API call. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "patch", - "uri": "/v1/{name=apps/*/services/*/versions/*}", - "body": "version", - }, - ] - request, metadata = self._interceptor.pre_update_version(request, metadata) - pb_request = appengine.UpdateVersionRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = operations_pb2.Operation() - json_format.Parse(response.content, resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_version(resp) - return resp - - @property - def create_version( - self, - ) -> Callable[[appengine.CreateVersionRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._CreateVersion(self._session, self._host, self._interceptor) # type: ignore - - @property - def delete_version( - self, - ) -> Callable[[appengine.DeleteVersionRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._DeleteVersion(self._session, self._host, self._interceptor) # type: ignore - - @property - def get_version(self) -> Callable[[appengine.GetVersionRequest], version.Version]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetVersion(self._session, self._host, self._interceptor) # type: ignore - - @property - def list_versions( - self, - ) -> Callable[[appengine.ListVersionsRequest], appengine.ListVersionsResponse]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListVersions(self._session, self._host, self._interceptor) # type: ignore - - @property - def update_version( - self, - ) -> Callable[[appengine.UpdateVersionRequest], operations_pb2.Operation]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateVersion(self._session, self._host, self._interceptor) # type: ignore - - @property - def kind(self) -> str: - return "rest" - - def close(self): - self._session.close() - - -__all__ = ("VersionsRestTransport",) diff --git a/google/cloud/appengine_admin_v1/types/__init__.py b/google/cloud/appengine_admin_v1/types/__init__.py deleted file mode 100644 index f81343e..0000000 --- a/google/cloud/appengine_admin_v1/types/__init__.py +++ /dev/null @@ -1,217 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from .app_yaml import ( - ApiConfigHandler, - ApiEndpointHandler, - AuthFailAction, - ErrorHandler, - HealthCheck, - Library, - LivenessCheck, - LoginRequirement, - ReadinessCheck, - ScriptHandler, - SecurityLevel, - StaticFilesHandler, - UrlMap, -) -from .appengine import ( - AuthorizedCertificateView, - BatchUpdateIngressRulesRequest, - BatchUpdateIngressRulesResponse, - CreateApplicationRequest, - CreateAuthorizedCertificateRequest, - CreateDomainMappingRequest, - CreateIngressRuleRequest, - CreateVersionRequest, - DebugInstanceRequest, - DeleteAuthorizedCertificateRequest, - DeleteDomainMappingRequest, - DeleteIngressRuleRequest, - DeleteInstanceRequest, - DeleteServiceRequest, - DeleteVersionRequest, - DomainOverrideStrategy, - GetApplicationRequest, - GetAuthorizedCertificateRequest, - GetDomainMappingRequest, - GetIngressRuleRequest, - GetInstanceRequest, - GetServiceRequest, - GetVersionRequest, - ListAuthorizedCertificatesRequest, - ListAuthorizedCertificatesResponse, - ListAuthorizedDomainsRequest, - ListAuthorizedDomainsResponse, - ListDomainMappingsRequest, - ListDomainMappingsResponse, - ListIngressRulesRequest, - ListIngressRulesResponse, - ListInstancesRequest, - ListInstancesResponse, - ListServicesRequest, - ListServicesResponse, - ListVersionsRequest, - ListVersionsResponse, - RepairApplicationRequest, - UpdateApplicationRequest, - UpdateAuthorizedCertificateRequest, - UpdateDomainMappingRequest, - UpdateIngressRuleRequest, - UpdateServiceRequest, - UpdateVersionRequest, - VersionView, -) -from .application import Application, UrlDispatchRule -from .audit_data import AuditData, CreateVersionMethod, UpdateServiceMethod -from .certificate import ( - AuthorizedCertificate, - CertificateRawData, - ManagedCertificate, - ManagementStatus, -) -from .deploy import CloudBuildOptions, ContainerInfo, Deployment, FileInfo, ZipInfo -from .domain import AuthorizedDomain -from .domain_mapping import DomainMapping, ResourceRecord, SslSettings -from .firewall import FirewallRule -from .instance import Instance -from .location import LocationMetadata -from .network_settings import NetworkSettings -from .operation import CreateVersionMetadataV1, OperationMetadataV1 -from .service import Service, TrafficSplit -from .version import ( - AutomaticScaling, - BasicScaling, - CpuUtilization, - DiskUtilization, - EndpointsApiService, - Entrypoint, - InboundServiceType, - ManualScaling, - Network, - NetworkUtilization, - RequestUtilization, - Resources, - ServingStatus, - StandardSchedulerSettings, - Version, - Volume, - VpcAccessConnector, -) - -__all__ = ( - "ApiConfigHandler", - "ApiEndpointHandler", - "ErrorHandler", - "HealthCheck", - "Library", - "LivenessCheck", - "ReadinessCheck", - "ScriptHandler", - "StaticFilesHandler", - "UrlMap", - "AuthFailAction", - "LoginRequirement", - "SecurityLevel", - "BatchUpdateIngressRulesRequest", - "BatchUpdateIngressRulesResponse", - "CreateApplicationRequest", - "CreateAuthorizedCertificateRequest", - "CreateDomainMappingRequest", - "CreateIngressRuleRequest", - "CreateVersionRequest", - "DebugInstanceRequest", - "DeleteAuthorizedCertificateRequest", - "DeleteDomainMappingRequest", - "DeleteIngressRuleRequest", - "DeleteInstanceRequest", - "DeleteServiceRequest", - "DeleteVersionRequest", - "GetApplicationRequest", - "GetAuthorizedCertificateRequest", - "GetDomainMappingRequest", - "GetIngressRuleRequest", - "GetInstanceRequest", - "GetServiceRequest", - "GetVersionRequest", - "ListAuthorizedCertificatesRequest", - "ListAuthorizedCertificatesResponse", - "ListAuthorizedDomainsRequest", - "ListAuthorizedDomainsResponse", - "ListDomainMappingsRequest", - "ListDomainMappingsResponse", - "ListIngressRulesRequest", - "ListIngressRulesResponse", - "ListInstancesRequest", - "ListInstancesResponse", - "ListServicesRequest", - "ListServicesResponse", - "ListVersionsRequest", - "ListVersionsResponse", - "RepairApplicationRequest", - "UpdateApplicationRequest", - "UpdateAuthorizedCertificateRequest", - "UpdateDomainMappingRequest", - "UpdateIngressRuleRequest", - "UpdateServiceRequest", - "UpdateVersionRequest", - "AuthorizedCertificateView", - "DomainOverrideStrategy", - "VersionView", - "Application", - "UrlDispatchRule", - "AuditData", - "CreateVersionMethod", - "UpdateServiceMethod", - "AuthorizedCertificate", - "CertificateRawData", - "ManagedCertificate", - "ManagementStatus", - "CloudBuildOptions", - "ContainerInfo", - "Deployment", - "FileInfo", - "ZipInfo", - "AuthorizedDomain", - "DomainMapping", - "ResourceRecord", - "SslSettings", - "FirewallRule", - "Instance", - "LocationMetadata", - "NetworkSettings", - "CreateVersionMetadataV1", - "OperationMetadataV1", - "Service", - "TrafficSplit", - "AutomaticScaling", - "BasicScaling", - "CpuUtilization", - "DiskUtilization", - "EndpointsApiService", - "Entrypoint", - "ManualScaling", - "Network", - "NetworkUtilization", - "RequestUtilization", - "Resources", - "StandardSchedulerSettings", - "Version", - "Volume", - "VpcAccessConnector", - "InboundServiceType", - "ServingStatus", -) diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py deleted file mode 100644 index 4c4aaae..0000000 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ /dev/null @@ -1,639 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import duration_pb2 # type: ignore -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "AuthFailAction", - "LoginRequirement", - "SecurityLevel", - "ApiConfigHandler", - "ErrorHandler", - "UrlMap", - "StaticFilesHandler", - "ScriptHandler", - "ApiEndpointHandler", - "HealthCheck", - "ReadinessCheck", - "LivenessCheck", - "Library", - }, -) - - -class AuthFailAction(proto.Enum): - r"""Actions to take when the user is not logged in. - - Values: - AUTH_FAIL_ACTION_UNSPECIFIED (0): - Not specified. ``AUTH_FAIL_ACTION_REDIRECT`` is assumed. - AUTH_FAIL_ACTION_REDIRECT (1): - Redirects user to "accounts.google.com". The - user is redirected back to the application URL - after signing in or creating an account. - AUTH_FAIL_ACTION_UNAUTHORIZED (2): - Rejects request with a ``401`` HTTP status code and an error - message. - """ - AUTH_FAIL_ACTION_UNSPECIFIED = 0 - AUTH_FAIL_ACTION_REDIRECT = 1 - AUTH_FAIL_ACTION_UNAUTHORIZED = 2 - - -class LoginRequirement(proto.Enum): - r"""Methods to restrict access to a URL based on login status. - - Values: - LOGIN_UNSPECIFIED (0): - Not specified. ``LOGIN_OPTIONAL`` is assumed. - LOGIN_OPTIONAL (1): - Does not require that the user is signed in. - LOGIN_ADMIN (2): - If the user is not signed in, the ``auth_fail_action`` is - taken. In addition, if the user is not an administrator for - the application, they are given an error message regardless - of ``auth_fail_action``. If the user is an administrator, - the handler proceeds. - LOGIN_REQUIRED (3): - If the user has signed in, the handler proceeds normally. - Otherwise, the auth_fail_action is taken. - """ - LOGIN_UNSPECIFIED = 0 - LOGIN_OPTIONAL = 1 - LOGIN_ADMIN = 2 - LOGIN_REQUIRED = 3 - - -class SecurityLevel(proto.Enum): - r"""Methods to enforce security (HTTPS) on a URL. - - Values: - SECURE_UNSPECIFIED (0): - Not specified. - SECURE_DEFAULT (0): - Both HTTP and HTTPS requests with URLs that - match the handler succeed without redirects. The - application can examine the request to determine - which protocol was used, and respond - accordingly. - SECURE_NEVER (1): - Requests for a URL that match this handler - that use HTTPS are automatically redirected to - the HTTP equivalent URL. - SECURE_OPTIONAL (2): - Both HTTP and HTTPS requests with URLs that - match the handler succeed without redirects. The - application can examine the request to determine - which protocol was used and respond accordingly. - SECURE_ALWAYS (3): - Requests for a URL that match this handler - that do not use HTTPS are automatically - redirected to the HTTPS URL with the same path. - Query parameters are reserved for the redirect. - """ - _pb_options = {"allow_alias": True} - SECURE_UNSPECIFIED = 0 - SECURE_DEFAULT = 0 - SECURE_NEVER = 1 - SECURE_OPTIONAL = 2 - SECURE_ALWAYS = 3 - - -class ApiConfigHandler(proto.Message): - r"""`Google Cloud - Endpoints `__ - configuration for API handlers. - - Attributes: - auth_fail_action (google.cloud.appengine_admin_v1.types.AuthFailAction): - Action to take when users access resources that require - authentication. Defaults to ``redirect``. - login (google.cloud.appengine_admin_v1.types.LoginRequirement): - Level of login required to access this resource. Defaults to - ``optional``. - script (str): - Path to the script from the application root - directory. - security_level (google.cloud.appengine_admin_v1.types.SecurityLevel): - Security (HTTPS) enforcement for this URL. - url (str): - URL to serve the endpoint at. - """ - - auth_fail_action: "AuthFailAction" = proto.Field( - proto.ENUM, - number=1, - enum="AuthFailAction", - ) - login: "LoginRequirement" = proto.Field( - proto.ENUM, - number=2, - enum="LoginRequirement", - ) - script: str = proto.Field( - proto.STRING, - number=3, - ) - security_level: "SecurityLevel" = proto.Field( - proto.ENUM, - number=4, - enum="SecurityLevel", - ) - url: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ErrorHandler(proto.Message): - r"""Custom static error page to be served when an error occurs. - - Attributes: - error_code (google.cloud.appengine_admin_v1.types.ErrorHandler.ErrorCode): - Error condition this handler applies to. - static_file (str): - Static file content to be served for this - error. - mime_type (str): - MIME type of file. Defaults to ``text/html``. - """ - - class ErrorCode(proto.Enum): - r"""Error codes. - - Values: - ERROR_CODE_UNSPECIFIED (0): - Not specified. ERROR_CODE_DEFAULT is assumed. - ERROR_CODE_DEFAULT (0): - All other error types. - ERROR_CODE_OVER_QUOTA (1): - Application has exceeded a resource quota. - ERROR_CODE_DOS_API_DENIAL (2): - Client blocked by the application's Denial of - Service protection configuration. - ERROR_CODE_TIMEOUT (3): - Deadline reached before the application - responds. - """ - _pb_options = {"allow_alias": True} - ERROR_CODE_UNSPECIFIED = 0 - ERROR_CODE_DEFAULT = 0 - ERROR_CODE_OVER_QUOTA = 1 - ERROR_CODE_DOS_API_DENIAL = 2 - ERROR_CODE_TIMEOUT = 3 - - error_code: ErrorCode = proto.Field( - proto.ENUM, - number=1, - enum=ErrorCode, - ) - static_file: str = proto.Field( - proto.STRING, - number=2, - ) - mime_type: str = proto.Field( - proto.STRING, - number=3, - ) - - -class UrlMap(proto.Message): - r"""URL pattern and description of how the URL should be handled. - App Engine can handle URLs by executing application code or by - serving static files uploaded with the version, such as images, - CSS, or JavaScript. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - url_regex (str): - URL prefix. Uses regular expression syntax, - which means regexp special characters must be - escaped, but should not contain groupings. All - URLs that begin with this prefix are handled by - this handler, using the portion of the URL after - the prefix as part of the file path. - static_files (google.cloud.appengine_admin_v1.types.StaticFilesHandler): - Returns the contents of a file, such as an - image, as the response. - - This field is a member of `oneof`_ ``handler_type``. - script (google.cloud.appengine_admin_v1.types.ScriptHandler): - Executes a script to handle the requests that match this URL - pattern. Only the ``auto`` value is supported for Node.js in - the App Engine standard environment, for example - ``"script": "auto"``. - - This field is a member of `oneof`_ ``handler_type``. - api_endpoint (google.cloud.appengine_admin_v1.types.ApiEndpointHandler): - Uses API Endpoints to handle requests. - - This field is a member of `oneof`_ ``handler_type``. - security_level (google.cloud.appengine_admin_v1.types.SecurityLevel): - Security (HTTPS) enforcement for this URL. - login (google.cloud.appengine_admin_v1.types.LoginRequirement): - Level of login required to access this - resource. Not supported for Node.js in the App - Engine standard environment. - auth_fail_action (google.cloud.appengine_admin_v1.types.AuthFailAction): - Action to take when users access resources that require - authentication. Defaults to ``redirect``. - redirect_http_response_code (google.cloud.appengine_admin_v1.types.UrlMap.RedirectHttpResponseCode): - ``30x`` code to use when performing redirects for the - ``secure`` field. Defaults to ``302``. - """ - - class RedirectHttpResponseCode(proto.Enum): - r"""Redirect codes. - - Values: - REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED (0): - Not specified. ``302`` is assumed. - REDIRECT_HTTP_RESPONSE_CODE_301 (1): - ``301 Moved Permanently`` code. - REDIRECT_HTTP_RESPONSE_CODE_302 (2): - ``302 Moved Temporarily`` code. - REDIRECT_HTTP_RESPONSE_CODE_303 (3): - ``303 See Other`` code. - REDIRECT_HTTP_RESPONSE_CODE_307 (4): - ``307 Temporary Redirect`` code. - """ - REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED = 0 - REDIRECT_HTTP_RESPONSE_CODE_301 = 1 - REDIRECT_HTTP_RESPONSE_CODE_302 = 2 - REDIRECT_HTTP_RESPONSE_CODE_303 = 3 - REDIRECT_HTTP_RESPONSE_CODE_307 = 4 - - url_regex: str = proto.Field( - proto.STRING, - number=1, - ) - static_files: "StaticFilesHandler" = proto.Field( - proto.MESSAGE, - number=2, - oneof="handler_type", - message="StaticFilesHandler", - ) - script: "ScriptHandler" = proto.Field( - proto.MESSAGE, - number=3, - oneof="handler_type", - message="ScriptHandler", - ) - api_endpoint: "ApiEndpointHandler" = proto.Field( - proto.MESSAGE, - number=4, - oneof="handler_type", - message="ApiEndpointHandler", - ) - security_level: "SecurityLevel" = proto.Field( - proto.ENUM, - number=5, - enum="SecurityLevel", - ) - login: "LoginRequirement" = proto.Field( - proto.ENUM, - number=6, - enum="LoginRequirement", - ) - auth_fail_action: "AuthFailAction" = proto.Field( - proto.ENUM, - number=7, - enum="AuthFailAction", - ) - redirect_http_response_code: RedirectHttpResponseCode = proto.Field( - proto.ENUM, - number=8, - enum=RedirectHttpResponseCode, - ) - - -class StaticFilesHandler(proto.Message): - r"""Files served directly to the user for a given URL, such as - images, CSS stylesheets, or JavaScript source files. Static file - handlers describe which files in the application directory are - static files, and which URLs serve them. - - Attributes: - path (str): - Path to the static files matched by the URL - pattern, from the application root directory. - The path can refer to text matched in groupings - in the URL pattern. - upload_path_regex (str): - Regular expression that matches the file - paths for all files that should be referenced by - this handler. - http_headers (MutableMapping[str, str]): - HTTP headers to use for all responses from - these URLs. - mime_type (str): - MIME type used to serve all files served by - this handler. - Defaults to file-specific MIME types, which are - derived from each file's filename extension. - expiration (google.protobuf.duration_pb2.Duration): - Time a static file served by this handler - should be cached by web proxies and browsers. - require_matching_file (bool): - Whether this handler should match the request - if the file referenced by the handler does not - exist. - application_readable (bool): - Whether files should also be uploaded as code - data. By default, files declared in static file - handlers are uploaded as static data and are - only served to end users; they cannot be read by - the application. If enabled, uploads are charged - against both your code and static data storage - resource quotas. - """ - - path: str = proto.Field( - proto.STRING, - number=1, - ) - upload_path_regex: str = proto.Field( - proto.STRING, - number=2, - ) - http_headers: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=3, - ) - mime_type: str = proto.Field( - proto.STRING, - number=4, - ) - expiration: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=5, - message=duration_pb2.Duration, - ) - require_matching_file: bool = proto.Field( - proto.BOOL, - number=6, - ) - application_readable: bool = proto.Field( - proto.BOOL, - number=7, - ) - - -class ScriptHandler(proto.Message): - r"""Executes a script to handle the request that matches the URL - pattern. - - Attributes: - script_path (str): - Path to the script from the application root - directory. - """ - - script_path: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ApiEndpointHandler(proto.Message): - r"""Uses Google Cloud Endpoints to handle requests. - - Attributes: - script_path (str): - Path to the script from the application root - directory. - """ - - script_path: str = proto.Field( - proto.STRING, - number=1, - ) - - -class HealthCheck(proto.Message): - r"""Health checking configuration for VM instances. Unhealthy - instances are killed and replaced with new instances. Only - applicable for instances in App Engine flexible environment. - - Attributes: - disable_health_check (bool): - Whether to explicitly disable health checks - for this instance. - host (str): - Host header to send when performing an HTTP - health check. Example: "myapp.appspot.com". - healthy_threshold (int): - Number of consecutive successful health - checks required before receiving traffic. - unhealthy_threshold (int): - Number of consecutive failed health checks - required before removing traffic. - restart_threshold (int): - Number of consecutive failed health checks - required before an instance is restarted. - check_interval (google.protobuf.duration_pb2.Duration): - Interval between health checks. - timeout (google.protobuf.duration_pb2.Duration): - Time before the health check is considered - failed. - """ - - disable_health_check: bool = proto.Field( - proto.BOOL, - number=1, - ) - host: str = proto.Field( - proto.STRING, - number=2, - ) - healthy_threshold: int = proto.Field( - proto.UINT32, - number=3, - ) - unhealthy_threshold: int = proto.Field( - proto.UINT32, - number=4, - ) - restart_threshold: int = proto.Field( - proto.UINT32, - number=5, - ) - check_interval: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=6, - message=duration_pb2.Duration, - ) - timeout: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=7, - message=duration_pb2.Duration, - ) - - -class ReadinessCheck(proto.Message): - r"""Readiness checking configuration for VM instances. Unhealthy - instances are removed from traffic rotation. - - Attributes: - path (str): - The request path. - host (str): - Host header to send when performing a HTTP - Readiness check. Example: "myapp.appspot.com". - failure_threshold (int): - Number of consecutive failed checks required - before removing traffic. - success_threshold (int): - Number of consecutive successful checks - required before receiving traffic. - check_interval (google.protobuf.duration_pb2.Duration): - Interval between health checks. - timeout (google.protobuf.duration_pb2.Duration): - Time before the check is considered failed. - app_start_timeout (google.protobuf.duration_pb2.Duration): - A maximum time limit on application - initialization, measured from moment the - application successfully replies to a - healthcheck until it is ready to serve traffic. - """ - - path: str = proto.Field( - proto.STRING, - number=1, - ) - host: str = proto.Field( - proto.STRING, - number=2, - ) - failure_threshold: int = proto.Field( - proto.UINT32, - number=3, - ) - success_threshold: int = proto.Field( - proto.UINT32, - number=4, - ) - check_interval: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=5, - message=duration_pb2.Duration, - ) - timeout: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=6, - message=duration_pb2.Duration, - ) - app_start_timeout: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=7, - message=duration_pb2.Duration, - ) - - -class LivenessCheck(proto.Message): - r"""Health checking configuration for VM instances. Unhealthy - instances are killed and replaced with new instances. - - Attributes: - path (str): - The request path. - host (str): - Host header to send when performing a HTTP - Liveness check. Example: "myapp.appspot.com". - failure_threshold (int): - Number of consecutive failed checks required - before considering the VM unhealthy. - success_threshold (int): - Number of consecutive successful checks - required before considering the VM healthy. - check_interval (google.protobuf.duration_pb2.Duration): - Interval between health checks. - timeout (google.protobuf.duration_pb2.Duration): - Time before the check is considered failed. - initial_delay (google.protobuf.duration_pb2.Duration): - The initial delay before starting to execute - the checks. - """ - - path: str = proto.Field( - proto.STRING, - number=1, - ) - host: str = proto.Field( - proto.STRING, - number=2, - ) - failure_threshold: int = proto.Field( - proto.UINT32, - number=3, - ) - success_threshold: int = proto.Field( - proto.UINT32, - number=4, - ) - check_interval: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=5, - message=duration_pb2.Duration, - ) - timeout: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=6, - message=duration_pb2.Duration, - ) - initial_delay: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=7, - message=duration_pb2.Duration, - ) - - -class Library(proto.Message): - r"""Third-party Python runtime library that is required by the - application. - - Attributes: - name (str): - Name of the library. Example: "django". - version (str): - Version of the library to select, or - "latest". - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - version: str = proto.Field( - proto.STRING, - number=2, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py deleted file mode 100644 index 2d7f0ab..0000000 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ /dev/null @@ -1,1183 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import field_mask_pb2 # type: ignore -import proto # type: ignore - -from google.cloud.appengine_admin_v1.types import domain_mapping as ga_domain_mapping -from google.cloud.appengine_admin_v1.types import application as ga_application -from google.cloud.appengine_admin_v1.types import certificate as ga_certificate -from google.cloud.appengine_admin_v1.types import domain -from google.cloud.appengine_admin_v1.types import firewall, instance -from google.cloud.appengine_admin_v1.types import service as ga_service -from google.cloud.appengine_admin_v1.types import version as ga_version - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "VersionView", - "AuthorizedCertificateView", - "DomainOverrideStrategy", - "GetApplicationRequest", - "CreateApplicationRequest", - "UpdateApplicationRequest", - "RepairApplicationRequest", - "ListServicesRequest", - "ListServicesResponse", - "GetServiceRequest", - "UpdateServiceRequest", - "DeleteServiceRequest", - "ListVersionsRequest", - "ListVersionsResponse", - "GetVersionRequest", - "CreateVersionRequest", - "UpdateVersionRequest", - "DeleteVersionRequest", - "ListInstancesRequest", - "ListInstancesResponse", - "GetInstanceRequest", - "DeleteInstanceRequest", - "DebugInstanceRequest", - "ListIngressRulesRequest", - "ListIngressRulesResponse", - "BatchUpdateIngressRulesRequest", - "BatchUpdateIngressRulesResponse", - "CreateIngressRuleRequest", - "GetIngressRuleRequest", - "UpdateIngressRuleRequest", - "DeleteIngressRuleRequest", - "ListAuthorizedDomainsRequest", - "ListAuthorizedDomainsResponse", - "ListAuthorizedCertificatesRequest", - "ListAuthorizedCertificatesResponse", - "GetAuthorizedCertificateRequest", - "CreateAuthorizedCertificateRequest", - "UpdateAuthorizedCertificateRequest", - "DeleteAuthorizedCertificateRequest", - "ListDomainMappingsRequest", - "ListDomainMappingsResponse", - "GetDomainMappingRequest", - "CreateDomainMappingRequest", - "UpdateDomainMappingRequest", - "DeleteDomainMappingRequest", - }, -) - - -class VersionView(proto.Enum): - r"""Fields that should be returned when - [Version][google.appengine.v1.Version] resources are retrieved. - - Values: - BASIC (0): - Basic version information including scaling - and inbound services, but not detailed - deployment information. - FULL (1): - The information from ``BASIC``, plus detailed information - about the deployment. This format is required when creating - resources, but is not returned in ``Get`` or ``List`` by - default. - """ - BASIC = 0 - FULL = 1 - - -class AuthorizedCertificateView(proto.Enum): - r"""Fields that should be returned when an AuthorizedCertificate - resource is retrieved. - - Values: - BASIC_CERTIFICATE (0): - Basic certificate information, including - applicable domains and expiration date. - FULL_CERTIFICATE (1): - The information from ``BASIC_CERTIFICATE``, plus detailed - information on the domain mappings that have this - certificate mapped. - """ - BASIC_CERTIFICATE = 0 - FULL_CERTIFICATE = 1 - - -class DomainOverrideStrategy(proto.Enum): - r"""Override strategy for mutating an existing mapping. - - Values: - UNSPECIFIED_DOMAIN_OVERRIDE_STRATEGY (0): - Strategy unspecified. Defaults to ``STRICT``. - STRICT (1): - Overrides not allowed. If a mapping already exists for the - specified domain, the request will return an ALREADY_EXISTS - (409). - OVERRIDE (2): - Overrides allowed. If a mapping already - exists for the specified domain, the request - will overwrite it. Note that this might stop - another Google product from serving. For - example, if the domain is mapped to another App - Engine application, that app will no longer - serve from that domain. - """ - UNSPECIFIED_DOMAIN_OVERRIDE_STRATEGY = 0 - STRICT = 1 - OVERRIDE = 2 - - -class GetApplicationRequest(proto.Message): - r"""Request message for ``Applications.GetApplication``. - - Attributes: - name (str): - Name of the Application resource to get. Example: - ``apps/myapp``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateApplicationRequest(proto.Message): - r"""Request message for ``Applications.CreateApplication``. - - Attributes: - application (google.cloud.appengine_admin_v1.types.Application): - Application configuration. - """ - - application: ga_application.Application = proto.Field( - proto.MESSAGE, - number=2, - message=ga_application.Application, - ) - - -class UpdateApplicationRequest(proto.Message): - r"""Request message for ``Applications.UpdateApplication``. - - Attributes: - name (str): - Name of the Application resource to update. Example: - ``apps/myapp``. - application (google.cloud.appengine_admin_v1.types.Application): - An Application containing the updated - resource. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. Standard field mask for the set of - fields to be updated. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - application: ga_application.Application = proto.Field( - proto.MESSAGE, - number=2, - message=ga_application.Application, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - - -class RepairApplicationRequest(proto.Message): - r"""Request message for 'Applications.RepairApplication'. - - Attributes: - name (str): - Name of the application to repair. Example: ``apps/myapp`` - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListServicesRequest(proto.Message): - r"""Request message for ``Services.ListServices``. - - Attributes: - parent (str): - Name of the parent Application resource. Example: - ``apps/myapp``. - page_size (int): - Maximum results to return per page. - page_token (str): - Continuation token for fetching the next page - of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ListServicesResponse(proto.Message): - r"""Response message for ``Services.ListServices``. - - Attributes: - services (MutableSequence[google.cloud.appengine_admin_v1.types.Service]): - The services belonging to the requested - application. - next_page_token (str): - Continuation token for fetching the next page - of results. - """ - - @property - def raw_page(self): - return self - - services: MutableSequence[ga_service.Service] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=ga_service.Service, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetServiceRequest(proto.Message): - r"""Request message for ``Services.GetService``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/services/default``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class UpdateServiceRequest(proto.Message): - r"""Request message for ``Services.UpdateService``. - - Attributes: - name (str): - Name of the resource to update. Example: - ``apps/myapp/services/default``. - service (google.cloud.appengine_admin_v1.types.Service): - A Service resource containing the updated - service. Only fields set in the field mask will - be updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. Standard field mask for the set of - fields to be updated. - migrate_traffic (bool): - Set to ``true`` to gradually shift traffic to one or more - versions that you specify. By default, traffic is shifted - immediately. For gradual traffic migration, the target - versions must be located within instances that are - configured for both `warmup - requests `__ - and `automatic - scaling `__. - You must specify the - ```shardBy`` `__ - field in the Service resource. Gradual traffic migration is - not supported in the App Engine flexible environment. For - examples, see `Migrating and Splitting - Traffic `__. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - service: ga_service.Service = proto.Field( - proto.MESSAGE, - number=2, - message=ga_service.Service, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - migrate_traffic: bool = proto.Field( - proto.BOOL, - number=4, - ) - - -class DeleteServiceRequest(proto.Message): - r"""Request message for ``Services.DeleteService``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/services/default``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListVersionsRequest(proto.Message): - r"""Request message for ``Versions.ListVersions``. - - Attributes: - parent (str): - Name of the parent Service resource. Example: - ``apps/myapp/services/default``. - view (google.cloud.appengine_admin_v1.types.VersionView): - Controls the set of fields returned in the ``List`` - response. - page_size (int): - Maximum results to return per page. - page_token (str): - Continuation token for fetching the next page - of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - view: "VersionView" = proto.Field( - proto.ENUM, - number=2, - enum="VersionView", - ) - page_size: int = proto.Field( - proto.INT32, - number=3, - ) - page_token: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListVersionsResponse(proto.Message): - r"""Response message for ``Versions.ListVersions``. - - Attributes: - versions (MutableSequence[google.cloud.appengine_admin_v1.types.Version]): - The versions belonging to the requested - service. - next_page_token (str): - Continuation token for fetching the next page - of results. - """ - - @property - def raw_page(self): - return self - - versions: MutableSequence[ga_version.Version] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=ga_version.Version, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetVersionRequest(proto.Message): - r"""Request message for ``Versions.GetVersion``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/services/default/versions/v1``. - view (google.cloud.appengine_admin_v1.types.VersionView): - Controls the set of fields returned in the ``Get`` response. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - view: "VersionView" = proto.Field( - proto.ENUM, - number=2, - enum="VersionView", - ) - - -class CreateVersionRequest(proto.Message): - r"""Request message for ``Versions.CreateVersion``. - - Attributes: - parent (str): - Name of the parent resource to create this version under. - Example: ``apps/myapp/services/default``. - version (google.cloud.appengine_admin_v1.types.Version): - Application deployment configuration. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - version: ga_version.Version = proto.Field( - proto.MESSAGE, - number=2, - message=ga_version.Version, - ) - - -class UpdateVersionRequest(proto.Message): - r"""Request message for ``Versions.UpdateVersion``. - - Attributes: - name (str): - Name of the resource to update. Example: - ``apps/myapp/services/default/versions/1``. - version (google.cloud.appengine_admin_v1.types.Version): - A Version containing the updated resource. - Only fields set in the field mask will be - updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Standard field mask for the set of fields to - be updated. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - version: ga_version.Version = proto.Field( - proto.MESSAGE, - number=2, - message=ga_version.Version, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - - -class DeleteVersionRequest(proto.Message): - r"""Request message for ``Versions.DeleteVersion``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/services/default/versions/v1``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListInstancesRequest(proto.Message): - r"""Request message for ``Instances.ListInstances``. - - Attributes: - parent (str): - Name of the parent Version resource. Example: - ``apps/myapp/services/default/versions/v1``. - page_size (int): - Maximum results to return per page. - page_token (str): - Continuation token for fetching the next page - of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ListInstancesResponse(proto.Message): - r"""Response message for ``Instances.ListInstances``. - - Attributes: - instances (MutableSequence[google.cloud.appengine_admin_v1.types.Instance]): - The instances belonging to the requested - version. - next_page_token (str): - Continuation token for fetching the next page - of results. - """ - - @property - def raw_page(self): - return self - - instances: MutableSequence[instance.Instance] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=instance.Instance, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetInstanceRequest(proto.Message): - r"""Request message for ``Instances.GetInstance``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/services/default/versions/v1/instances/instance-1``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class DeleteInstanceRequest(proto.Message): - r"""Request message for ``Instances.DeleteInstance``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/services/default/versions/v1/instances/instance-1``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class DebugInstanceRequest(proto.Message): - r"""Request message for ``Instances.DebugInstance``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/services/default/versions/v1/instances/instance-1``. - ssh_key (str): - Public SSH key to add to the instance. Examples: - - - ``[USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME]`` - - ``[USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}`` - - For more information, see `Adding and Removing SSH - Keys `__. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - ssh_key: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ListIngressRulesRequest(proto.Message): - r"""Request message for ``Firewall.ListIngressRules``. - - Attributes: - parent (str): - Name of the Firewall collection to retrieve. Example: - ``apps/myapp/firewall/ingressRules``. - page_size (int): - Maximum results to return per page. - page_token (str): - Continuation token for fetching the next page - of results. - matching_address (str): - A valid IP Address. If set, only rules - matching this address will be returned. The - first returned rule will be the rule that fires - on requests from this IP. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - matching_address: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListIngressRulesResponse(proto.Message): - r"""Response message for ``Firewall.ListIngressRules``. - - Attributes: - ingress_rules (MutableSequence[google.cloud.appengine_admin_v1.types.FirewallRule]): - The ingress FirewallRules for this - application. - next_page_token (str): - Continuation token for fetching the next page - of results. - """ - - @property - def raw_page(self): - return self - - ingress_rules: MutableSequence[firewall.FirewallRule] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=firewall.FirewallRule, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class BatchUpdateIngressRulesRequest(proto.Message): - r"""Request message for ``Firewall.BatchUpdateIngressRules``. - - Attributes: - name (str): - Name of the Firewall collection to set. Example: - ``apps/myapp/firewall/ingressRules``. - ingress_rules (MutableSequence[google.cloud.appengine_admin_v1.types.FirewallRule]): - A list of FirewallRules to replace the - existing set. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - ingress_rules: MutableSequence[firewall.FirewallRule] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=firewall.FirewallRule, - ) - - -class BatchUpdateIngressRulesResponse(proto.Message): - r"""Response message for ``Firewall.UpdateAllIngressRules``. - - Attributes: - ingress_rules (MutableSequence[google.cloud.appengine_admin_v1.types.FirewallRule]): - The full list of ingress FirewallRules for - this application. - """ - - ingress_rules: MutableSequence[firewall.FirewallRule] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=firewall.FirewallRule, - ) - - -class CreateIngressRuleRequest(proto.Message): - r"""Request message for ``Firewall.CreateIngressRule``. - - Attributes: - parent (str): - Name of the parent Firewall collection in which to create a - new rule. Example: ``apps/myapp/firewall/ingressRules``. - rule (google.cloud.appengine_admin_v1.types.FirewallRule): - A FirewallRule containing the new resource. - - The user may optionally provide a position at - which the new rule will be placed. The positions - define a sequential list starting at 1. If a - rule already exists at the given position, rules - greater than the provided position will be moved - forward by one. - - If no position is provided, the server will - place the rule as the second to last rule in the - sequence before the required default allow-all - or deny-all rule. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - rule: firewall.FirewallRule = proto.Field( - proto.MESSAGE, - number=2, - message=firewall.FirewallRule, - ) - - -class GetIngressRuleRequest(proto.Message): - r"""Request message for ``Firewall.GetIngressRule``. - - Attributes: - name (str): - Name of the Firewall resource to retrieve. Example: - ``apps/myapp/firewall/ingressRules/100``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class UpdateIngressRuleRequest(proto.Message): - r"""Request message for ``Firewall.UpdateIngressRule``. - - Attributes: - name (str): - Name of the Firewall resource to update. Example: - ``apps/myapp/firewall/ingressRules/100``. - rule (google.cloud.appengine_admin_v1.types.FirewallRule): - A FirewallRule containing the updated - resource - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Standard field mask for the set of fields to - be updated. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - rule: firewall.FirewallRule = proto.Field( - proto.MESSAGE, - number=2, - message=firewall.FirewallRule, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - - -class DeleteIngressRuleRequest(proto.Message): - r"""Request message for ``Firewall.DeleteIngressRule``. - - Attributes: - name (str): - Name of the Firewall resource to delete. Example: - ``apps/myapp/firewall/ingressRules/100``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListAuthorizedDomainsRequest(proto.Message): - r"""Request message for ``AuthorizedDomains.ListAuthorizedDomains``. - - Attributes: - parent (str): - Name of the parent Application resource. Example: - ``apps/myapp``. - page_size (int): - Maximum results to return per page. - page_token (str): - Continuation token for fetching the next page - of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ListAuthorizedDomainsResponse(proto.Message): - r"""Response message for ``AuthorizedDomains.ListAuthorizedDomains``. - - Attributes: - domains (MutableSequence[google.cloud.appengine_admin_v1.types.AuthorizedDomain]): - The authorized domains belonging to the user. - next_page_token (str): - Continuation token for fetching the next page - of results. - """ - - @property - def raw_page(self): - return self - - domains: MutableSequence[domain.AuthorizedDomain] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=domain.AuthorizedDomain, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ListAuthorizedCertificatesRequest(proto.Message): - r"""Request message for - ``AuthorizedCertificates.ListAuthorizedCertificates``. - - Attributes: - parent (str): - Name of the parent ``Application`` resource. Example: - ``apps/myapp``. - view (google.cloud.appengine_admin_v1.types.AuthorizedCertificateView): - Controls the set of fields returned in the ``LIST`` - response. - page_size (int): - Maximum results to return per page. - page_token (str): - Continuation token for fetching the next page - of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - view: "AuthorizedCertificateView" = proto.Field( - proto.ENUM, - number=4, - enum="AuthorizedCertificateView", - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ListAuthorizedCertificatesResponse(proto.Message): - r"""Response message for - ``AuthorizedCertificates.ListAuthorizedCertificates``. - - Attributes: - certificates (MutableSequence[google.cloud.appengine_admin_v1.types.AuthorizedCertificate]): - The SSL certificates the user is authorized - to administer. - next_page_token (str): - Continuation token for fetching the next page - of results. - """ - - @property - def raw_page(self): - return self - - certificates: MutableSequence[ - ga_certificate.AuthorizedCertificate - ] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=ga_certificate.AuthorizedCertificate, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetAuthorizedCertificateRequest(proto.Message): - r"""Request message for - ``AuthorizedCertificates.GetAuthorizedCertificate``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/authorizedCertificates/12345``. - view (google.cloud.appengine_admin_v1.types.AuthorizedCertificateView): - Controls the set of fields returned in the ``GET`` response. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - view: "AuthorizedCertificateView" = proto.Field( - proto.ENUM, - number=2, - enum="AuthorizedCertificateView", - ) - - -class CreateAuthorizedCertificateRequest(proto.Message): - r"""Request message for - ``AuthorizedCertificates.CreateAuthorizedCertificate``. - - Attributes: - parent (str): - Name of the parent ``Application`` resource. Example: - ``apps/myapp``. - certificate (google.cloud.appengine_admin_v1.types.AuthorizedCertificate): - SSL certificate data. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - certificate: ga_certificate.AuthorizedCertificate = proto.Field( - proto.MESSAGE, - number=2, - message=ga_certificate.AuthorizedCertificate, - ) - - -class UpdateAuthorizedCertificateRequest(proto.Message): - r"""Request message for - ``AuthorizedCertificates.UpdateAuthorizedCertificate``. - - Attributes: - name (str): - Name of the resource to update. Example: - ``apps/myapp/authorizedCertificates/12345``. - certificate (google.cloud.appengine_admin_v1.types.AuthorizedCertificate): - An ``AuthorizedCertificate`` containing the updated - resource. Only fields set in the field mask will be updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Standard field mask for the set of fields to be updated. - Updates are only supported on the ``certificate_raw_data`` - and ``display_name`` fields. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - certificate: ga_certificate.AuthorizedCertificate = proto.Field( - proto.MESSAGE, - number=2, - message=ga_certificate.AuthorizedCertificate, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - - -class DeleteAuthorizedCertificateRequest(proto.Message): - r"""Request message for - ``AuthorizedCertificates.DeleteAuthorizedCertificate``. - - Attributes: - name (str): - Name of the resource to delete. Example: - ``apps/myapp/authorizedCertificates/12345``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListDomainMappingsRequest(proto.Message): - r"""Request message for ``DomainMappings.ListDomainMappings``. - - Attributes: - parent (str): - Name of the parent Application resource. Example: - ``apps/myapp``. - page_size (int): - Maximum results to return per page. - page_token (str): - Continuation token for fetching the next page - of results. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ListDomainMappingsResponse(proto.Message): - r"""Response message for ``DomainMappings.ListDomainMappings``. - - Attributes: - domain_mappings (MutableSequence[google.cloud.appengine_admin_v1.types.DomainMapping]): - The domain mappings for the application. - next_page_token (str): - Continuation token for fetching the next page - of results. - """ - - @property - def raw_page(self): - return self - - domain_mappings: MutableSequence[ - ga_domain_mapping.DomainMapping - ] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=ga_domain_mapping.DomainMapping, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetDomainMappingRequest(proto.Message): - r"""Request message for ``DomainMappings.GetDomainMapping``. - - Attributes: - name (str): - Name of the resource requested. Example: - ``apps/myapp/domainMappings/example.com``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateDomainMappingRequest(proto.Message): - r"""Request message for ``DomainMappings.CreateDomainMapping``. - - Attributes: - parent (str): - Name of the parent Application resource. Example: - ``apps/myapp``. - domain_mapping (google.cloud.appengine_admin_v1.types.DomainMapping): - Domain mapping configuration. - override_strategy (google.cloud.appengine_admin_v1.types.DomainOverrideStrategy): - Whether the domain creation should override - any existing mappings for this domain. By - default, overrides are rejected. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - domain_mapping: ga_domain_mapping.DomainMapping = proto.Field( - proto.MESSAGE, - number=2, - message=ga_domain_mapping.DomainMapping, - ) - override_strategy: "DomainOverrideStrategy" = proto.Field( - proto.ENUM, - number=4, - enum="DomainOverrideStrategy", - ) - - -class UpdateDomainMappingRequest(proto.Message): - r"""Request message for ``DomainMappings.UpdateDomainMapping``. - - Attributes: - name (str): - Name of the resource to update. Example: - ``apps/myapp/domainMappings/example.com``. - domain_mapping (google.cloud.appengine_admin_v1.types.DomainMapping): - A domain mapping containing the updated - resource. Only fields set in the field mask will - be updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. Standard field mask for the set of - fields to be updated. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - domain_mapping: ga_domain_mapping.DomainMapping = proto.Field( - proto.MESSAGE, - number=2, - message=ga_domain_mapping.DomainMapping, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - - -class DeleteDomainMappingRequest(proto.Message): - r"""Request message for ``DomainMappings.DeleteDomainMapping``. - - Attributes: - name (str): - Name of the resource to delete. Example: - ``apps/myapp/domainMappings/example.com``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py deleted file mode 100644 index 1863614..0000000 --- a/google/cloud/appengine_admin_v1/types/application.py +++ /dev/null @@ -1,321 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import duration_pb2 # type: ignore -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "Application", - "UrlDispatchRule", - }, -) - - -class Application(proto.Message): - r"""An Application resource contains the top-level configuration - of an App Engine application. - - Attributes: - name (str): - Full path to the Application resource in the API. Example: - ``apps/myapp``. - - @OutputOnly - id (str): - Identifier of the Application resource. This identifier is - equivalent to the project ID of the Google Cloud Platform - project where you want to deploy your application. Example: - ``myapp``. - dispatch_rules (MutableSequence[google.cloud.appengine_admin_v1.types.UrlDispatchRule]): - HTTP path dispatch rules for requests to the - application that do not explicitly target a - service or version. Rules are order-dependent. - Up to 20 dispatch rules can be supported. - auth_domain (str): - Google Apps authentication domain that - controls which users can access this - application. - - Defaults to open access for any Google Account. - location_id (str): - Location from which this application runs. Application - instances run out of the data centers in the specified - location, which is also where all of the application's end - user content is stored. - - Defaults to ``us-central``. - - View the list of `supported - locations `__. - code_bucket (str): - Google Cloud Storage bucket that can be used - for storing files associated with this - application. This bucket is associated with the - application and can be used by the gcloud - deployment commands. - - @OutputOnly - default_cookie_expiration (google.protobuf.duration_pb2.Duration): - Cookie expiration policy for this - application. - serving_status (google.cloud.appengine_admin_v1.types.Application.ServingStatus): - Serving status of this application. - default_hostname (str): - Hostname used to reach this application, as - resolved by App Engine. - @OutputOnly - default_bucket (str): - Google Cloud Storage bucket that can be used - by this application to store content. - - @OutputOnly - service_account (str): - The service account associated with the - application. This is the app-level default - identity. If no identity provided during create - version, Admin API will fallback to this one. - iap (google.cloud.appengine_admin_v1.types.Application.IdentityAwareProxy): - - gcr_domain (str): - The Google Container Registry domain used for - storing managed build docker images for this - application. - database_type (google.cloud.appengine_admin_v1.types.Application.DatabaseType): - The type of the Cloud Firestore or Cloud - Datastore database associated with this - application. - feature_settings (google.cloud.appengine_admin_v1.types.Application.FeatureSettings): - The feature specific settings to be used in - the application. - """ - - class ServingStatus(proto.Enum): - r""" - - Values: - UNSPECIFIED (0): - Serving status is unspecified. - SERVING (1): - Application is serving. - USER_DISABLED (2): - Application has been disabled by the user. - SYSTEM_DISABLED (3): - Application has been disabled by the system. - """ - UNSPECIFIED = 0 - SERVING = 1 - USER_DISABLED = 2 - SYSTEM_DISABLED = 3 - - class DatabaseType(proto.Enum): - r""" - - Values: - DATABASE_TYPE_UNSPECIFIED (0): - Database type is unspecified. - CLOUD_DATASTORE (1): - Cloud Datastore - CLOUD_FIRESTORE (2): - Cloud Firestore Native - CLOUD_DATASTORE_COMPATIBILITY (3): - Cloud Firestore in Datastore Mode - """ - DATABASE_TYPE_UNSPECIFIED = 0 - CLOUD_DATASTORE = 1 - CLOUD_FIRESTORE = 2 - CLOUD_DATASTORE_COMPATIBILITY = 3 - - class IdentityAwareProxy(proto.Message): - r"""Identity-Aware Proxy - - Attributes: - enabled (bool): - Whether the serving infrastructure will authenticate and - authorize all incoming requests. - - If true, the ``oauth2_client_id`` and - ``oauth2_client_secret`` fields must be non-empty. - oauth2_client_id (str): - OAuth2 client ID to use for the - authentication flow. - oauth2_client_secret (str): - OAuth2 client secret to use for the authentication flow. - - For security reasons, this value cannot be retrieved via the - API. Instead, the SHA-256 hash of the value is returned in - the ``oauth2_client_secret_sha256`` field. - - @InputOnly - oauth2_client_secret_sha256 (str): - Hex-encoded SHA-256 hash of the client - secret. - @OutputOnly - """ - - enabled: bool = proto.Field( - proto.BOOL, - number=1, - ) - oauth2_client_id: str = proto.Field( - proto.STRING, - number=2, - ) - oauth2_client_secret: str = proto.Field( - proto.STRING, - number=3, - ) - oauth2_client_secret_sha256: str = proto.Field( - proto.STRING, - number=4, - ) - - class FeatureSettings(proto.Message): - r"""The feature specific settings to be used in the application. - These define behaviors that are user configurable. - - Attributes: - split_health_checks (bool): - Boolean value indicating if split health checks should be - used instead of the legacy health checks. At an app.yaml - level, this means defaulting to 'readiness_check' and - 'liveness_check' values instead of 'health_check' ones. Once - the legacy 'health_check' behavior is deprecated, and this - value is always true, this setting can be removed. - use_container_optimized_os (bool): - If true, use `Container-Optimized - OS `__ - base image for VMs, rather than a base Debian image. - """ - - split_health_checks: bool = proto.Field( - proto.BOOL, - number=1, - ) - use_container_optimized_os: bool = proto.Field( - proto.BOOL, - number=2, - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - id: str = proto.Field( - proto.STRING, - number=2, - ) - dispatch_rules: MutableSequence["UrlDispatchRule"] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message="UrlDispatchRule", - ) - auth_domain: str = proto.Field( - proto.STRING, - number=6, - ) - location_id: str = proto.Field( - proto.STRING, - number=7, - ) - code_bucket: str = proto.Field( - proto.STRING, - number=8, - ) - default_cookie_expiration: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=9, - message=duration_pb2.Duration, - ) - serving_status: ServingStatus = proto.Field( - proto.ENUM, - number=10, - enum=ServingStatus, - ) - default_hostname: str = proto.Field( - proto.STRING, - number=11, - ) - default_bucket: str = proto.Field( - proto.STRING, - number=12, - ) - service_account: str = proto.Field( - proto.STRING, - number=13, - ) - iap: IdentityAwareProxy = proto.Field( - proto.MESSAGE, - number=14, - message=IdentityAwareProxy, - ) - gcr_domain: str = proto.Field( - proto.STRING, - number=16, - ) - database_type: DatabaseType = proto.Field( - proto.ENUM, - number=17, - enum=DatabaseType, - ) - feature_settings: FeatureSettings = proto.Field( - proto.MESSAGE, - number=18, - message=FeatureSettings, - ) - - -class UrlDispatchRule(proto.Message): - r"""Rules to match an HTTP request and dispatch that request to a - service. - - Attributes: - domain (str): - Domain name to match against. The wildcard "``*``" is - supported if specified before a period: "``*.``". - - Defaults to matching all domains: "``*``". - path (str): - Pathname within the host. Must start with a "``/``". A - single "``*``" can be included at the end of the path. - - The sum of the lengths of the domain and path may not exceed - 100 characters. - service (str): - Resource ID of a service in this application that should - serve the matched request. The service must already exist. - Example: ``default``. - """ - - domain: str = proto.Field( - proto.STRING, - number=1, - ) - path: str = proto.Field( - proto.STRING, - number=2, - ) - service: str = proto.Field( - proto.STRING, - number=3, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py deleted file mode 100644 index d1f9345..0000000 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -from google.cloud.appengine_admin_v1.types import appengine - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "AuditData", - "UpdateServiceMethod", - "CreateVersionMethod", - }, -) - - -class AuditData(proto.Message): - r"""App Engine admin service audit log. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - update_service (google.cloud.appengine_admin_v1.types.UpdateServiceMethod): - Detailed information about UpdateService - call. - - This field is a member of `oneof`_ ``method``. - create_version (google.cloud.appengine_admin_v1.types.CreateVersionMethod): - Detailed information about CreateVersion - call. - - This field is a member of `oneof`_ ``method``. - """ - - update_service: "UpdateServiceMethod" = proto.Field( - proto.MESSAGE, - number=1, - oneof="method", - message="UpdateServiceMethod", - ) - create_version: "CreateVersionMethod" = proto.Field( - proto.MESSAGE, - number=2, - oneof="method", - message="CreateVersionMethod", - ) - - -class UpdateServiceMethod(proto.Message): - r"""Detailed information about UpdateService call. - - Attributes: - request (google.cloud.appengine_admin_v1.types.UpdateServiceRequest): - Update service request. - """ - - request: appengine.UpdateServiceRequest = proto.Field( - proto.MESSAGE, - number=1, - message=appengine.UpdateServiceRequest, - ) - - -class CreateVersionMethod(proto.Message): - r"""Detailed information about CreateVersion call. - - Attributes: - request (google.cloud.appengine_admin_v1.types.CreateVersionRequest): - Create version request. - """ - - request: appengine.CreateVersionRequest = proto.Field( - proto.MESSAGE, - number=1, - message=appengine.CreateVersionRequest, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py deleted file mode 100644 index bd4df73..0000000 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import timestamp_pb2 # type: ignore -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "ManagementStatus", - "AuthorizedCertificate", - "CertificateRawData", - "ManagedCertificate", - }, -) - - -class ManagementStatus(proto.Enum): - r"""State of certificate management. Refers to the most recent - certificate acquisition or renewal attempt. - - Values: - MANAGEMENT_STATUS_UNSPECIFIED (0): - No description available. - OK (1): - Certificate was successfully obtained and - inserted into the serving system. - PENDING (2): - Certificate is under active attempts to - acquire or renew. - FAILED_RETRYING_NOT_VISIBLE (4): - Most recent renewal failed due to an invalid - DNS setup and will be retried. Renewal attempts - will continue to fail until the certificate - domain's DNS configuration is fixed. The last - successfully provisioned certificate may still - be serving. - FAILED_PERMANENT (6): - All renewal attempts have been exhausted, - likely due to an invalid DNS setup. - FAILED_RETRYING_CAA_FORBIDDEN (7): - Most recent renewal failed due to an explicit - CAA record that does not include one of the - in-use CAs (Google CA and Let's Encrypt). - Renewals will continue to fail until the CAA is - reconfigured. The last successfully provisioned - certificate may still be serving. - FAILED_RETRYING_CAA_CHECKING (8): - Most recent renewal failed due to a CAA - retrieval failure. This means that the domain's - DNS provider does not properly handle CAA - records, failing requests for CAA records when - no CAA records are defined. Renewals will - continue to fail until the DNS provider is - changed or a CAA record is added for the given - domain. The last successfully provisioned - certificate may still be serving. - """ - MANAGEMENT_STATUS_UNSPECIFIED = 0 - OK = 1 - PENDING = 2 - FAILED_RETRYING_NOT_VISIBLE = 4 - FAILED_PERMANENT = 6 - FAILED_RETRYING_CAA_FORBIDDEN = 7 - FAILED_RETRYING_CAA_CHECKING = 8 - - -class AuthorizedCertificate(proto.Message): - r"""An SSL certificate that a user has been authorized to - administer. A user is authorized to administer any certificate - that applies to one of their authorized domains. - - Attributes: - name (str): - Full path to the ``AuthorizedCertificate`` resource in the - API. Example: ``apps/myapp/authorizedCertificates/12345``. - - @OutputOnly - id (str): - Relative name of the certificate. This is a unique value - autogenerated on ``AuthorizedCertificate`` resource - creation. Example: ``12345``. - - @OutputOnly - display_name (str): - The user-specified display name of the certificate. This is - not guaranteed to be unique. Example: ``My Certificate``. - domain_names (MutableSequence[str]): - Topmost applicable domains of this certificate. This - certificate applies to these domains and their subdomains. - Example: ``example.com``. - - @OutputOnly - expire_time (google.protobuf.timestamp_pb2.Timestamp): - The time when this certificate expires. To update the - renewal time on this certificate, upload an SSL certificate - with a different expiration time using - ```AuthorizedCertificates.UpdateAuthorizedCertificate`` <>`__. - - @OutputOnly - certificate_raw_data (google.cloud.appengine_admin_v1.types.CertificateRawData): - The SSL certificate serving the ``AuthorizedCertificate`` - resource. This must be obtained independently from a - certificate authority. - managed_certificate (google.cloud.appengine_admin_v1.types.ManagedCertificate): - Only applicable if this certificate is managed by App - Engine. Managed certificates are tied to the lifecycle of a - ``DomainMapping`` and cannot be updated or deleted via the - ``AuthorizedCertificates`` API. If this certificate is - manually administered by the user, this field will be empty. - - @OutputOnly - visible_domain_mappings (MutableSequence[str]): - The full paths to user visible Domain Mapping resources that - have this certificate mapped. Example: - ``apps/myapp/domainMappings/example.com``. - - This may not represent the full list of mapped domain - mappings if the user does not have ``VIEWER`` permissions on - all of the applications that have this certificate mapped. - See ``domain_mappings_count`` for a complete count. - - Only returned by ``GET`` or ``LIST`` requests when - specifically requested by the ``view=FULL_CERTIFICATE`` - option. - - @OutputOnly - domain_mappings_count (int): - Aggregate count of the domain mappings with this certificate - mapped. This count includes domain mappings on applications - for which the user does not have ``VIEWER`` permissions. - - Only returned by ``GET`` or ``LIST`` requests when - specifically requested by the ``view=FULL_CERTIFICATE`` - option. - - @OutputOnly - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - id: str = proto.Field( - proto.STRING, - number=2, - ) - display_name: str = proto.Field( - proto.STRING, - number=3, - ) - domain_names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - expire_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=5, - message=timestamp_pb2.Timestamp, - ) - certificate_raw_data: "CertificateRawData" = proto.Field( - proto.MESSAGE, - number=6, - message="CertificateRawData", - ) - managed_certificate: "ManagedCertificate" = proto.Field( - proto.MESSAGE, - number=7, - message="ManagedCertificate", - ) - visible_domain_mappings: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=8, - ) - domain_mappings_count: int = proto.Field( - proto.INT32, - number=9, - ) - - -class CertificateRawData(proto.Message): - r"""An SSL certificate obtained from a certificate authority. - - Attributes: - public_certificate (str): - PEM encoded x.509 public key certificate. This field is set - once on certificate creation. Must include the header and - footer. Example: - - .. raw:: html - -

-                -----BEGIN CERTIFICATE-----
-                
-                -----END CERTIFICATE-----
-                
- private_key (str): - Unencrypted PEM encoded RSA private key. This field is set - once on certificate creation and then encrypted. The key - size must be 2048 bits or fewer. Must include the header and - footer. Example: - - .. raw:: html - -
-                -----BEGIN RSA PRIVATE KEY-----
-                
-                -----END RSA PRIVATE KEY-----
-                
- - @InputOnly - """ - - public_certificate: str = proto.Field( - proto.STRING, - number=1, - ) - private_key: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ManagedCertificate(proto.Message): - r"""A certificate managed by App Engine. - - Attributes: - last_renewal_time (google.protobuf.timestamp_pb2.Timestamp): - Time at which the certificate was last renewed. The renewal - process is fully managed. Certificate renewal will - automatically occur before the certificate expires. Renewal - errors can be tracked via ``ManagementStatus``. - - @OutputOnly - status (google.cloud.appengine_admin_v1.types.ManagementStatus): - Status of certificate management. Refers to - the most recent certificate acquisition or - renewal attempt. - - @OutputOnly - """ - - last_renewal_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - status: "ManagementStatus" = proto.Field( - proto.ENUM, - number=2, - enum="ManagementStatus", - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py deleted file mode 100644 index 1e60343..0000000 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ /dev/null @@ -1,196 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import duration_pb2 # type: ignore -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "Deployment", - "FileInfo", - "ContainerInfo", - "CloudBuildOptions", - "ZipInfo", - }, -) - - -class Deployment(proto.Message): - r"""Code and application artifacts used to deploy a version to - App Engine. - - Attributes: - files (MutableMapping[str, google.cloud.appengine_admin_v1.types.FileInfo]): - Manifest of the files stored in Google Cloud - Storage that are included as part of this - version. All files must be readable using the - credentials supplied with this call. - container (google.cloud.appengine_admin_v1.types.ContainerInfo): - The Docker image for the container that runs - the version. Only applicable for instances - running in the App Engine flexible environment. - zip_ (google.cloud.appengine_admin_v1.types.ZipInfo): - The zip file for this deployment, if this is - a zip deployment. - cloud_build_options (google.cloud.appengine_admin_v1.types.CloudBuildOptions): - Options for any Google Cloud Build builds - created as a part of this deployment. - - These options will only be used if a new build - is created, such as when deploying to the App - Engine flexible environment using files or zip. - """ - - files: MutableMapping[str, "FileInfo"] = proto.MapField( - proto.STRING, - proto.MESSAGE, - number=1, - message="FileInfo", - ) - container: "ContainerInfo" = proto.Field( - proto.MESSAGE, - number=2, - message="ContainerInfo", - ) - zip_: "ZipInfo" = proto.Field( - proto.MESSAGE, - number=3, - message="ZipInfo", - ) - cloud_build_options: "CloudBuildOptions" = proto.Field( - proto.MESSAGE, - number=6, - message="CloudBuildOptions", - ) - - -class FileInfo(proto.Message): - r"""Single source file that is part of the version to be - deployed. Each source file that is deployed must be specified - separately. - - Attributes: - source_url (str): - URL source to use to fetch this file. Must be - a URL to a resource in Google Cloud Storage in - the form - 'http(s)://storage.googleapis.com/\/\'. - sha1_sum (str): - The SHA1 hash of the file, in hex. - mime_type (str): - The MIME type of the file. - - Defaults to the value from Google Cloud Storage. - """ - - source_url: str = proto.Field( - proto.STRING, - number=1, - ) - sha1_sum: str = proto.Field( - proto.STRING, - number=2, - ) - mime_type: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ContainerInfo(proto.Message): - r"""Docker image that is used to create a container and start a - VM instance for the version that you deploy. Only applicable for - instances running in the App Engine flexible environment. - - Attributes: - image (str): - URI to the hosted container image in Google - Container Registry. The URI must be fully - qualified and include a tag or digest. Examples: - "gcr.io/my-project/image:tag" or - "gcr.io/my-project/image@digest". - """ - - image: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CloudBuildOptions(proto.Message): - r"""Options for the build operations performed as a part of the - version deployment. Only applicable for App Engine flexible - environment when creating a version using source code directly. - - Attributes: - app_yaml_path (str): - Path to the yaml file used in deployment, - used to determine runtime configuration details. - - Required for flexible environment builds. - - See - https://cloud.google.com/appengine/docs/standard/python/config/appref - for more details. - cloud_build_timeout (google.protobuf.duration_pb2.Duration): - The Cloud Build timeout used as part of any - dependent builds performed by version creation. - Defaults to 10 minutes. - """ - - app_yaml_path: str = proto.Field( - proto.STRING, - number=1, - ) - cloud_build_timeout: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=2, - message=duration_pb2.Duration, - ) - - -class ZipInfo(proto.Message): - r"""The zip file information for a zip deployment. - - Attributes: - source_url (str): - URL of the zip file to deploy from. Must be a - URL to a resource in Google Cloud Storage in the - form - 'http(s)://storage.googleapis.com/\/\'. - files_count (int): - An estimate of the number of files in a zip - for a zip deployment. If set, must be greater - than or equal to the actual number of files. - Used for optimizing performance; if not - provided, deployment may be slow. - """ - - source_url: str = proto.Field( - proto.STRING, - number=3, - ) - files_count: int = proto.Field( - proto.INT32, - number=4, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/deployed_files.py b/google/cloud/appengine_admin_v1/types/deployed_files.py deleted file mode 100644 index 315511b..0000000 --- a/google/cloud/appengine_admin_v1/types/deployed_files.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={}, -) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py deleted file mode 100644 index b80765f..0000000 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "AuthorizedDomain", - }, -) - - -class AuthorizedDomain(proto.Message): - r"""A domain that a user has been authorized to administer. To authorize - use of a domain, verify ownership via `Search - Console `__. - - Attributes: - name (str): - Full path to the ``AuthorizedDomain`` resource in the API. - Example: ``apps/myapp/authorizedDomains/example.com``. - - @OutputOnly - id (str): - Fully qualified domain name of the domain authorized for - use. Example: ``example.com``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - id: str = proto.Field( - proto.STRING, - number=2, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py deleted file mode 100644 index a69702f..0000000 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ /dev/null @@ -1,198 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "DomainMapping", - "SslSettings", - "ResourceRecord", - }, -) - - -class DomainMapping(proto.Message): - r"""A domain serving an App Engine application. - - Attributes: - name (str): - Full path to the ``DomainMapping`` resource in the API. - Example: ``apps/myapp/domainMapping/example.com``. - - @OutputOnly - id (str): - Relative name of the domain serving the application. - Example: ``example.com``. - ssl_settings (google.cloud.appengine_admin_v1.types.SslSettings): - SSL configuration for this domain. If - unconfigured, this domain will not serve with - SSL. - resource_records (MutableSequence[google.cloud.appengine_admin_v1.types.ResourceRecord]): - The resource records required to configure - this domain mapping. These records must be added - to the domain's DNS configuration in order to - serve the application via this domain mapping. - - @OutputOnly - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - id: str = proto.Field( - proto.STRING, - number=2, - ) - ssl_settings: "SslSettings" = proto.Field( - proto.MESSAGE, - number=3, - message="SslSettings", - ) - resource_records: MutableSequence["ResourceRecord"] = proto.RepeatedField( - proto.MESSAGE, - number=4, - message="ResourceRecord", - ) - - -class SslSettings(proto.Message): - r"""SSL configuration for a ``DomainMapping`` resource. - - Attributes: - certificate_id (str): - ID of the ``AuthorizedCertificate`` resource configuring SSL - for the application. Clearing this field will remove SSL - support. - - By default, a managed certificate is automatically created - for every domain mapping. To omit SSL support or to - configure SSL manually, specify ``SslManagementType.MANUAL`` - on a ``CREATE`` or ``UPDATE`` request. You must be - authorized to administer the ``AuthorizedCertificate`` - resource to manually map it to a ``DomainMapping`` resource. - Example: ``12345``. - ssl_management_type (google.cloud.appengine_admin_v1.types.SslSettings.SslManagementType): - SSL management type for this domain. If ``AUTOMATIC``, a - managed certificate is automatically provisioned. If - ``MANUAL``, ``certificate_id`` must be manually specified in - order to configure SSL for this domain. - pending_managed_certificate_id (str): - ID of the managed ``AuthorizedCertificate`` resource - currently being provisioned, if applicable. Until the new - managed certificate has been successfully provisioned, the - previous SSL state will be preserved. Once the provisioning - process completes, the ``certificate_id`` field will reflect - the new managed certificate and this field will be left - empty. To remove SSL support while there is still a pending - managed certificate, clear the ``certificate_id`` field with - an ``UpdateDomainMappingRequest``. - - @OutputOnly - """ - - class SslManagementType(proto.Enum): - r"""The SSL management type for this domain. - - Values: - SSL_MANAGEMENT_TYPE_UNSPECIFIED (0): - Defaults to ``AUTOMATIC``. - AUTOMATIC (1): - SSL support for this domain is configured - automatically. The mapped SSL certificate will - be automatically renewed. - MANUAL (2): - SSL support for this domain is configured - manually by the user. Either the domain has no - SSL support or a user-obtained SSL certificate - has been explictly mapped to this domain. - """ - SSL_MANAGEMENT_TYPE_UNSPECIFIED = 0 - AUTOMATIC = 1 - MANUAL = 2 - - certificate_id: str = proto.Field( - proto.STRING, - number=1, - ) - ssl_management_type: SslManagementType = proto.Field( - proto.ENUM, - number=3, - enum=SslManagementType, - ) - pending_managed_certificate_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ResourceRecord(proto.Message): - r"""A DNS resource record. - - Attributes: - name (str): - Relative name of the object affected by this record. Only - applicable for ``CNAME`` records. Example: 'www'. - rrdata (str): - Data for this record. Values vary by record - type, as defined in RFC 1035 (section 5) and RFC - 1034 (section 3.6.1). - type_ (google.cloud.appengine_admin_v1.types.ResourceRecord.RecordType): - Resource record type. Example: ``AAAA``. - """ - - class RecordType(proto.Enum): - r"""A resource record type. - - Values: - RECORD_TYPE_UNSPECIFIED (0): - An unknown resource record. - A (1): - An A resource record. Data is an IPv4 - address. - AAAA (2): - An AAAA resource record. Data is an IPv6 - address. - CNAME (3): - A CNAME resource record. Data is a domain - name to be aliased. - """ - RECORD_TYPE_UNSPECIFIED = 0 - A = 1 - AAAA = 2 - CNAME = 3 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - rrdata: str = proto.Field( - proto.STRING, - number=2, - ) - type_: RecordType = proto.Field( - proto.ENUM, - number=3, - enum=RecordType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py deleted file mode 100644 index 8c7f874..0000000 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ /dev/null @@ -1,99 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "FirewallRule", - }, -) - - -class FirewallRule(proto.Message): - r"""A single firewall rule that is evaluated against incoming - traffic and provides an action to take on matched requests. - - Attributes: - priority (int): - A positive integer between [1, Int32.MaxValue-1] that - defines the order of rule evaluation. Rules with the lowest - priority are evaluated first. - - A default rule at priority Int32.MaxValue matches all IPv4 - and IPv6 traffic when no previous rule matches. Only the - action of this rule can be modified by the user. - action (google.cloud.appengine_admin_v1.types.FirewallRule.Action): - The action to take on matched requests. - source_range (str): - IP address or range, defined using CIDR notation, of - requests that this rule applies to. You can use the wildcard - character "*" to match all IPs equivalent to "0/0" and - "::/0" together. Examples: ``192.168.1.1`` or - ``192.168.0.0/16`` or ``2001:db8::/32`` or - ``2001:0db8:0000:0042:0000:8a2e:0370:7334``. - - .. raw:: html - -

Truncation will be silently performed on addresses which are not - properly truncated. For example, `1.2.3.4/24` is accepted as the same - address as `1.2.3.0/24`. Similarly, for IPv6, `2001:db8::1/32` is accepted - as the same address as `2001:db8::/32`. - description (str): - An optional string description of this rule. - This field has a maximum length of 100 - characters. - """ - - class Action(proto.Enum): - r"""Available actions to take on matching requests. - - Values: - UNSPECIFIED_ACTION (0): - No description available. - ALLOW (1): - Matching requests are allowed. - DENY (2): - Matching requests are denied. - """ - UNSPECIFIED_ACTION = 0 - ALLOW = 1 - DENY = 2 - - priority: int = proto.Field( - proto.INT32, - number=1, - ) - action: Action = proto.Field( - proto.ENUM, - number=2, - enum=Action, - ) - source_range: str = proto.Field( - proto.STRING, - number=3, - ) - description: str = proto.Field( - proto.STRING, - number=4, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py deleted file mode 100644 index 08fb581..0000000 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ /dev/null @@ -1,225 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import timestamp_pb2 # type: ignore -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "Instance", - }, -) - - -class Instance(proto.Message): - r"""An Instance resource is the computing unit that App Engine - uses to automatically scale an application. - - Attributes: - name (str): - Output only. Full path to the Instance resource in the API. - Example: - ``apps/myapp/services/default/versions/v1/instances/instance-1``. - id (str): - Output only. Relative name of the instance within the - version. Example: ``instance-1``. - app_engine_release (str): - Output only. App Engine release this instance - is running on. - availability (google.cloud.appengine_admin_v1.types.Instance.Availability): - Output only. Availability of the instance. - vm_name (str): - Output only. Name of the virtual machine - where this instance lives. Only applicable for - instances in App Engine flexible environment. - vm_zone_name (str): - Output only. Zone where the virtual machine - is located. Only applicable for instances in App - Engine flexible environment. - vm_id (str): - Output only. Virtual machine ID of this - instance. Only applicable for instances in App - Engine flexible environment. - start_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time that this instance was - started. - @OutputOnly - requests (int): - Output only. Number of requests since this - instance was started. - errors (int): - Output only. Number of errors since this - instance was started. - qps (float): - Output only. Average queries per second (QPS) - over the last minute. - average_latency (int): - Output only. Average latency (ms) over the - last minute. - memory_usage (int): - Output only. Total memory in use (bytes). - vm_status (str): - Output only. Status of the virtual machine - where this instance lives. Only applicable for - instances in App Engine flexible environment. - vm_debug_enabled (bool): - Output only. Whether this instance is in - debug mode. Only applicable for instances in App - Engine flexible environment. - vm_ip (str): - Output only. The IP address of this instance. - Only applicable for instances in App Engine - flexible environment. - vm_liveness (google.cloud.appengine_admin_v1.types.Instance.Liveness.LivenessState): - Output only. The liveness health check of - this instance. Only applicable for instances in - App Engine flexible environment. - """ - - class Availability(proto.Enum): - r"""Availability of the instance. - - Values: - UNSPECIFIED (0): - No description available. - RESIDENT (1): - No description available. - DYNAMIC (2): - No description available. - """ - UNSPECIFIED = 0 - RESIDENT = 1 - DYNAMIC = 2 - - class Liveness(proto.Message): - r"""Wrapper for LivenessState enum.""" - - class LivenessState(proto.Enum): - r"""Liveness health check status for Flex instances. - - Values: - LIVENESS_STATE_UNSPECIFIED (0): - There is no liveness health check for the - instance. Only applicable for instances in App - Engine standard environment. - UNKNOWN (1): - The health checking system is aware of the - instance but its health is not known at the - moment. - HEALTHY (2): - The instance is reachable i.e. a connection - to the application health checking endpoint can - be established, and conforms to the requirements - defined by the health check. - UNHEALTHY (3): - The instance is reachable, but does not - conform to the requirements defined by the - health check. - DRAINING (4): - The instance is being drained. The existing - connections to the instance have time to - complete, but the new ones are being refused. - TIMEOUT (5): - The instance is unreachable i.e. a connection - to the application health checking endpoint - cannot be established, or the server does not - respond within the specified timeout. - """ - LIVENESS_STATE_UNSPECIFIED = 0 - UNKNOWN = 1 - HEALTHY = 2 - UNHEALTHY = 3 - DRAINING = 4 - TIMEOUT = 5 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - id: str = proto.Field( - proto.STRING, - number=2, - ) - app_engine_release: str = proto.Field( - proto.STRING, - number=3, - ) - availability: Availability = proto.Field( - proto.ENUM, - number=4, - enum=Availability, - ) - vm_name: str = proto.Field( - proto.STRING, - number=5, - ) - vm_zone_name: str = proto.Field( - proto.STRING, - number=6, - ) - vm_id: str = proto.Field( - proto.STRING, - number=7, - ) - start_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - requests: int = proto.Field( - proto.INT32, - number=9, - ) - errors: int = proto.Field( - proto.INT32, - number=10, - ) - qps: float = proto.Field( - proto.FLOAT, - number=11, - ) - average_latency: int = proto.Field( - proto.INT32, - number=12, - ) - memory_usage: int = proto.Field( - proto.INT64, - number=13, - ) - vm_status: str = proto.Field( - proto.STRING, - number=14, - ) - vm_debug_enabled: bool = proto.Field( - proto.BOOL, - number=15, - ) - vm_ip: str = proto.Field( - proto.STRING, - number=16, - ) - vm_liveness: Liveness.LivenessState = proto.Field( - proto.ENUM, - number=17, - enum=Liveness.LivenessState, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/location.py b/google/cloud/appengine_admin_v1/types/location.py deleted file mode 100644 index b29e518..0000000 --- a/google/cloud/appengine_admin_v1/types/location.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "LocationMetadata", - }, -) - - -class LocationMetadata(proto.Message): - r"""Metadata for the given - [google.cloud.location.Location][google.cloud.location.Location]. - - Attributes: - standard_environment_available (bool): - App Engine standard environment is available - in the given location. - @OutputOnly - flexible_environment_available (bool): - App Engine flexible environment is available - in the given location. - @OutputOnly - search_api_available (bool): - Output only. `Search - API `__ - is available in the given location. - """ - - standard_environment_available: bool = proto.Field( - proto.BOOL, - number=2, - ) - flexible_environment_available: bool = proto.Field( - proto.BOOL, - number=4, - ) - search_api_available: bool = proto.Field( - proto.BOOL, - number=6, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/network_settings.py b/google/cloud/appengine_admin_v1/types/network_settings.py deleted file mode 100644 index 5516fe3..0000000 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "NetworkSettings", - }, -) - - -class NetworkSettings(proto.Message): - r"""A NetworkSettings resource is a container for ingress - settings for a version or service. - - Attributes: - ingress_traffic_allowed (google.cloud.appengine_admin_v1.types.NetworkSettings.IngressTrafficAllowed): - The ingress settings for version or service. - """ - - class IngressTrafficAllowed(proto.Enum): - r"""If unspecified, INGRESS_TRAFFIC_ALLOWED_ALL will be used. - - Values: - INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED (0): - Unspecified - INGRESS_TRAFFIC_ALLOWED_ALL (1): - Allow HTTP traffic from public and private - sources. - INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY (2): - Allow HTTP traffic from only private VPC - sources. - INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB (3): - Allow HTTP traffic from private VPC sources - and through load balancers. - """ - INGRESS_TRAFFIC_ALLOWED_UNSPECIFIED = 0 - INGRESS_TRAFFIC_ALLOWED_ALL = 1 - INGRESS_TRAFFIC_ALLOWED_INTERNAL_ONLY = 2 - INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB = 3 - - ingress_traffic_allowed: IngressTrafficAllowed = proto.Field( - proto.ENUM, - number=1, - enum=IngressTrafficAllowed, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py deleted file mode 100644 index 58e0524..0000000 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import timestamp_pb2 # type: ignore -import proto # type: ignore - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "OperationMetadataV1", - "CreateVersionMetadataV1", - }, -) - - -class OperationMetadataV1(proto.Message): - r"""Metadata for the given - [google.longrunning.Operation][google.longrunning.Operation]. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - method (str): - API method that initiated this operation. Example: - ``google.appengine.v1.Versions.CreateVersion``. - - @OutputOnly - insert_time (google.protobuf.timestamp_pb2.Timestamp): - Time that this operation was created. - - @OutputOnly - end_time (google.protobuf.timestamp_pb2.Timestamp): - Time that this operation completed. - - @OutputOnly - user (str): - User who requested this operation. - - @OutputOnly - target (str): - Name of the resource that this operation is acting on. - Example: ``apps/myapp/services/default``. - - @OutputOnly - ephemeral_message (str): - Ephemeral message that may change every time - the operation is polled. @OutputOnly - warning (MutableSequence[str]): - Durable messages that persist on every - operation poll. @OutputOnly - create_version_metadata (google.cloud.appengine_admin_v1.types.CreateVersionMetadataV1): - - This field is a member of `oneof`_ ``method_metadata``. - """ - - method: str = proto.Field( - proto.STRING, - number=1, - ) - insert_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - end_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - user: str = proto.Field( - proto.STRING, - number=4, - ) - target: str = proto.Field( - proto.STRING, - number=5, - ) - ephemeral_message: str = proto.Field( - proto.STRING, - number=6, - ) - warning: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=7, - ) - create_version_metadata: "CreateVersionMetadataV1" = proto.Field( - proto.MESSAGE, - number=8, - oneof="method_metadata", - message="CreateVersionMetadataV1", - ) - - -class CreateVersionMetadataV1(proto.Message): - r"""Metadata for the given - [google.longrunning.Operation][google.longrunning.Operation] during - a - [google.appengine.v1.CreateVersionRequest][google.appengine.v1.CreateVersionRequest]. - - Attributes: - cloud_build_id (str): - The Cloud Build ID if one was created as part - of the version create. @OutputOnly - """ - - cloud_build_id: str = proto.Field( - proto.STRING, - number=1, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py deleted file mode 100644 index 1b58295..0000000 --- a/google/cloud/appengine_admin_v1/types/service.py +++ /dev/null @@ -1,169 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -from google.cloud.appengine_admin_v1.types import ( - network_settings as ga_network_settings, -) - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "Service", - "TrafficSplit", - }, -) - - -class Service(proto.Message): - r"""A Service resource is a logical component of an application - that can share state and communicate in a secure fashion with - other services. For example, an application that handles - customer requests might include separate services to handle - tasks such as backend data analysis or API requests from mobile - devices. Each service has a collection of versions that define a - specific set of code used to implement the functionality of that - service. - - Attributes: - name (str): - Full path to the Service resource in the API. Example: - ``apps/myapp/services/default``. - - @OutputOnly - id (str): - Relative name of the service within the application. - Example: ``default``. - - @OutputOnly - split (google.cloud.appengine_admin_v1.types.TrafficSplit): - Mapping that defines fractional HTTP traffic - diversion to different versions within the - service. - labels (MutableMapping[str, str]): - A set of labels to apply to this service. - Labels are key/value pairs that describe the - service and all resources that belong to it - (e.g., versions). The labels can be used to - search and group resources, and are propagated - to the usage and billing reports, enabling - fine-grain analysis of costs. An example of - using labels is to tag resources belonging to - different environments (e.g., "env=prod", - "env=qa"). - -

Label keys and values can be no longer than - 63 characters and can only contain lowercase - letters, numeric characters, underscores, - dashes, and international characters. Label keys - must start with a lowercase letter or an - international character. Each service can have - at most 32 labels. - network_settings (google.cloud.appengine_admin_v1.types.NetworkSettings): - Ingress settings for this service. Will apply - to all versions. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - id: str = proto.Field( - proto.STRING, - number=2, - ) - split: "TrafficSplit" = proto.Field( - proto.MESSAGE, - number=3, - message="TrafficSplit", - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - network_settings: ga_network_settings.NetworkSettings = proto.Field( - proto.MESSAGE, - number=6, - message=ga_network_settings.NetworkSettings, - ) - - -class TrafficSplit(proto.Message): - r"""Traffic routing configuration for versions within a single - service. Traffic splits define how traffic directed to the - service is assigned to versions. - - Attributes: - shard_by (google.cloud.appengine_admin_v1.types.TrafficSplit.ShardBy): - Mechanism used to determine which version a - request is sent to. The traffic selection - algorithm will be stable for either type until - allocations are changed. - allocations (MutableMapping[str, float]): - Mapping from version IDs within the service to fractional - (0.000, 1] allocations of traffic for that version. Each - version can be specified only once, but some versions in the - service may not have any traffic allocation. Services that - have traffic allocated cannot be deleted until either the - service is deleted or their traffic allocation is removed. - Allocations must sum to 1. Up to two decimal place precision - is supported for IP-based splits and up to three decimal - places is supported for cookie-based splits. - """ - - class ShardBy(proto.Enum): - r"""Available sharding mechanisms. - - Values: - UNSPECIFIED (0): - Diversion method unspecified. - COOKIE (1): - Diversion based on a specially named cookie, - "GOOGAPPUID." The cookie must be set by the - application itself or no diversion will occur. - IP (2): - Diversion based on applying the modulus - operation to a fingerprint of the IP address. - RANDOM (3): - Diversion based on weighted random - assignment. An incoming request is randomly - routed to a version in the traffic split, with - probability proportional to the version's - traffic share. - """ - UNSPECIFIED = 0 - COOKIE = 1 - IP = 2 - RANDOM = 3 - - shard_by: ShardBy = proto.Field( - proto.ENUM, - number=1, - enum=ShardBy, - ) - allocations: MutableMapping[str, float] = proto.MapField( - proto.STRING, - proto.DOUBLE, - number=2, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py deleted file mode 100644 index ec93455..0000000 --- a/google/cloud/appengine_admin_v1/types/version.py +++ /dev/null @@ -1,1089 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -from __future__ import annotations - -from typing import MutableMapping, MutableSequence - -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -import proto # type: ignore - -from google.cloud.appengine_admin_v1.types import app_yaml, deploy - -__protobuf__ = proto.module( - package="google.appengine.v1", - manifest={ - "InboundServiceType", - "ServingStatus", - "Version", - "EndpointsApiService", - "AutomaticScaling", - "BasicScaling", - "ManualScaling", - "CpuUtilization", - "RequestUtilization", - "DiskUtilization", - "NetworkUtilization", - "StandardSchedulerSettings", - "Network", - "Volume", - "Resources", - "VpcAccessConnector", - "Entrypoint", - }, -) - - -class InboundServiceType(proto.Enum): - r"""Available inbound services. - - Values: - INBOUND_SERVICE_UNSPECIFIED (0): - Not specified. - INBOUND_SERVICE_MAIL (1): - Allows an application to receive mail. - INBOUND_SERVICE_MAIL_BOUNCE (2): - Allows an application to receive email-bound - notifications. - INBOUND_SERVICE_XMPP_ERROR (3): - Allows an application to receive error - stanzas. - INBOUND_SERVICE_XMPP_MESSAGE (4): - Allows an application to receive instant - messages. - INBOUND_SERVICE_XMPP_SUBSCRIBE (5): - Allows an application to receive user - subscription POSTs. - INBOUND_SERVICE_XMPP_PRESENCE (6): - Allows an application to receive a user's - chat presence. - INBOUND_SERVICE_CHANNEL_PRESENCE (7): - Registers an application for notifications - when a client connects or disconnects from a - channel. - INBOUND_SERVICE_WARMUP (9): - Enables warmup requests. - """ - INBOUND_SERVICE_UNSPECIFIED = 0 - INBOUND_SERVICE_MAIL = 1 - INBOUND_SERVICE_MAIL_BOUNCE = 2 - INBOUND_SERVICE_XMPP_ERROR = 3 - INBOUND_SERVICE_XMPP_MESSAGE = 4 - INBOUND_SERVICE_XMPP_SUBSCRIBE = 5 - INBOUND_SERVICE_XMPP_PRESENCE = 6 - INBOUND_SERVICE_CHANNEL_PRESENCE = 7 - INBOUND_SERVICE_WARMUP = 9 - - -class ServingStatus(proto.Enum): - r"""Run states of a version. - - Values: - SERVING_STATUS_UNSPECIFIED (0): - Not specified. - SERVING (1): - Currently serving. Instances are created - according to the scaling settings of the - version. - STOPPED (2): - Disabled. No instances will be created and the scaling - settings are ignored until the state of the version changes - to ``SERVING``. - """ - SERVING_STATUS_UNSPECIFIED = 0 - SERVING = 1 - STOPPED = 2 - - -class Version(proto.Message): - r"""A Version resource is a specific set of source code and - configuration files that are deployed into a service. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Full path to the Version resource in the API. Example: - ``apps/myapp/services/default/versions/v1``. - - @OutputOnly - id (str): - Relative name of the version within the service. Example: - ``v1``. Version names can contain only lowercase letters, - numbers, or hyphens. Reserved names: "default", "latest", - and any name with the prefix "ah-". - automatic_scaling (google.cloud.appengine_admin_v1.types.AutomaticScaling): - Automatic scaling is based on request rate, - response latencies, and other application - metrics. Instances are dynamically created and - destroyed as needed in order to handle traffic. - - This field is a member of `oneof`_ ``scaling``. - basic_scaling (google.cloud.appengine_admin_v1.types.BasicScaling): - A service with basic scaling will create an - instance when the application receives a - request. The instance will be turned down when - the app becomes idle. Basic scaling is ideal for - work that is intermittent or driven by user - activity. - - This field is a member of `oneof`_ ``scaling``. - manual_scaling (google.cloud.appengine_admin_v1.types.ManualScaling): - A service with manual scaling runs - continuously, allowing you to perform complex - initialization and rely on the state of its - memory over time. Manually scaled versions are - sometimes referred to as "backends". - - This field is a member of `oneof`_ ``scaling``. - inbound_services (MutableSequence[google.cloud.appengine_admin_v1.types.InboundServiceType]): - Before an application can receive email or - XMPP messages, the application must be - configured to enable the service. - instance_class (str): - Instance class that is used to run this version. Valid - values are: - - - AutomaticScaling: ``F1``, ``F2``, ``F4``, ``F4_1G`` - - ManualScaling or BasicScaling: ``B1``, ``B2``, ``B4``, - ``B8``, ``B4_1G`` - - Defaults to ``F1`` for AutomaticScaling and ``B1`` for - ManualScaling or BasicScaling. - network (google.cloud.appengine_admin_v1.types.Network): - Extra network settings. - Only applicable in the App Engine flexible - environment. - zones (MutableSequence[str]): - The Google Compute Engine zones that are - supported by this version in the App Engine - flexible environment. Deprecated. - resources (google.cloud.appengine_admin_v1.types.Resources): - Machine resources for this version. - Only applicable in the App Engine flexible - environment. - runtime (str): - Desired runtime. Example: ``python27``. - runtime_channel (str): - The channel of the runtime to use. Only available for some - runtimes. Defaults to the ``default`` channel. - threadsafe (bool): - Whether multiple requests can be dispatched - to this version at once. - vm (bool): - Whether to deploy this version in a container - on a virtual machine. - app_engine_apis (bool): - Allows App Engine second generation runtimes - to access the legacy bundled services. - beta_settings (MutableMapping[str, str]): - Metadata settings that are supplied to this - version to enable beta runtime features. - env (str): - App Engine execution environment for this version. - - Defaults to ``standard``. - serving_status (google.cloud.appengine_admin_v1.types.ServingStatus): - Current serving status of this version. Only the versions - with a ``SERVING`` status create instances and can be - billed. - - ``SERVING_STATUS_UNSPECIFIED`` is an invalid value. Defaults - to ``SERVING``. - created_by (str): - Email address of the user who created this - version. - @OutputOnly - create_time (google.protobuf.timestamp_pb2.Timestamp): - Time that this version was created. - - @OutputOnly - disk_usage_bytes (int): - Total size in bytes of all the files that are - included in this version and currently hosted on - the App Engine disk. - - @OutputOnly - runtime_api_version (str): - The version of the API in the given runtime - environment. Please see the app.yaml reference - for valid values at - https://cloud.google.com/appengine/docs/standard//config/appref - runtime_main_executable_path (str): - The path or name of the app's main - executable. - service_account (str): - The identity that the deployed version will - run as. Admin API will use the App Engine - Appspot service account as default if this field - is neither provided in app.yaml file nor through - CLI flag. - handlers (MutableSequence[google.cloud.appengine_admin_v1.types.UrlMap]): - An ordered list of URL-matching patterns that should be - applied to incoming requests. The first matching URL handles - the request and other request handlers are not attempted. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - error_handlers (MutableSequence[google.cloud.appengine_admin_v1.types.ErrorHandler]): - Custom static error pages. Limited to 10KB per page. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - libraries (MutableSequence[google.cloud.appengine_admin_v1.types.Library]): - Configuration for third-party Python runtime libraries that - are required by the application. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - api_config (google.cloud.appengine_admin_v1.types.ApiConfigHandler): - Serving configuration for `Google Cloud - Endpoints `__. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - env_variables (MutableMapping[str, str]): - Environment variables available to the application. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - build_env_variables (MutableMapping[str, str]): - Environment variables available to the build environment. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - default_expiration (google.protobuf.duration_pb2.Duration): - Duration that static files should be cached by web proxies - and browsers. Only applicable if the corresponding - `StaticFilesHandler `__ - does not specify its own expiration time. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - health_check (google.cloud.appengine_admin_v1.types.HealthCheck): - Configures health checking for instances. Unhealthy - instances are stopped and replaced with new instances. Only - applicable in the App Engine flexible environment. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - readiness_check (google.cloud.appengine_admin_v1.types.ReadinessCheck): - Configures readiness health checking for instances. - Unhealthy instances are not put into the backend traffic - rotation. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - liveness_check (google.cloud.appengine_admin_v1.types.LivenessCheck): - Configures liveness health checking for instances. Unhealthy - instances are stopped and replaced with new instances - - Only returned in ``GET`` requests if ``view=FULL`` is set. - nobuild_files_regex (str): - Files that match this pattern will not be built into this - version. Only applicable for Go runtimes. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - deployment (google.cloud.appengine_admin_v1.types.Deployment): - Code and application artifacts that make up this version. - - Only returned in ``GET`` requests if ``view=FULL`` is set. - version_url (str): - Serving URL for this version. Example: - - "https://myversion-dot-myservice-dot-myapp.appspot.com" - - @OutputOnly - endpoints_api_service (google.cloud.appengine_admin_v1.types.EndpointsApiService): - Cloud Endpoints configuration. - - If endpoints_api_service is set, the Cloud Endpoints - Extensible Service Proxy will be provided to serve the API - implemented by the app. - entrypoint (google.cloud.appengine_admin_v1.types.Entrypoint): - The entrypoint for the application. - vpc_access_connector (google.cloud.appengine_admin_v1.types.VpcAccessConnector): - Enables VPC connectivity for standard apps. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - id: str = proto.Field( - proto.STRING, - number=2, - ) - automatic_scaling: "AutomaticScaling" = proto.Field( - proto.MESSAGE, - number=3, - oneof="scaling", - message="AutomaticScaling", - ) - basic_scaling: "BasicScaling" = proto.Field( - proto.MESSAGE, - number=4, - oneof="scaling", - message="BasicScaling", - ) - manual_scaling: "ManualScaling" = proto.Field( - proto.MESSAGE, - number=5, - oneof="scaling", - message="ManualScaling", - ) - inbound_services: MutableSequence["InboundServiceType"] = proto.RepeatedField( - proto.ENUM, - number=6, - enum="InboundServiceType", - ) - instance_class: str = proto.Field( - proto.STRING, - number=7, - ) - network: "Network" = proto.Field( - proto.MESSAGE, - number=8, - message="Network", - ) - zones: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=118, - ) - resources: "Resources" = proto.Field( - proto.MESSAGE, - number=9, - message="Resources", - ) - runtime: str = proto.Field( - proto.STRING, - number=10, - ) - runtime_channel: str = proto.Field( - proto.STRING, - number=117, - ) - threadsafe: bool = proto.Field( - proto.BOOL, - number=11, - ) - vm: bool = proto.Field( - proto.BOOL, - number=12, - ) - app_engine_apis: bool = proto.Field( - proto.BOOL, - number=128, - ) - beta_settings: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=13, - ) - env: str = proto.Field( - proto.STRING, - number=14, - ) - serving_status: "ServingStatus" = proto.Field( - proto.ENUM, - number=15, - enum="ServingStatus", - ) - created_by: str = proto.Field( - proto.STRING, - number=16, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=17, - message=timestamp_pb2.Timestamp, - ) - disk_usage_bytes: int = proto.Field( - proto.INT64, - number=18, - ) - runtime_api_version: str = proto.Field( - proto.STRING, - number=21, - ) - runtime_main_executable_path: str = proto.Field( - proto.STRING, - number=22, - ) - service_account: str = proto.Field( - proto.STRING, - number=127, - ) - handlers: MutableSequence[app_yaml.UrlMap] = proto.RepeatedField( - proto.MESSAGE, - number=100, - message=app_yaml.UrlMap, - ) - error_handlers: MutableSequence[app_yaml.ErrorHandler] = proto.RepeatedField( - proto.MESSAGE, - number=101, - message=app_yaml.ErrorHandler, - ) - libraries: MutableSequence[app_yaml.Library] = proto.RepeatedField( - proto.MESSAGE, - number=102, - message=app_yaml.Library, - ) - api_config: app_yaml.ApiConfigHandler = proto.Field( - proto.MESSAGE, - number=103, - message=app_yaml.ApiConfigHandler, - ) - env_variables: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=104, - ) - build_env_variables: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=125, - ) - default_expiration: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=105, - message=duration_pb2.Duration, - ) - health_check: app_yaml.HealthCheck = proto.Field( - proto.MESSAGE, - number=106, - message=app_yaml.HealthCheck, - ) - readiness_check: app_yaml.ReadinessCheck = proto.Field( - proto.MESSAGE, - number=112, - message=app_yaml.ReadinessCheck, - ) - liveness_check: app_yaml.LivenessCheck = proto.Field( - proto.MESSAGE, - number=113, - message=app_yaml.LivenessCheck, - ) - nobuild_files_regex: str = proto.Field( - proto.STRING, - number=107, - ) - deployment: deploy.Deployment = proto.Field( - proto.MESSAGE, - number=108, - message=deploy.Deployment, - ) - version_url: str = proto.Field( - proto.STRING, - number=109, - ) - endpoints_api_service: "EndpointsApiService" = proto.Field( - proto.MESSAGE, - number=110, - message="EndpointsApiService", - ) - entrypoint: "Entrypoint" = proto.Field( - proto.MESSAGE, - number=122, - message="Entrypoint", - ) - vpc_access_connector: "VpcAccessConnector" = proto.Field( - proto.MESSAGE, - number=121, - message="VpcAccessConnector", - ) - - -class EndpointsApiService(proto.Message): - r"""`Cloud Endpoints `__ - configuration. The Endpoints API Service provides tooling for - serving Open API and gRPC endpoints via an NGINX proxy. Only valid - for App Engine Flexible environment deployments. - - The fields here refer to the name and configuration ID of a - "service" resource in the `Service Management - API `__. - - Attributes: - name (str): - Endpoints service name which is the name of - the "service" resource in the Service Management - API. For example - "myapi.endpoints.myproject.cloud.goog". - config_id (str): - Endpoints service configuration ID as specified by the - Service Management API. For example "2016-09-19r1". - - By default, the rollout strategy for Endpoints is - ``RolloutStrategy.FIXED``. This means that Endpoints starts - up with a particular configuration ID. When a new - configuration is rolled out, Endpoints must be given the new - configuration ID. The ``config_id`` field is used to give - the configuration ID and is required in this case. - - Endpoints also has a rollout strategy called - ``RolloutStrategy.MANAGED``. When using this, Endpoints - fetches the latest configuration and does not need the - configuration ID. In this case, ``config_id`` must be - omitted. - rollout_strategy (google.cloud.appengine_admin_v1.types.EndpointsApiService.RolloutStrategy): - Endpoints rollout strategy. If ``FIXED``, ``config_id`` must - be specified. If ``MANAGED``, ``config_id`` must be omitted. - disable_trace_sampling (bool): - Enable or disable trace sampling. By default, - this is set to false for enabled. - """ - - class RolloutStrategy(proto.Enum): - r"""Available rollout strategies. - - Values: - UNSPECIFIED_ROLLOUT_STRATEGY (0): - Not specified. Defaults to ``FIXED``. - FIXED (1): - Endpoints service configuration ID will be fixed to the - configuration ID specified by ``config_id``. - MANAGED (2): - Endpoints service configuration ID will be - updated with each rollout. - """ - UNSPECIFIED_ROLLOUT_STRATEGY = 0 - FIXED = 1 - MANAGED = 2 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - config_id: str = proto.Field( - proto.STRING, - number=2, - ) - rollout_strategy: RolloutStrategy = proto.Field( - proto.ENUM, - number=3, - enum=RolloutStrategy, - ) - disable_trace_sampling: bool = proto.Field( - proto.BOOL, - number=4, - ) - - -class AutomaticScaling(proto.Message): - r"""Automatic scaling is based on request rate, response - latencies, and other application metrics. - - Attributes: - cool_down_period (google.protobuf.duration_pb2.Duration): - The time period that the - `Autoscaler `__ - should wait before it starts collecting information from a - new instance. This prevents the autoscaler from collecting - information when the instance is initializing, during which - the collected usage would not be reliable. Only applicable - in the App Engine flexible environment. - cpu_utilization (google.cloud.appengine_admin_v1.types.CpuUtilization): - Target scaling by CPU usage. - max_concurrent_requests (int): - Number of concurrent requests an automatic - scaling instance can accept before the scheduler - spawns a new instance. - - Defaults to a runtime-specific value. - max_idle_instances (int): - Maximum number of idle instances that should - be maintained for this version. - max_total_instances (int): - Maximum number of instances that should be - started to handle requests for this version. - max_pending_latency (google.protobuf.duration_pb2.Duration): - Maximum amount of time that a request should - wait in the pending queue before starting a new - instance to handle it. - min_idle_instances (int): - Minimum number of idle instances that should - be maintained for this version. Only applicable - for the default version of a service. - min_total_instances (int): - Minimum number of running instances that - should be maintained for this version. - min_pending_latency (google.protobuf.duration_pb2.Duration): - Minimum amount of time a request should wait - in the pending queue before starting a new - instance to handle it. - request_utilization (google.cloud.appengine_admin_v1.types.RequestUtilization): - Target scaling by request utilization. - disk_utilization (google.cloud.appengine_admin_v1.types.DiskUtilization): - Target scaling by disk usage. - network_utilization (google.cloud.appengine_admin_v1.types.NetworkUtilization): - Target scaling by network usage. - standard_scheduler_settings (google.cloud.appengine_admin_v1.types.StandardSchedulerSettings): - Scheduler settings for standard environment. - """ - - cool_down_period: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=1, - message=duration_pb2.Duration, - ) - cpu_utilization: "CpuUtilization" = proto.Field( - proto.MESSAGE, - number=2, - message="CpuUtilization", - ) - max_concurrent_requests: int = proto.Field( - proto.INT32, - number=3, - ) - max_idle_instances: int = proto.Field( - proto.INT32, - number=4, - ) - max_total_instances: int = proto.Field( - proto.INT32, - number=5, - ) - max_pending_latency: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=6, - message=duration_pb2.Duration, - ) - min_idle_instances: int = proto.Field( - proto.INT32, - number=7, - ) - min_total_instances: int = proto.Field( - proto.INT32, - number=8, - ) - min_pending_latency: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=9, - message=duration_pb2.Duration, - ) - request_utilization: "RequestUtilization" = proto.Field( - proto.MESSAGE, - number=10, - message="RequestUtilization", - ) - disk_utilization: "DiskUtilization" = proto.Field( - proto.MESSAGE, - number=11, - message="DiskUtilization", - ) - network_utilization: "NetworkUtilization" = proto.Field( - proto.MESSAGE, - number=12, - message="NetworkUtilization", - ) - standard_scheduler_settings: "StandardSchedulerSettings" = proto.Field( - proto.MESSAGE, - number=20, - message="StandardSchedulerSettings", - ) - - -class BasicScaling(proto.Message): - r"""A service with basic scaling will create an instance when the - application receives a request. The instance will be turned down - when the app becomes idle. Basic scaling is ideal for work that - is intermittent or driven by user activity. - - Attributes: - idle_timeout (google.protobuf.duration_pb2.Duration): - Duration of time after the last request that - an instance must wait before the instance is - shut down. - max_instances (int): - Maximum number of instances to create for - this version. - """ - - idle_timeout: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=1, - message=duration_pb2.Duration, - ) - max_instances: int = proto.Field( - proto.INT32, - number=2, - ) - - -class ManualScaling(proto.Message): - r"""A service with manual scaling runs continuously, allowing you - to perform complex initialization and rely on the state of its - memory over time. - - Attributes: - instances (int): - Number of instances to assign to the service at the start. - This number can later be altered by using the `Modules - API `__ - ``set_num_instances()`` function. - """ - - instances: int = proto.Field( - proto.INT32, - number=1, - ) - - -class CpuUtilization(proto.Message): - r"""Target scaling by CPU usage. - - Attributes: - aggregation_window_length (google.protobuf.duration_pb2.Duration): - Period of time over which CPU utilization is - calculated. - target_utilization (float): - Target CPU utilization ratio to maintain when - scaling. Must be between 0 and 1. - """ - - aggregation_window_length: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=1, - message=duration_pb2.Duration, - ) - target_utilization: float = proto.Field( - proto.DOUBLE, - number=2, - ) - - -class RequestUtilization(proto.Message): - r"""Target scaling by request utilization. - Only applicable in the App Engine flexible environment. - - Attributes: - target_request_count_per_second (int): - Target requests per second. - target_concurrent_requests (int): - Target number of concurrent requests. - """ - - target_request_count_per_second: int = proto.Field( - proto.INT32, - number=1, - ) - target_concurrent_requests: int = proto.Field( - proto.INT32, - number=2, - ) - - -class DiskUtilization(proto.Message): - r"""Target scaling by disk usage. - Only applicable in the App Engine flexible environment. - - Attributes: - target_write_bytes_per_second (int): - Target bytes written per second. - target_write_ops_per_second (int): - Target ops written per second. - target_read_bytes_per_second (int): - Target bytes read per second. - target_read_ops_per_second (int): - Target ops read per seconds. - """ - - target_write_bytes_per_second: int = proto.Field( - proto.INT32, - number=14, - ) - target_write_ops_per_second: int = proto.Field( - proto.INT32, - number=15, - ) - target_read_bytes_per_second: int = proto.Field( - proto.INT32, - number=16, - ) - target_read_ops_per_second: int = proto.Field( - proto.INT32, - number=17, - ) - - -class NetworkUtilization(proto.Message): - r"""Target scaling by network usage. - Only applicable in the App Engine flexible environment. - - Attributes: - target_sent_bytes_per_second (int): - Target bytes sent per second. - target_sent_packets_per_second (int): - Target packets sent per second. - target_received_bytes_per_second (int): - Target bytes received per second. - target_received_packets_per_second (int): - Target packets received per second. - """ - - target_sent_bytes_per_second: int = proto.Field( - proto.INT32, - number=1, - ) - target_sent_packets_per_second: int = proto.Field( - proto.INT32, - number=11, - ) - target_received_bytes_per_second: int = proto.Field( - proto.INT32, - number=12, - ) - target_received_packets_per_second: int = proto.Field( - proto.INT32, - number=13, - ) - - -class StandardSchedulerSettings(proto.Message): - r"""Scheduler settings for standard environment. - - Attributes: - target_cpu_utilization (float): - Target CPU utilization ratio to maintain when - scaling. - target_throughput_utilization (float): - Target throughput utilization ratio to - maintain when scaling - min_instances (int): - Minimum number of instances to run for this version. Set to - zero to disable ``min_instances`` configuration. - max_instances (int): - Maximum number of instances to run for this version. Set to - zero to disable ``max_instances`` configuration. - """ - - target_cpu_utilization: float = proto.Field( - proto.DOUBLE, - number=1, - ) - target_throughput_utilization: float = proto.Field( - proto.DOUBLE, - number=2, - ) - min_instances: int = proto.Field( - proto.INT32, - number=3, - ) - max_instances: int = proto.Field( - proto.INT32, - number=4, - ) - - -class Network(proto.Message): - r"""Extra network settings. - Only applicable in the App Engine flexible environment. - - Attributes: - forwarded_ports (MutableSequence[str]): - List of ports, or port pairs, to forward from - the virtual machine to the application - container. Only applicable in the App Engine - flexible environment. - instance_tag (str): - Tag to apply to the instance during creation. - Only applicable in the App Engine flexible - environment. - name (str): - Google Compute Engine network where the virtual machines are - created. Specify the short name, not the resource path. - - Defaults to ``default``. - subnetwork_name (str): - Google Cloud Platform sub-network where the virtual machines - are created. Specify the short name, not the resource path. - - If a subnetwork name is specified, a network name will also - be required unless it is for the default network. - - - If the network that the instance is being created in is a - Legacy network, then the IP address is allocated from the - IPv4Range. - - If the network that the instance is being created in is - an auto Subnet Mode Network, then only network name - should be specified (not the subnetwork_name) and the IP - address is created from the IPCidrRange of the subnetwork - that exists in that zone for that network. - - If the network that the instance is being created in is a - custom Subnet Mode Network, then the subnetwork_name must - be specified and the IP address is created from the - IPCidrRange of the subnetwork. - - If specified, the subnetwork must exist in the same region - as the App Engine flexible environment application. - session_affinity (bool): - Enable session affinity. - Only applicable in the App Engine flexible - environment. - """ - - forwarded_ports: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - instance_tag: str = proto.Field( - proto.STRING, - number=2, - ) - name: str = proto.Field( - proto.STRING, - number=3, - ) - subnetwork_name: str = proto.Field( - proto.STRING, - number=4, - ) - session_affinity: bool = proto.Field( - proto.BOOL, - number=5, - ) - - -class Volume(proto.Message): - r"""Volumes mounted within the app container. - Only applicable in the App Engine flexible environment. - - Attributes: - name (str): - Unique name for the volume. - volume_type (str): - Underlying volume type, e.g. 'tmpfs'. - size_gb (float): - Volume size in gigabytes. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - volume_type: str = proto.Field( - proto.STRING, - number=2, - ) - size_gb: float = proto.Field( - proto.DOUBLE, - number=3, - ) - - -class Resources(proto.Message): - r"""Machine resources for a version. - - Attributes: - cpu (float): - Number of CPU cores needed. - disk_gb (float): - Disk size (GB) needed. - memory_gb (float): - Memory (GB) needed. - volumes (MutableSequence[google.cloud.appengine_admin_v1.types.Volume]): - User specified volumes. - kms_key_reference (str): - The name of the encryption key that is stored - in Google Cloud KMS. Only should be used by - Cloud Composer to encrypt the vm disk - """ - - cpu: float = proto.Field( - proto.DOUBLE, - number=1, - ) - disk_gb: float = proto.Field( - proto.DOUBLE, - number=2, - ) - memory_gb: float = proto.Field( - proto.DOUBLE, - number=3, - ) - volumes: MutableSequence["Volume"] = proto.RepeatedField( - proto.MESSAGE, - number=4, - message="Volume", - ) - kms_key_reference: str = proto.Field( - proto.STRING, - number=5, - ) - - -class VpcAccessConnector(proto.Message): - r"""VPC access connector specification. - - Attributes: - name (str): - Full Serverless VPC Access Connector name - e.g. - /projects/my-project/locations/us-central1/connectors/c1. - egress_setting (google.cloud.appengine_admin_v1.types.VpcAccessConnector.EgressSetting): - The egress setting for the connector, - controlling what traffic is diverted through it. - """ - - class EgressSetting(proto.Enum): - r"""Available egress settings. - - This controls what traffic is diverted through the VPC Access - Connector resource. By default PRIVATE_IP_RANGES will be used. - - Values: - EGRESS_SETTING_UNSPECIFIED (0): - No description available. - ALL_TRAFFIC (1): - Force the use of VPC Access for all egress - traffic from the function. - PRIVATE_IP_RANGES (2): - Use the VPC Access Connector for private IP - space from RFC1918. - """ - EGRESS_SETTING_UNSPECIFIED = 0 - ALL_TRAFFIC = 1 - PRIVATE_IP_RANGES = 2 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - egress_setting: EgressSetting = proto.Field( - proto.ENUM, - number=2, - enum=EgressSetting, - ) - - -class Entrypoint(proto.Message): - r"""The entrypoint for the application. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - shell (str): - The format should be a shell command that can be fed to - ``bash -c``. - - This field is a member of `oneof`_ ``command``. - """ - - shell: str = proto.Field( - proto.STRING, - number=1, - oneof="command", - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 574c5ae..0000000 --- a/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/noxfile.py b/noxfile.py deleted file mode 100644 index 54abbaa..0000000 --- a/noxfile.py +++ /dev/null @@ -1,428 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2023 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! - -from __future__ import absolute_import - -import os -import pathlib -import re -import shutil -from typing import Dict, List -import warnings - -import nox - -FLAKE8_VERSION = "flake8==6.1.0" -BLACK_VERSION = "black[jupyter]==23.7.0" -ISORT_VERSION = "isort==5.11.0" -LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] - -DEFAULT_PYTHON_VERSION = "3.8" - -UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.7", "3.8", "3.9", "3.10", "3.11"] -UNIT_TEST_STANDARD_DEPENDENCIES = [ - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", -] -UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = [] -UNIT_TEST_LOCAL_DEPENDENCIES: List[str] = [] -UNIT_TEST_DEPENDENCIES: List[str] = [] -UNIT_TEST_EXTRAS: List[str] = [] -UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} - -SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8"] -SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [ - "mock", - "pytest", - "google-cloud-testutils", -] -SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List[str] = [] -SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = [] -SYSTEM_TEST_DEPENDENCIES: List[str] = [] -SYSTEM_TEST_EXTRAS: List[str] = [] -SYSTEM_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} - -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", - "format", -] - -# Error if a python version is missing -nox.options.error_on_missing_interpreters = True - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint(session): - """Run linters. - - Returns a failure if the linters find linting errors or sufficiently - serious code quality issues. - """ - session.install(FLAKE8_VERSION, BLACK_VERSION) - session.run( - "black", - "--check", - *LINT_PATHS, - ) - session.run("flake8", "google", "tests") - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def blacken(session): - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - session.run( - "black", - *LINT_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def format(session): - """ - Run isort to sort imports. Then run black - to format code to uniform standard. - """ - session.install(BLACK_VERSION, ISORT_VERSION) - # Use the --fss option to sort imports using strict alphabetical order. - # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections - session.run( - "isort", - "--fss", - *LINT_PATHS, - ) - session.run( - "black", - *LINT_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") - session.run("python", "setup.py", "check", "--restructuredtext", "--strict") - - -def install_unittest_dependencies(session, *constraints): - standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES - session.install(*standard_deps, *constraints) - - if UNIT_TEST_EXTERNAL_DEPENDENCIES: - warnings.warn( - "'unit_test_external_dependencies' is deprecated. Instead, please " - "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", - DeprecationWarning, - ) - session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) - - if UNIT_TEST_LOCAL_DEPENDENCIES: - session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) - - if UNIT_TEST_EXTRAS_BY_PYTHON: - extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) - elif UNIT_TEST_EXTRAS: - extras = UNIT_TEST_EXTRAS - else: - extras = [] - - if extras: - session.install("-e", f".[{','.join(extras)}]", *constraints) - else: - session.install("-e", ".", *constraints) - - -def default(session): - # Install all test dependencies, then install this package in-place. - - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) - install_unittest_dependencies(session, "-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", - "--cov=tests/unit", - "--cov-append", - "--cov-config=.coveragerc", - "--cov-report=", - "--cov-fail-under=0", - os.path.join("tests", "unit"), - *session.posargs, - ) - - -@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) -def unit(session): - """Run the unit test suite.""" - default(session) - - -def install_systemtest_dependencies(session, *constraints): - # Use pre-release gRPC for system tests. - # Exclude version 1.52.0rc1 which has a known issue. - # See https://github.com/grpc/grpc/issues/32163 - session.install("--pre", "grpcio!=1.52.0rc1") - - session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) - - if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: - session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) - - if SYSTEM_TEST_LOCAL_DEPENDENCIES: - session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) - - if SYSTEM_TEST_DEPENDENCIES: - session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) - - if SYSTEM_TEST_EXTRAS_BY_PYTHON: - extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) - elif SYSTEM_TEST_EXTRAS: - extras = SYSTEM_TEST_EXTRAS - else: - extras = [] - - if extras: - session.install("-e", f".[{','.join(extras)}]", *constraints) - else: - session.install("-e", ".", *constraints) - - -@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") - - # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true. - if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false": - session.skip("RUN_SYSTEM_TESTS is set to false, skipping") - # 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) - # Sanity check: only run tests if found. - if not system_test_exists and not system_test_folder_exists: - session.skip("System tests were not found") - - install_systemtest_dependencies(session, "-c", constraints_path) - - # Run py.test against the system tests. - if system_test_exists: - 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", - f"--junitxml=system_{session.python}_sponge_log.xml", - system_test_folder_path, - *session.posargs, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def cover(session): - """Run the final coverage report. - - This outputs the coverage report aggregating coverage from the unit - 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", "erase") - - -@nox.session(python="3.9") -def docs(session): - """Build the docs for this library.""" - - session.install("-e", ".") - session.install( - "sphinx==4.0.1", - "alabaster", - "recommonmark", - ) - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-W", # warnings as errors - "-T", # show full traceback on exception - "-N", # no colors - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python="3.9") -def docfx(session): - """Build the docfx yaml files for this library.""" - - session.install("-e", ".") - session.install( - "gcp-sphinx-docfx-yaml", - "alabaster", - "recommonmark", - ) - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-T", # show full traceback on exception - "-N", # no colors - "-D", - ( - "extensions=sphinx.ext.autodoc," - "sphinx.ext.autosummary," - "docfx_yaml.extension," - "sphinx.ext.intersphinx," - "sphinx.ext.coverage," - "sphinx.ext.napoleon," - "sphinx.ext.todo," - "sphinx.ext.viewcode," - "recommonmark" - ), - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) -def prerelease_deps(session): - """Run all tests with prerelease versions of dependencies installed.""" - - # Install all dependencies - session.install("-e", ".[all, tests, tracing]") - unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES - session.install(*unit_deps_all) - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - ) - session.install(*system_deps_all) - - # Because we test minimum dependency versions on the minimum Python - # version, the first version we test with in the unit tests sessions has a - # constraints file containing all dependencies and extras. - with open( - CURRENT_DIRECTORY - / "testing" - / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", - encoding="utf-8", - ) as constraints_file: - constraints_text = constraints_file.read() - - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] - - session.install(*constraints_deps) - - prerel_deps = [ - "protobuf", - # dependency of grpc - "six", - "googleapis-common-protos", - # Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163 - "grpcio!=1.52.0rc1", - "grpcio-status", - "google-api-core", - "google-auth", - "proto-plus", - "google-cloud-testutils", - # dependencies of google-cloud-testutils" - "click", - ] - - for dep in prerel_deps: - session.install("--pre", "--no-deps", "--upgrade", dep) - - # Remaining dependencies - other_deps = [ - "requests", - ] - session.install(*other_deps) - - # Print out prerelease package versions - session.run( - "python", "-c", "import google.protobuf; print(google.protobuf.__version__)" - ) - session.run("python", "-c", "import grpc; print(grpc.__version__)") - session.run("python", "-c", "import google.auth; print(google.auth.__version__)") - - session.run("py.test", "tests/unit") - - system_test_path = os.path.join("tests", "system.py") - system_test_folder_path = os.path.join("tests", "system") - - # Only run system tests if found. - if os.path.exists(system_test_path): - session.run( - "py.test", - "--verbose", - f"--junitxml=system_{session.python}_sponge_log.xml", - system_test_path, - *session.posargs, - ) - if os.path.exists(system_test_folder_path): - session.run( - "py.test", - "--verbose", - f"--junitxml=system_{session.python}_sponge_log.xml", - system_test_folder_path, - *session.posargs, - ) diff --git a/owlbot.py b/owlbot.py deleted file mode 100644 index ce738f0..0000000 --- a/owlbot.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import json -from pathlib import Path -import shutil - -import synthtool as s -import synthtool.gcp as gcp -from synthtool.languages import python - -# ---------------------------------------------------------------------------- -# Copy the generated client from the owl-bot staging directory -# ---------------------------------------------------------------------------- - -clean_up_generated_samples = True - -# Load the default version defined in .repo-metadata.json. -default_version = json.load(open(".repo-metadata.json", "rt")).get( - "default_version" -) - -for library in s.get_staging_dirs(default_version): - if clean_up_generated_samples: - shutil.rmtree("samples/generated_samples", ignore_errors=True) - clean_up_generated_samples = False - s.move([library], excludes=["**/gapic_version.py"]) -s.remove_staging_dirs() - -# ---------------------------------------------------------------------------- -# Add templated files -# ---------------------------------------------------------------------------- - -templated_files = gcp.CommonTemplates().py_library( - cov_level=100, - microgenerator=True, - versions=gcp.common.detect_versions(path="./google", default_first=True), -) -s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) - -python.py_samples(skip_readmes=True) - -# run format session for all directories which have a noxfile -for noxfile in Path(".").glob("**/noxfile.py"): - s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/release-please-config.json b/release-please-config.json deleted file mode 100644 index 1b0eb82..0000000 --- a/release-please-config.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", - "packages": { - ".": { - "release-type": "python", - "extra-files": [ - "google/cloud/appengine_admin/gapic_version.py", - "google/cloud/appengine_admin_v1/gapic_version.py", - { - "type": "json", - "path": "samples/generated_samples/snippet_metadata_google.appengine.v1.json", - "jsonpath": "$.clientLibrary.version" - } - ] - } - }, - "release-type": "python", - "plugins": [ - { - "type": "sentence-case" - } - ], - "initial-version": "0.1.0" -} diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 39b2a0e..0000000 --- a/renovate.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": [ - "config:base", - "group:all", - ":preserveSemverRanges", - ":disableDependencyDashboard" - ], - "ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt", "setup.py"], - "pip_requirements": { - "fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"] - } -} diff --git a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py deleted file mode 100644 index e99c685..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_CreateApplication_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_create_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateApplicationRequest( - ) - - # Make the request - operation = client.create_application(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_CreateApplication_async] diff --git a/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py deleted file mode 100644 index cd6bed1..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_CreateApplication_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_create_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateApplicationRequest( - ) - - # Make the request - operation = client.create_application(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_CreateApplication_sync] diff --git a/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py deleted file mode 100644 index 3f1d066..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_GetApplication_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_get_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetApplicationRequest( - ) - - # Make the request - response = await client.get_application(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_GetApplication_async] diff --git a/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py deleted file mode 100644 index b0d82ce..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_GetApplication_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_get_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetApplicationRequest( - ) - - # Make the request - response = client.get_application(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_GetApplication_sync] diff --git a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py deleted file mode 100644 index 2069686..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RepairApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_RepairApplication_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_repair_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.RepairApplicationRequest( - ) - - # Make the request - operation = client.repair_application(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_RepairApplication_async] diff --git a/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py deleted file mode 100644 index 3ed0078..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RepairApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_RepairApplication_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_repair_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.RepairApplicationRequest( - ) - - # Make the request - operation = client.repair_application(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_RepairApplication_sync] diff --git a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py deleted file mode 100644 index ce44cbd..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_UpdateApplication_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_update_application(): - # Create a client - client = appengine_admin_v1.ApplicationsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateApplicationRequest( - ) - - # Make the request - operation = client.update_application(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_UpdateApplication_async] diff --git a/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py deleted file mode 100644 index c67e9fc..0000000 --- a/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateApplication -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Applications_UpdateApplication_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_update_application(): - # Create a client - client = appengine_admin_v1.ApplicationsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateApplicationRequest( - ) - - # Make the request - operation = client.update_application(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Applications_UpdateApplication_sync] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py deleted file mode 100644 index 1241846..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_create_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateAuthorizedCertificateRequest( - ) - - # Make the request - response = await client.create_authorized_certificate(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py deleted file mode 100644 index 015f74c..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_create_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateAuthorizedCertificateRequest( - ) - - # Make the request - response = client.create_authorized_certificate(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py deleted file mode 100644 index add2619..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_delete_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteAuthorizedCertificateRequest( - ) - - # Make the request - await client.delete_authorized_certificate(request=request) - - -# [END appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py deleted file mode 100644 index 1b556b2..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_delete_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteAuthorizedCertificateRequest( - ) - - # Make the request - client.delete_authorized_certificate(request=request) - - -# [END appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py deleted file mode 100644 index f862681..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_get_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetAuthorizedCertificateRequest( - ) - - # Make the request - response = await client.get_authorized_certificate(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py deleted file mode 100644 index 492bb9a..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_get_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetAuthorizedCertificateRequest( - ) - - # Make the request - response = client.get_authorized_certificate(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py deleted file mode 100644 index 7707f15..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAuthorizedCertificates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_list_authorized_certificates(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedCertificatesRequest( - ) - - # Make the request - page_result = client.list_authorized_certificates(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py deleted file mode 100644 index 895e787..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAuthorizedCertificates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_list_authorized_certificates(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedCertificatesRequest( - ) - - # Make the request - page_result = client.list_authorized_certificates(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py deleted file mode 100644 index 61f57f8..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_update_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateAuthorizedCertificateRequest( - ) - - # Make the request - response = await client.update_authorized_certificate(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py deleted file mode 100644 index 4eea019..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAuthorizedCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_update_authorized_certificate(): - # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateAuthorizedCertificateRequest( - ) - - # Make the request - response = client.update_authorized_certificate(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py deleted file mode 100644 index 4ddd182..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAuthorizedDomains -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_list_authorized_domains(): - # Create a client - client = appengine_admin_v1.AuthorizedDomainsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedDomainsRequest( - ) - - # Make the request - page_result = client.list_authorized_domains(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async] diff --git a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py deleted file mode 100644 index df8e759..0000000 --- a/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAuthorizedDomains -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_list_authorized_domains(): - # Create a client - client = appengine_admin_v1.AuthorizedDomainsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListAuthorizedDomainsRequest( - ) - - # Make the request - page_result = client.list_authorized_domains(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py deleted file mode 100644 index d82e3f0..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_CreateDomainMapping_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_create_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateDomainMappingRequest( - ) - - # Make the request - operation = client.create_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_CreateDomainMapping_async] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py deleted file mode 100644 index 67346ef..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_CreateDomainMapping_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_create_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateDomainMappingRequest( - ) - - # Make the request - operation = client.create_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_CreateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py deleted file mode 100644 index 8de281b..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_DeleteDomainMapping_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_delete_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteDomainMappingRequest( - ) - - # Make the request - operation = client.delete_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_DeleteDomainMapping_async] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py deleted file mode 100644 index d344193..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_delete_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteDomainMappingRequest( - ) - - # Make the request - operation = client.delete_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py deleted file mode 100644 index 023a83e..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_GetDomainMapping_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_get_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetDomainMappingRequest( - ) - - # Make the request - response = await client.get_domain_mapping(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_GetDomainMapping_async] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py deleted file mode 100644 index 8eb4691..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_GetDomainMapping_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_get_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetDomainMappingRequest( - ) - - # Make the request - response = client.get_domain_mapping(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_GetDomainMapping_sync] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py deleted file mode 100644 index eebf46a..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDomainMappings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_ListDomainMappings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_list_domain_mappings(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListDomainMappingsRequest( - ) - - # Make the request - page_result = client.list_domain_mappings(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END appengine_v1_generated_DomainMappings_ListDomainMappings_async] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py deleted file mode 100644 index 65eea14..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDomainMappings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_ListDomainMappings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_list_domain_mappings(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListDomainMappingsRequest( - ) - - # Make the request - page_result = client.list_domain_mappings(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END appengine_v1_generated_DomainMappings_ListDomainMappings_sync] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py deleted file mode 100644 index 1305d82..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_UpdateDomainMapping_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_update_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateDomainMappingRequest( - ) - - # Make the request - operation = client.update_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_UpdateDomainMapping_async] diff --git a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py deleted file mode 100644 index 8f8ae4a..0000000 --- a/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDomainMapping -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_update_domain_mapping(): - # Create a client - client = appengine_admin_v1.DomainMappingsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateDomainMappingRequest( - ) - - # Make the request - operation = client.update_domain_mapping(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py deleted file mode 100644 index 5399783..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchUpdateIngressRules -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_BatchUpdateIngressRules_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_batch_update_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.BatchUpdateIngressRulesRequest( - ) - - # Make the request - response = await client.batch_update_ingress_rules(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_BatchUpdateIngressRules_async] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py deleted file mode 100644 index d4c8a51..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchUpdateIngressRules -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_batch_update_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.BatchUpdateIngressRulesRequest( - ) - - # Make the request - response = client.batch_update_ingress_rules(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py deleted file mode 100644 index fb0afc8..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_CreateIngressRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_create_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateIngressRuleRequest( - ) - - # Make the request - response = await client.create_ingress_rule(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_CreateIngressRule_async] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py deleted file mode 100644 index 7ca87c4..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_CreateIngressRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_create_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateIngressRuleRequest( - ) - - # Make the request - response = client.create_ingress_rule(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_CreateIngressRule_sync] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py deleted file mode 100644 index 1f68a24..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_DeleteIngressRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_delete_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteIngressRuleRequest( - ) - - # Make the request - await client.delete_ingress_rule(request=request) - - -# [END appengine_v1_generated_Firewall_DeleteIngressRule_async] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py deleted file mode 100644 index 5f70011..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_DeleteIngressRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_delete_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteIngressRuleRequest( - ) - - # Make the request - client.delete_ingress_rule(request=request) - - -# [END appengine_v1_generated_Firewall_DeleteIngressRule_sync] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py deleted file mode 100644 index 4f0a94f..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_GetIngressRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_get_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetIngressRuleRequest( - ) - - # Make the request - response = await client.get_ingress_rule(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_GetIngressRule_async] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py deleted file mode 100644 index d6e9e02..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_GetIngressRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_get_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetIngressRuleRequest( - ) - - # Make the request - response = client.get_ingress_rule(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_GetIngressRule_sync] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py deleted file mode 100644 index 1dd86f2..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListIngressRules -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_ListIngressRules_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_list_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListIngressRulesRequest( - ) - - # Make the request - page_result = client.list_ingress_rules(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END appengine_v1_generated_Firewall_ListIngressRules_async] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py deleted file mode 100644 index 2613e28..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListIngressRules -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_ListIngressRules_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_list_ingress_rules(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListIngressRulesRequest( - ) - - # Make the request - page_result = client.list_ingress_rules(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END appengine_v1_generated_Firewall_ListIngressRules_sync] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py deleted file mode 100644 index d0fe163..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_UpdateIngressRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_update_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateIngressRuleRequest( - ) - - # Make the request - response = await client.update_ingress_rule(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_UpdateIngressRule_async] diff --git a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py deleted file mode 100644 index 667bcd3..0000000 --- a/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateIngressRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Firewall_UpdateIngressRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_update_ingress_rule(): - # Create a client - client = appengine_admin_v1.FirewallClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateIngressRuleRequest( - ) - - # Make the request - response = client.update_ingress_rule(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Firewall_UpdateIngressRule_sync] diff --git a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py deleted file mode 100644 index 42d0ffa..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DebugInstance -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_DebugInstance_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_debug_instance(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DebugInstanceRequest( - ) - - # Make the request - operation = client.debug_instance(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Instances_DebugInstance_async] diff --git a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py deleted file mode 100644 index e4146de..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DebugInstance -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_DebugInstance_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_debug_instance(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DebugInstanceRequest( - ) - - # Make the request - operation = client.debug_instance(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Instances_DebugInstance_sync] diff --git a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py deleted file mode 100644 index cdca21b..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteInstance -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_DeleteInstance_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_delete_instance(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteInstanceRequest( - ) - - # Make the request - operation = client.delete_instance(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Instances_DeleteInstance_async] diff --git a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py deleted file mode 100644 index b7d7725..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteInstance -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_DeleteInstance_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_delete_instance(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteInstanceRequest( - ) - - # Make the request - operation = client.delete_instance(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Instances_DeleteInstance_sync] diff --git a/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py deleted file mode 100644 index f3a0b9f..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetInstance -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_GetInstance_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_get_instance(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetInstanceRequest( - ) - - # Make the request - response = await client.get_instance(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Instances_GetInstance_async] diff --git a/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py deleted file mode 100644 index 22f90f1..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetInstance -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_GetInstance_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_get_instance(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetInstanceRequest( - ) - - # Make the request - response = client.get_instance(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Instances_GetInstance_sync] diff --git a/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py deleted file mode 100644 index 96beea0..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListInstances -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_ListInstances_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_list_instances(): - # Create a client - client = appengine_admin_v1.InstancesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListInstancesRequest( - ) - - # Make the request - page_result = client.list_instances(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END appengine_v1_generated_Instances_ListInstances_async] diff --git a/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py deleted file mode 100644 index d4ba864..0000000 --- a/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListInstances -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Instances_ListInstances_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_list_instances(): - # Create a client - client = appengine_admin_v1.InstancesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListInstancesRequest( - ) - - # Make the request - page_result = client.list_instances(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END appengine_v1_generated_Instances_ListInstances_sync] diff --git a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py deleted file mode 100644 index aa89f25..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_DeleteService_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_delete_service(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteServiceRequest( - ) - - # Make the request - operation = client.delete_service(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Services_DeleteService_async] diff --git a/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py deleted file mode 100644 index 9e852aa..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_DeleteService_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_delete_service(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteServiceRequest( - ) - - # Make the request - operation = client.delete_service(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Services_DeleteService_sync] diff --git a/samples/generated_samples/appengine_v1_generated_services_get_service_async.py b/samples/generated_samples/appengine_v1_generated_services_get_service_async.py deleted file mode 100644 index f645503..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_get_service_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_GetService_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_get_service(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetServiceRequest( - ) - - # Make the request - response = await client.get_service(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Services_GetService_async] diff --git a/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py deleted file mode 100644 index 21aa6fa..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_GetService_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_get_service(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetServiceRequest( - ) - - # Make the request - response = client.get_service(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Services_GetService_sync] diff --git a/samples/generated_samples/appengine_v1_generated_services_list_services_async.py b/samples/generated_samples/appengine_v1_generated_services_list_services_async.py deleted file mode 100644 index af5f2ef..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_list_services_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListServices -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_ListServices_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_list_services(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListServicesRequest( - ) - - # Make the request - page_result = client.list_services(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END appengine_v1_generated_Services_ListServices_async] diff --git a/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py b/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py deleted file mode 100644 index 28954e1..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListServices -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_ListServices_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_list_services(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListServicesRequest( - ) - - # Make the request - page_result = client.list_services(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END appengine_v1_generated_Services_ListServices_sync] diff --git a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py deleted file mode 100644 index 6f27d28..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_update_service_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_UpdateService_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_update_service(): - # Create a client - client = appengine_admin_v1.ServicesAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateServiceRequest( - ) - - # Make the request - operation = client.update_service(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Services_UpdateService_async] diff --git a/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py deleted file mode 100644 index 53284de..0000000 --- a/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Services_UpdateService_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_update_service(): - # Create a client - client = appengine_admin_v1.ServicesClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateServiceRequest( - ) - - # Make the request - operation = client.update_service(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Services_UpdateService_sync] diff --git a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py deleted file mode 100644 index d942c44..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_CreateVersion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_create_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateVersionRequest( - ) - - # Make the request - operation = client.create_version(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_CreateVersion_async] diff --git a/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py deleted file mode 100644 index 1b4fa03..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_CreateVersion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_create_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.CreateVersionRequest( - ) - - # Make the request - operation = client.create_version(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_CreateVersion_sync] diff --git a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py deleted file mode 100644 index 27e8eee..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_DeleteVersion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_delete_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteVersionRequest( - ) - - # Make the request - operation = client.delete_version(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_DeleteVersion_async] diff --git a/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py deleted file mode 100644 index 51027cc..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_DeleteVersion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_delete_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.DeleteVersionRequest( - ) - - # Make the request - operation = client.delete_version(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_DeleteVersion_sync] diff --git a/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py deleted file mode 100644 index c778fd8..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_GetVersion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_get_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetVersionRequest( - ) - - # Make the request - response = await client.get_version(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_GetVersion_async] diff --git a/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py deleted file mode 100644 index 6229a5a..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_GetVersion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_get_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.GetVersionRequest( - ) - - # Make the request - response = client.get_version(request=request) - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_GetVersion_sync] diff --git a/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py deleted file mode 100644 index 386b211..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListVersions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_ListVersions_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_list_versions(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListVersionsRequest( - ) - - # Make the request - page_result = client.list_versions(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END appengine_v1_generated_Versions_ListVersions_async] diff --git a/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py deleted file mode 100644 index d7b2c41..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListVersions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_ListVersions_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_list_versions(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.ListVersionsRequest( - ) - - # Make the request - page_result = client.list_versions(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END appengine_v1_generated_Versions_ListVersions_sync] diff --git a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py deleted file mode 100644 index 221717f..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_UpdateVersion_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -async def sample_update_version(): - # Create a client - client = appengine_admin_v1.VersionsAsyncClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateVersionRequest( - ) - - # Make the request - operation = client.update_version(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_UpdateVersion_async] diff --git a/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py deleted file mode 100644 index bba0d50..0000000 --- a/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateVersion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-appengine-admin - - -# [START appengine_v1_generated_Versions_UpdateVersion_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import appengine_admin_v1 - - -def sample_update_version(): - # Create a client - client = appengine_admin_v1.VersionsClient() - - # Initialize request argument(s) - request = appengine_admin_v1.UpdateVersionRequest( - ) - - # Make the request - operation = client.update_version(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END appengine_v1_generated_Versions_UpdateVersion_sync] diff --git a/samples/generated_samples/snippet_metadata_google.appengine.v1.json b/samples/generated_samples/snippet_metadata_google.appengine.v1.json deleted file mode 100644 index fb8cbf5..0000000 --- a/samples/generated_samples/snippet_metadata_google.appengine.v1.json +++ /dev/null @@ -1,5213 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.appengine.v1", - "version": "v1" - } - ], - "language": "PYTHON", - "name": "google-cloud-appengine-admin", - "version": "0.1.0" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient", - "shortName": "ApplicationsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient.create_application", - "method": { - "fullName": "google.appengine.v1.Applications.CreateApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "CreateApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateApplicationRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_application" - }, - "description": "Sample for CreateApplication", - "file": "appengine_v1_generated_applications_create_application_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_CreateApplication_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_create_application_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient", - "shortName": "ApplicationsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient.create_application", - "method": { - "fullName": "google.appengine.v1.Applications.CreateApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "CreateApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateApplicationRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_application" - }, - "description": "Sample for CreateApplication", - "file": "appengine_v1_generated_applications_create_application_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_CreateApplication_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_create_application_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient", - "shortName": "ApplicationsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient.get_application", - "method": { - "fullName": "google.appengine.v1.Applications.GetApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "GetApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetApplicationRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Application", - "shortName": "get_application" - }, - "description": "Sample for GetApplication", - "file": "appengine_v1_generated_applications_get_application_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_GetApplication_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_get_application_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient", - "shortName": "ApplicationsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient.get_application", - "method": { - "fullName": "google.appengine.v1.Applications.GetApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "GetApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetApplicationRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Application", - "shortName": "get_application" - }, - "description": "Sample for GetApplication", - "file": "appengine_v1_generated_applications_get_application_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_GetApplication_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_get_application_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient", - "shortName": "ApplicationsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient.repair_application", - "method": { - "fullName": "google.appengine.v1.Applications.RepairApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "RepairApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.RepairApplicationRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "repair_application" - }, - "description": "Sample for RepairApplication", - "file": "appengine_v1_generated_applications_repair_application_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_RepairApplication_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_repair_application_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient", - "shortName": "ApplicationsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient.repair_application", - "method": { - "fullName": "google.appengine.v1.Applications.RepairApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "RepairApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.RepairApplicationRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "repair_application" - }, - "description": "Sample for RepairApplication", - "file": "appengine_v1_generated_applications_repair_application_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_RepairApplication_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_repair_application_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient", - "shortName": "ApplicationsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsAsyncClient.update_application", - "method": { - "fullName": "google.appengine.v1.Applications.UpdateApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "UpdateApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateApplicationRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_application" - }, - "description": "Sample for UpdateApplication", - "file": "appengine_v1_generated_applications_update_application_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_UpdateApplication_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_update_application_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient", - "shortName": "ApplicationsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ApplicationsClient.update_application", - "method": { - "fullName": "google.appengine.v1.Applications.UpdateApplication", - "service": { - "fullName": "google.appengine.v1.Applications", - "shortName": "Applications" - }, - "shortName": "UpdateApplication" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateApplicationRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_application" - }, - "description": "Sample for UpdateApplication", - "file": "appengine_v1_generated_applications_update_application_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Applications_UpdateApplication_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_applications_update_application_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient", - "shortName": "AuthorizedCertificatesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient.create_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.CreateAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "CreateAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.AuthorizedCertificate", - "shortName": "create_authorized_certificate" - }, - "description": "Sample for CreateAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient", - "shortName": "AuthorizedCertificatesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient.create_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.CreateAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "CreateAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.AuthorizedCertificate", - "shortName": "create_authorized_certificate" - }, - "description": "Sample for CreateAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient", - "shortName": "AuthorizedCertificatesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient.delete_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.DeleteAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "DeleteAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_authorized_certificate" - }, - "description": "Sample for DeleteAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient", - "shortName": "AuthorizedCertificatesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient.delete_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.DeleteAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "DeleteAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_authorized_certificate" - }, - "description": "Sample for DeleteAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient", - "shortName": "AuthorizedCertificatesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient.get_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.GetAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "GetAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.AuthorizedCertificate", - "shortName": "get_authorized_certificate" - }, - "description": "Sample for GetAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient", - "shortName": "AuthorizedCertificatesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient.get_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.GetAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "GetAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.AuthorizedCertificate", - "shortName": "get_authorized_certificate" - }, - "description": "Sample for GetAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient", - "shortName": "AuthorizedCertificatesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient.list_authorized_certificates", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.ListAuthorizedCertificates", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "ListAuthorizedCertificates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.authorized_certificates.pagers.ListAuthorizedCertificatesAsyncPager", - "shortName": "list_authorized_certificates" - }, - "description": "Sample for ListAuthorizedCertificates", - "file": "appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient", - "shortName": "AuthorizedCertificatesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient.list_authorized_certificates", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.ListAuthorizedCertificates", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "ListAuthorizedCertificates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.authorized_certificates.pagers.ListAuthorizedCertificatesPager", - "shortName": "list_authorized_certificates" - }, - "description": "Sample for ListAuthorizedCertificates", - "file": "appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient", - "shortName": "AuthorizedCertificatesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesAsyncClient.update_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.UpdateAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "UpdateAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.AuthorizedCertificate", - "shortName": "update_authorized_certificate" - }, - "description": "Sample for UpdateAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient", - "shortName": "AuthorizedCertificatesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedCertificatesClient.update_authorized_certificate", - "method": { - "fullName": "google.appengine.v1.AuthorizedCertificates.UpdateAuthorizedCertificate", - "service": { - "fullName": "google.appengine.v1.AuthorizedCertificates", - "shortName": "AuthorizedCertificates" - }, - "shortName": "UpdateAuthorizedCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.AuthorizedCertificate", - "shortName": "update_authorized_certificate" - }, - "description": "Sample for UpdateAuthorizedCertificate", - "file": "appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedDomainsAsyncClient", - "shortName": "AuthorizedDomainsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedDomainsAsyncClient.list_authorized_domains", - "method": { - "fullName": "google.appengine.v1.AuthorizedDomains.ListAuthorizedDomains", - "service": { - "fullName": "google.appengine.v1.AuthorizedDomains", - "shortName": "AuthorizedDomains" - }, - "shortName": "ListAuthorizedDomains" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.authorized_domains.pagers.ListAuthorizedDomainsAsyncPager", - "shortName": "list_authorized_domains" - }, - "description": "Sample for ListAuthorizedDomains", - "file": "appengine_v1_generated_authorized_domains_list_authorized_domains_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_domains_list_authorized_domains_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.AuthorizedDomainsClient", - "shortName": "AuthorizedDomainsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.AuthorizedDomainsClient.list_authorized_domains", - "method": { - "fullName": "google.appengine.v1.AuthorizedDomains.ListAuthorizedDomains", - "service": { - "fullName": "google.appengine.v1.AuthorizedDomains", - "shortName": "AuthorizedDomains" - }, - "shortName": "ListAuthorizedDomains" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.authorized_domains.pagers.ListAuthorizedDomainsPager", - "shortName": "list_authorized_domains" - }, - "description": "Sample for ListAuthorizedDomains", - "file": "appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient", - "shortName": "DomainMappingsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient.create_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.CreateDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "CreateDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_domain_mapping" - }, - "description": "Sample for CreateDomainMapping", - "file": "appengine_v1_generated_domain_mappings_create_domain_mapping_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_CreateDomainMapping_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_create_domain_mapping_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient", - "shortName": "DomainMappingsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient.create_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.CreateDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "CreateDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_domain_mapping" - }, - "description": "Sample for CreateDomainMapping", - "file": "appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_CreateDomainMapping_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient", - "shortName": "DomainMappingsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient.delete_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.DeleteDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "DeleteDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_domain_mapping" - }, - "description": "Sample for DeleteDomainMapping", - "file": "appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_DeleteDomainMapping_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient", - "shortName": "DomainMappingsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient.delete_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.DeleteDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "DeleteDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_domain_mapping" - }, - "description": "Sample for DeleteDomainMapping", - "file": "appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient", - "shortName": "DomainMappingsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient.get_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.GetDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "GetDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.DomainMapping", - "shortName": "get_domain_mapping" - }, - "description": "Sample for GetDomainMapping", - "file": "appengine_v1_generated_domain_mappings_get_domain_mapping_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_GetDomainMapping_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_get_domain_mapping_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient", - "shortName": "DomainMappingsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient.get_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.GetDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "GetDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.DomainMapping", - "shortName": "get_domain_mapping" - }, - "description": "Sample for GetDomainMapping", - "file": "appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_GetDomainMapping_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient", - "shortName": "DomainMappingsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient.list_domain_mappings", - "method": { - "fullName": "google.appengine.v1.DomainMappings.ListDomainMappings", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "ListDomainMappings" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.domain_mappings.pagers.ListDomainMappingsAsyncPager", - "shortName": "list_domain_mappings" - }, - "description": "Sample for ListDomainMappings", - "file": "appengine_v1_generated_domain_mappings_list_domain_mappings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_ListDomainMappings_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_list_domain_mappings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient", - "shortName": "DomainMappingsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient.list_domain_mappings", - "method": { - "fullName": "google.appengine.v1.DomainMappings.ListDomainMappings", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "ListDomainMappings" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.domain_mappings.pagers.ListDomainMappingsPager", - "shortName": "list_domain_mappings" - }, - "description": "Sample for ListDomainMappings", - "file": "appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_ListDomainMappings_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient", - "shortName": "DomainMappingsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsAsyncClient.update_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.UpdateDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "UpdateDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_domain_mapping" - }, - "description": "Sample for UpdateDomainMapping", - "file": "appengine_v1_generated_domain_mappings_update_domain_mapping_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_UpdateDomainMapping_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_update_domain_mapping_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient", - "shortName": "DomainMappingsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.DomainMappingsClient.update_domain_mapping", - "method": { - "fullName": "google.appengine.v1.DomainMappings.UpdateDomainMapping", - "service": { - "fullName": "google.appengine.v1.DomainMappings", - "shortName": "DomainMappings" - }, - "shortName": "UpdateDomainMapping" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_domain_mapping" - }, - "description": "Sample for UpdateDomainMapping", - "file": "appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient", - "shortName": "FirewallAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient.batch_update_ingress_rules", - "method": { - "fullName": "google.appengine.v1.Firewall.BatchUpdateIngressRules", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "BatchUpdateIngressRules" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesResponse", - "shortName": "batch_update_ingress_rules" - }, - "description": "Sample for BatchUpdateIngressRules", - "file": "appengine_v1_generated_firewall_batch_update_ingress_rules_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_BatchUpdateIngressRules_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_batch_update_ingress_rules_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallClient", - "shortName": "FirewallClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallClient.batch_update_ingress_rules", - "method": { - "fullName": "google.appengine.v1.Firewall.BatchUpdateIngressRules", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "BatchUpdateIngressRules" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesResponse", - "shortName": "batch_update_ingress_rules" - }, - "description": "Sample for BatchUpdateIngressRules", - "file": "appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient", - "shortName": "FirewallAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient.create_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.CreateIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "CreateIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.FirewallRule", - "shortName": "create_ingress_rule" - }, - "description": "Sample for CreateIngressRule", - "file": "appengine_v1_generated_firewall_create_ingress_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_CreateIngressRule_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_create_ingress_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallClient", - "shortName": "FirewallClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallClient.create_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.CreateIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "CreateIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.FirewallRule", - "shortName": "create_ingress_rule" - }, - "description": "Sample for CreateIngressRule", - "file": "appengine_v1_generated_firewall_create_ingress_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_CreateIngressRule_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_create_ingress_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient", - "shortName": "FirewallAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient.delete_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.DeleteIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "DeleteIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_ingress_rule" - }, - "description": "Sample for DeleteIngressRule", - "file": "appengine_v1_generated_firewall_delete_ingress_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_DeleteIngressRule_async", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_delete_ingress_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallClient", - "shortName": "FirewallClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallClient.delete_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.DeleteIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "DeleteIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_ingress_rule" - }, - "description": "Sample for DeleteIngressRule", - "file": "appengine_v1_generated_firewall_delete_ingress_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_DeleteIngressRule_sync", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_delete_ingress_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient", - "shortName": "FirewallAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient.get_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.GetIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "GetIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.FirewallRule", - "shortName": "get_ingress_rule" - }, - "description": "Sample for GetIngressRule", - "file": "appengine_v1_generated_firewall_get_ingress_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_GetIngressRule_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_get_ingress_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallClient", - "shortName": "FirewallClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallClient.get_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.GetIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "GetIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.FirewallRule", - "shortName": "get_ingress_rule" - }, - "description": "Sample for GetIngressRule", - "file": "appengine_v1_generated_firewall_get_ingress_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_GetIngressRule_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_get_ingress_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient", - "shortName": "FirewallAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient.list_ingress_rules", - "method": { - "fullName": "google.appengine.v1.Firewall.ListIngressRules", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "ListIngressRules" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListIngressRulesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.firewall.pagers.ListIngressRulesAsyncPager", - "shortName": "list_ingress_rules" - }, - "description": "Sample for ListIngressRules", - "file": "appengine_v1_generated_firewall_list_ingress_rules_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_ListIngressRules_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_list_ingress_rules_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallClient", - "shortName": "FirewallClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallClient.list_ingress_rules", - "method": { - "fullName": "google.appengine.v1.Firewall.ListIngressRules", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "ListIngressRules" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListIngressRulesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.firewall.pagers.ListIngressRulesPager", - "shortName": "list_ingress_rules" - }, - "description": "Sample for ListIngressRules", - "file": "appengine_v1_generated_firewall_list_ingress_rules_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_ListIngressRules_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_list_ingress_rules_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient", - "shortName": "FirewallAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallAsyncClient.update_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.UpdateIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "UpdateIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.FirewallRule", - "shortName": "update_ingress_rule" - }, - "description": "Sample for UpdateIngressRule", - "file": "appengine_v1_generated_firewall_update_ingress_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_UpdateIngressRule_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_update_ingress_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.FirewallClient", - "shortName": "FirewallClient" - }, - "fullName": "google.cloud.appengine_admin_v1.FirewallClient.update_ingress_rule", - "method": { - "fullName": "google.appengine.v1.Firewall.UpdateIngressRule", - "service": { - "fullName": "google.appengine.v1.Firewall", - "shortName": "Firewall" - }, - "shortName": "UpdateIngressRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.FirewallRule", - "shortName": "update_ingress_rule" - }, - "description": "Sample for UpdateIngressRule", - "file": "appengine_v1_generated_firewall_update_ingress_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Firewall_UpdateIngressRule_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_firewall_update_ingress_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient", - "shortName": "InstancesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient.debug_instance", - "method": { - "fullName": "google.appengine.v1.Instances.DebugInstance", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "DebugInstance" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DebugInstanceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "debug_instance" - }, - "description": "Sample for DebugInstance", - "file": "appengine_v1_generated_instances_debug_instance_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_DebugInstance_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_debug_instance_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesClient", - "shortName": "InstancesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesClient.debug_instance", - "method": { - "fullName": "google.appengine.v1.Instances.DebugInstance", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "DebugInstance" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DebugInstanceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "debug_instance" - }, - "description": "Sample for DebugInstance", - "file": "appengine_v1_generated_instances_debug_instance_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_DebugInstance_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_debug_instance_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient", - "shortName": "InstancesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient.delete_instance", - "method": { - "fullName": "google.appengine.v1.Instances.DeleteInstance", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "DeleteInstance" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteInstanceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_instance" - }, - "description": "Sample for DeleteInstance", - "file": "appengine_v1_generated_instances_delete_instance_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_DeleteInstance_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_delete_instance_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesClient", - "shortName": "InstancesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesClient.delete_instance", - "method": { - "fullName": "google.appengine.v1.Instances.DeleteInstance", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "DeleteInstance" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteInstanceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_instance" - }, - "description": "Sample for DeleteInstance", - "file": "appengine_v1_generated_instances_delete_instance_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_DeleteInstance_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_delete_instance_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient", - "shortName": "InstancesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient.get_instance", - "method": { - "fullName": "google.appengine.v1.Instances.GetInstance", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "GetInstance" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetInstanceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Instance", - "shortName": "get_instance" - }, - "description": "Sample for GetInstance", - "file": "appengine_v1_generated_instances_get_instance_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_GetInstance_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_get_instance_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesClient", - "shortName": "InstancesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesClient.get_instance", - "method": { - "fullName": "google.appengine.v1.Instances.GetInstance", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "GetInstance" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetInstanceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Instance", - "shortName": "get_instance" - }, - "description": "Sample for GetInstance", - "file": "appengine_v1_generated_instances_get_instance_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_GetInstance_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_get_instance_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient", - "shortName": "InstancesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesAsyncClient.list_instances", - "method": { - "fullName": "google.appengine.v1.Instances.ListInstances", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "ListInstances" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListInstancesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.instances.pagers.ListInstancesAsyncPager", - "shortName": "list_instances" - }, - "description": "Sample for ListInstances", - "file": "appengine_v1_generated_instances_list_instances_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_ListInstances_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_list_instances_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.InstancesClient", - "shortName": "InstancesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.InstancesClient.list_instances", - "method": { - "fullName": "google.appengine.v1.Instances.ListInstances", - "service": { - "fullName": "google.appengine.v1.Instances", - "shortName": "Instances" - }, - "shortName": "ListInstances" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListInstancesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.instances.pagers.ListInstancesPager", - "shortName": "list_instances" - }, - "description": "Sample for ListInstances", - "file": "appengine_v1_generated_instances_list_instances_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Instances_ListInstances_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_instances_list_instances_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient", - "shortName": "ServicesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient.delete_service", - "method": { - "fullName": "google.appengine.v1.Services.DeleteService", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "DeleteService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_service" - }, - "description": "Sample for DeleteService", - "file": "appengine_v1_generated_services_delete_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_DeleteService_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_delete_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesClient", - "shortName": "ServicesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesClient.delete_service", - "method": { - "fullName": "google.appengine.v1.Services.DeleteService", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "DeleteService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_service" - }, - "description": "Sample for DeleteService", - "file": "appengine_v1_generated_services_delete_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_DeleteService_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_delete_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient", - "shortName": "ServicesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient.get_service", - "method": { - "fullName": "google.appengine.v1.Services.GetService", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "GetService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Service", - "shortName": "get_service" - }, - "description": "Sample for GetService", - "file": "appengine_v1_generated_services_get_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_GetService_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_get_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesClient", - "shortName": "ServicesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesClient.get_service", - "method": { - "fullName": "google.appengine.v1.Services.GetService", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "GetService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Service", - "shortName": "get_service" - }, - "description": "Sample for GetService", - "file": "appengine_v1_generated_services_get_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_GetService_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_get_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient", - "shortName": "ServicesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient.list_services", - "method": { - "fullName": "google.appengine.v1.Services.ListServices", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "ListServices" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListServicesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.services.pagers.ListServicesAsyncPager", - "shortName": "list_services" - }, - "description": "Sample for ListServices", - "file": "appengine_v1_generated_services_list_services_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_ListServices_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_list_services_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesClient", - "shortName": "ServicesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesClient.list_services", - "method": { - "fullName": "google.appengine.v1.Services.ListServices", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "ListServices" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListServicesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.services.pagers.ListServicesPager", - "shortName": "list_services" - }, - "description": "Sample for ListServices", - "file": "appengine_v1_generated_services_list_services_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_ListServices_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_list_services_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient", - "shortName": "ServicesAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesAsyncClient.update_service", - "method": { - "fullName": "google.appengine.v1.Services.UpdateService", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "UpdateService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_service" - }, - "description": "Sample for UpdateService", - "file": "appengine_v1_generated_services_update_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_UpdateService_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_update_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.ServicesClient", - "shortName": "ServicesClient" - }, - "fullName": "google.cloud.appengine_admin_v1.ServicesClient.update_service", - "method": { - "fullName": "google.appengine.v1.Services.UpdateService", - "service": { - "fullName": "google.appengine.v1.Services", - "shortName": "Services" - }, - "shortName": "UpdateService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_service" - }, - "description": "Sample for UpdateService", - "file": "appengine_v1_generated_services_update_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Services_UpdateService_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_services_update_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient", - "shortName": "VersionsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient.create_version", - "method": { - "fullName": "google.appengine.v1.Versions.CreateVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "CreateVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_version" - }, - "description": "Sample for CreateVersion", - "file": "appengine_v1_generated_versions_create_version_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_CreateVersion_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_create_version_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsClient", - "shortName": "VersionsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsClient.create_version", - "method": { - "fullName": "google.appengine.v1.Versions.CreateVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "CreateVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.CreateVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_version" - }, - "description": "Sample for CreateVersion", - "file": "appengine_v1_generated_versions_create_version_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_CreateVersion_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_create_version_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient", - "shortName": "VersionsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient.delete_version", - "method": { - "fullName": "google.appengine.v1.Versions.DeleteVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "DeleteVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_version" - }, - "description": "Sample for DeleteVersion", - "file": "appengine_v1_generated_versions_delete_version_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_DeleteVersion_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_delete_version_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsClient", - "shortName": "VersionsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsClient.delete_version", - "method": { - "fullName": "google.appengine.v1.Versions.DeleteVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "DeleteVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.DeleteVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_version" - }, - "description": "Sample for DeleteVersion", - "file": "appengine_v1_generated_versions_delete_version_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_DeleteVersion_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_delete_version_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient", - "shortName": "VersionsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient.get_version", - "method": { - "fullName": "google.appengine.v1.Versions.GetVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "GetVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Version", - "shortName": "get_version" - }, - "description": "Sample for GetVersion", - "file": "appengine_v1_generated_versions_get_version_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_GetVersion_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_get_version_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsClient", - "shortName": "VersionsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsClient.get_version", - "method": { - "fullName": "google.appengine.v1.Versions.GetVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "GetVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.GetVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.types.Version", - "shortName": "get_version" - }, - "description": "Sample for GetVersion", - "file": "appengine_v1_generated_versions_get_version_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_GetVersion_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_get_version_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient", - "shortName": "VersionsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient.list_versions", - "method": { - "fullName": "google.appengine.v1.Versions.ListVersions", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "ListVersions" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListVersionsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.versions.pagers.ListVersionsAsyncPager", - "shortName": "list_versions" - }, - "description": "Sample for ListVersions", - "file": "appengine_v1_generated_versions_list_versions_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_ListVersions_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_list_versions_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsClient", - "shortName": "VersionsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsClient.list_versions", - "method": { - "fullName": "google.appengine.v1.Versions.ListVersions", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "ListVersions" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.ListVersionsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.appengine_admin_v1.services.versions.pagers.ListVersionsPager", - "shortName": "list_versions" - }, - "description": "Sample for ListVersions", - "file": "appengine_v1_generated_versions_list_versions_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_ListVersions_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_list_versions_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient", - "shortName": "VersionsAsyncClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsAsyncClient.update_version", - "method": { - "fullName": "google.appengine.v1.Versions.UpdateVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "UpdateVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_version" - }, - "description": "Sample for UpdateVersion", - "file": "appengine_v1_generated_versions_update_version_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_UpdateVersion_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_update_version_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.appengine_admin_v1.VersionsClient", - "shortName": "VersionsClient" - }, - "fullName": "google.cloud.appengine_admin_v1.VersionsClient.update_version", - "method": { - "fullName": "google.appengine.v1.Versions.UpdateVersion", - "service": { - "fullName": "google.appengine.v1.Versions", - "shortName": "Versions" - }, - "shortName": "UpdateVersion" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.appengine_admin_v1.types.UpdateVersionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_version" - }, - "description": "Sample for UpdateVersion", - "file": "appengine_v1_generated_versions_update_version_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "appengine_v1_generated_Versions_UpdateVersion_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "appengine_v1_generated_versions_update_version_sync.py" - } - ] -} diff --git a/scripts/decrypt-secrets.sh b/scripts/decrypt-secrets.sh deleted file mode 100755 index 0018b42..0000000 --- a/scripts/decrypt-secrets.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# Copyright 2023 Google LLC All rights reserved. -# -# 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. - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -ROOT=$( dirname "$DIR" ) - -# Work from the project root. -cd $ROOT - -# Prevent it from overriding files. -# We recommend that sample authors use their own service account files and cloud project. -# In that case, they are supposed to prepare these files by themselves. -if [[ -f "testing/test-env.sh" ]] || \ - [[ -f "testing/service-account.json" ]] || \ - [[ -f "testing/client-secrets.json" ]]; then - echo "One or more target files exist, aborting." - exit 1 -fi - -# Use SECRET_MANAGER_PROJECT if set, fallback to cloud-devrel-kokoro-resources. -PROJECT_ID="${SECRET_MANAGER_PROJECT:-cloud-devrel-kokoro-resources}" - -gcloud secrets versions access latest --secret="python-docs-samples-test-env" \ - --project="${PROJECT_ID}" \ - > testing/test-env.sh -gcloud secrets versions access latest \ - --secret="python-docs-samples-service-account" \ - --project="${PROJECT_ID}" \ - > testing/service-account.json -gcloud secrets versions access latest \ - --secret="python-docs-samples-client-secrets" \ - --project="${PROJECT_ID}" \ - > testing/client-secrets.json diff --git a/scripts/fixup_appengine_admin_v1_keywords.py b/scripts/fixup_appengine_admin_v1_keywords.py deleted file mode 100644 index afd7802..0000000 --- a/scripts/fixup_appengine_admin_v1_keywords.py +++ /dev/null @@ -1,209 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class appengine_adminCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'batch_update_ingress_rules': ('name', 'ingress_rules', ), - 'create_application': ('application', ), - 'create_authorized_certificate': ('parent', 'certificate', ), - 'create_domain_mapping': ('parent', 'domain_mapping', 'override_strategy', ), - 'create_ingress_rule': ('parent', 'rule', ), - 'create_version': ('parent', 'version', ), - 'debug_instance': ('name', 'ssh_key', ), - 'delete_authorized_certificate': ('name', ), - 'delete_domain_mapping': ('name', ), - 'delete_ingress_rule': ('name', ), - 'delete_instance': ('name', ), - 'delete_service': ('name', ), - 'delete_version': ('name', ), - 'get_application': ('name', ), - 'get_authorized_certificate': ('name', 'view', ), - 'get_domain_mapping': ('name', ), - 'get_ingress_rule': ('name', ), - 'get_instance': ('name', ), - 'get_service': ('name', ), - 'get_version': ('name', 'view', ), - 'list_authorized_certificates': ('parent', 'view', 'page_size', 'page_token', ), - 'list_authorized_domains': ('parent', 'page_size', 'page_token', ), - 'list_domain_mappings': ('parent', 'page_size', 'page_token', ), - 'list_ingress_rules': ('parent', 'page_size', 'page_token', 'matching_address', ), - 'list_instances': ('parent', 'page_size', 'page_token', ), - 'list_services': ('parent', 'page_size', 'page_token', ), - 'list_versions': ('parent', 'view', 'page_size', 'page_token', ), - 'repair_application': ('name', ), - 'update_application': ('name', 'application', 'update_mask', ), - 'update_authorized_certificate': ('name', 'certificate', 'update_mask', ), - 'update_domain_mapping': ('name', 'domain_mapping', 'update_mask', ), - 'update_ingress_rule': ('name', 'rule', 'update_mask', ), - 'update_service': ('name', 'service', 'update_mask', 'migrate_traffic', ), - 'update_version': ('name', 'version', 'update_mask', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=appengine_adminCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the appengine_admin client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py deleted file mode 100644 index 1acc119..0000000 --- a/scripts/readme-gen/readme_gen.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2023 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. - -"""Generates READMEs using configuration defined in yaml.""" - -import argparse -import io -import os -import subprocess - -import jinja2 -import yaml - - -jinja_env = jinja2.Environment( - trim_blocks=True, - loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) - ), - autoescape=True, -) - -README_TMPL = jinja_env.get_template("README.tmpl.rst") - - -def get_help(file): - return subprocess.check_output(["python", file, "--help"]).decode() - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("source") - parser.add_argument("--destination", default="README.rst") - - args = parser.parse_args() - - source = os.path.abspath(args.source) - root = os.path.dirname(source) - destination = os.path.join(root, args.destination) - - jinja_env.globals["get_help"] = get_help - - with io.open(source, "r") as f: - config = yaml.load(f) - - # This allows get_help to execute in the right directory. - os.chdir(root) - - output = README_TMPL.render(config) - - with io.open(destination, "w") as f: - f.write(output) - - -if __name__ == "__main__": - main() diff --git a/scripts/readme-gen/templates/README.tmpl.rst b/scripts/readme-gen/templates/README.tmpl.rst deleted file mode 100644 index 4fd2397..0000000 --- a/scripts/readme-gen/templates/README.tmpl.rst +++ /dev/null @@ -1,87 +0,0 @@ -{# The following line is a lie. BUT! Once jinja2 is done with it, it will - become truth! #} -.. This file is automatically generated. Do not edit this file directly. - -{{product.name}} Python Samples -=============================================================================== - -.. image:: https://gstatic.com/cloudssh/images/open-btn.png - :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor={{folder}}/README.rst - - -This directory contains samples for {{product.name}}. {{product.description}} - -{{description}} - -.. _{{product.name}}: {{product.url}} - -{% if required_api_url %} -To run the sample, you need to enable the API at: {{required_api_url}} -{% endif %} - -{% if required_role %} -To run the sample, you need to have `{{required_role}}` role. -{% endif %} - -{{other_required_steps}} - -{% if setup %} -Setup -------------------------------------------------------------------------------- - -{% for section in setup %} - -{% include section + '.tmpl.rst' %} - -{% endfor %} -{% endif %} - -{% if samples %} -Samples -------------------------------------------------------------------------------- - -{% for sample in samples %} -{{sample.name}} -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -{% if not sample.hide_cloudshell_button %} -.. image:: https://gstatic.com/cloudssh/images/open-btn.png - :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor={{folder}}/{{sample.file}},{{folder}}/README.rst -{% endif %} - - -{{sample.description}} - -To run this sample: - -.. code-block:: bash - - $ python {{sample.file}} -{% if sample.show_help %} - - {{get_help(sample.file)|indent}} -{% endif %} - - -{% endfor %} -{% endif %} - -{% if cloud_client_library %} - -The client library -------------------------------------------------------------------------------- - -This sample uses the `Google Cloud Client Library for Python`_. -You can read the documentation for more details on API usage and use GitHub -to `browse the source`_ and `report issues`_. - -.. _Google Cloud Client Library for Python: - https://googlecloudplatform.github.io/google-cloud-python/ -.. _browse the source: - https://github.com/GoogleCloudPlatform/google-cloud-python -.. _report issues: - https://github.com/GoogleCloudPlatform/google-cloud-python/issues - -{% endif %} - -.. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file diff --git a/scripts/readme-gen/templates/auth.tmpl.rst b/scripts/readme-gen/templates/auth.tmpl.rst deleted file mode 100644 index 1446b94..0000000 --- a/scripts/readme-gen/templates/auth.tmpl.rst +++ /dev/null @@ -1,9 +0,0 @@ -Authentication -++++++++++++++ - -This sample requires you to have authentication setup. Refer to the -`Authentication Getting Started Guide`_ for instructions on setting up -credentials for applications. - -.. _Authentication Getting Started Guide: - https://cloud.google.com/docs/authentication/getting-started diff --git a/scripts/readme-gen/templates/auth_api_key.tmpl.rst b/scripts/readme-gen/templates/auth_api_key.tmpl.rst deleted file mode 100644 index 11957ce..0000000 --- a/scripts/readme-gen/templates/auth_api_key.tmpl.rst +++ /dev/null @@ -1,14 +0,0 @@ -Authentication -++++++++++++++ - -Authentication for this service is done via an `API Key`_. To obtain an API -Key: - -1. Open the `Cloud Platform Console`_ -2. Make sure that billing is enabled for your project. -3. From the **Credentials** page, create a new **API Key** or use an existing - one for your project. - -.. _API Key: - https://developers.google.com/api-client-library/python/guide/aaa_apikeys -.. _Cloud Console: https://console.cloud.google.com/project?_ diff --git a/scripts/readme-gen/templates/install_deps.tmpl.rst b/scripts/readme-gen/templates/install_deps.tmpl.rst deleted file mode 100644 index 6f069c6..0000000 --- a/scripts/readme-gen/templates/install_deps.tmpl.rst +++ /dev/null @@ -1,29 +0,0 @@ -Install Dependencies -++++++++++++++++++++ - -#. Clone python-docs-samples and change directory to the sample directory you want to use. - - .. code-block:: bash - - $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git - -#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions. - - .. _Python Development Environment Setup Guide: - https://cloud.google.com/python/setup - -#. Create a virtualenv. Samples are compatible with Python 3.7+. - - .. code-block:: bash - - $ virtualenv env - $ source env/bin/activate - -#. Install the dependencies needed to run the samples. - - .. code-block:: bash - - $ pip install -r requirements.txt - -.. _pip: https://pip.pypa.io/ -.. _virtualenv: https://virtualenv.pypa.io/ diff --git a/scripts/readme-gen/templates/install_portaudio.tmpl.rst b/scripts/readme-gen/templates/install_portaudio.tmpl.rst deleted file mode 100644 index 5ea33d1..0000000 --- a/scripts/readme-gen/templates/install_portaudio.tmpl.rst +++ /dev/null @@ -1,35 +0,0 @@ -Install PortAudio -+++++++++++++++++ - -Install `PortAudio`_. This is required by the `PyAudio`_ library to stream -audio from your computer's microphone. PyAudio depends on PortAudio for cross-platform compatibility, and is installed differently depending on the -platform. - -* For Mac OS X, you can use `Homebrew`_:: - - brew install portaudio - - **Note**: if you encounter an error when running `pip install` that indicates - it can't find `portaudio.h`, try running `pip install` with the following - flags:: - - pip install --global-option='build_ext' \ - --global-option='-I/usr/local/include' \ - --global-option='-L/usr/local/lib' \ - pyaudio - -* For Debian / Ubuntu Linux:: - - apt-get install portaudio19-dev python-all-dev - -* Windows may work without having to install PortAudio explicitly (it will get - installed with PyAudio). - -For more details, see the `PyAudio installation`_ page. - - -.. _PyAudio: https://people.csail.mit.edu/hubert/pyaudio/ -.. _PortAudio: http://www.portaudio.com/ -.. _PyAudio installation: - https://people.csail.mit.edu/hubert/pyaudio/#downloads -.. _Homebrew: http://brew.sh diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0523500..0000000 --- a/setup.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2023 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! -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100644 index 7c98d2b..0000000 --- a/setup.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import io -import os - -import setuptools # type: ignore - -package_root = os.path.abspath(os.path.dirname(__file__)) - -name = "google-cloud-appengine-admin" - - -description = "Google Cloud Appengine Admin API client library" - -version = {} -with open( - os.path.join(package_root, "google/cloud/appengine_admin/gapic_version.py") -) as fp: - exec(fp.read(), version) -version = version["__version__"] - -if version[0] == "0": - release_status = "Development Status :: 4 - Beta" -else: - release_status = "Development Status :: 5 - Production/Stable" - -dependencies = [ - "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", - "proto-plus >= 1.22.0, <2.0.0dev", - "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", -] -url = "https://github.com/googleapis/python-appengine-admin" - -package_root = os.path.abspath(os.path.dirname(__file__)) - -readme_filename = os.path.join(package_root, "README.rst") -with io.open(readme_filename, encoding="utf-8") as readme_file: - readme = readme_file.read() - -packages = [ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") -] - -namespaces = ["google", "google.cloud"] - -setuptools.setup( - name=name, - version=version, - description=description, - long_description=readme, - author="Google LLC", - author_email="googleapis-packages@google.com", - license="Apache 2.0", - url=url, - classifiers=[ - release_status, - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Operating System :: OS Independent", - "Topic :: Internet", - ], - platforms="Posix; MacOS X; Windows", - packages=packages, - python_requires=">=3.7", - namespace_packages=namespaces, - install_requires=dependencies, - include_package_data=True, - zip_safe=False, -) diff --git a/testing/.gitignore b/testing/.gitignore deleted file mode 100644 index b05fbd6..0000000 --- a/testing/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -test-env.sh -service-account.json -client-secrets.json \ No newline at end of file diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/testing/constraints-3.10.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/testing/constraints-3.11.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/testing/constraints-3.12.txt b/testing/constraints-3.12.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/testing/constraints-3.12.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt deleted file mode 100644 index 6c44adf..0000000 --- a/testing/constraints-3.7.txt +++ /dev/null @@ -1,9 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List all library dependencies and extras in this file. -# Pin the version to the lower bound. -# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", -# Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.34.0 -proto-plus==1.22.0 -protobuf==3.19.5 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/testing/constraints-3.8.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/testing/constraints-3.9.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 89a37dc..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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/__init__.py b/tests/unit/__init__.py deleted file mode 100644 index 89a37dc..0000000 --- a/tests/unit/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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/__init__.py b/tests/unit/gapic/__init__.py deleted file mode 100644 index 89a37dc..0000000 --- a/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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/appengine_admin_v1/__init__.py b/tests/unit/gapic/appengine_admin_v1/__init__.py deleted file mode 100644 index 89a37dc..0000000 --- a/tests/unit/gapic/appengine_admin_v1/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 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/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py deleted file mode 100644 index e68ba7c..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ /dev/null @@ -1,2950 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import ( - future, - gapic_v1, - grpc_helpers, - grpc_helpers_async, - operation, - operations_v1, - path_template, -) -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -from google.api_core import operation_async # type: ignore -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import json_format -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.applications import ( - ApplicationsAsyncClient, - ApplicationsClient, - transports, -) -from google.cloud.appengine_admin_v1.types import appengine, application -from google.cloud.appengine_admin_v1.types import operation as ga_operation - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert ApplicationsClient._get_default_mtls_endpoint(None) is None - assert ( - ApplicationsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - ) - assert ( - ApplicationsClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - ApplicationsClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - ApplicationsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert ApplicationsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (ApplicationsClient, "grpc"), - (ApplicationsAsyncClient, "grpc_asyncio"), - (ApplicationsClient, "rest"), - ], -) -def test_applications_client_from_service_account_info(client_class, transport_name): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.ApplicationsGrpcTransport, "grpc"), - (transports.ApplicationsGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.ApplicationsRestTransport, "rest"), - ], -) -def test_applications_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (ApplicationsClient, "grpc"), - (ApplicationsAsyncClient, "grpc_asyncio"), - (ApplicationsClient, "rest"), - ], -) -def test_applications_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_applications_client_get_transport_class(): - transport = ApplicationsClient.get_transport_class() - available_transports = [ - transports.ApplicationsGrpcTransport, - transports.ApplicationsRestTransport, - ] - assert transport in available_transports - - transport = ApplicationsClient.get_transport_class("grpc") - assert transport == transports.ApplicationsGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (ApplicationsClient, transports.ApplicationsGrpcTransport, "grpc"), - ( - ApplicationsAsyncClient, - transports.ApplicationsGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (ApplicationsClient, transports.ApplicationsRestTransport, "rest"), - ], -) -@mock.patch.object( - ApplicationsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ApplicationsClient) -) -@mock.patch.object( - ApplicationsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(ApplicationsAsyncClient), -) -def test_applications_client_client_options( - client_class, transport_class, transport_name -): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(ApplicationsClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(ApplicationsClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - (ApplicationsClient, transports.ApplicationsGrpcTransport, "grpc", "true"), - ( - ApplicationsAsyncClient, - transports.ApplicationsGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - (ApplicationsClient, transports.ApplicationsGrpcTransport, "grpc", "false"), - ( - ApplicationsAsyncClient, - transports.ApplicationsGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - (ApplicationsClient, transports.ApplicationsRestTransport, "rest", "true"), - (ApplicationsClient, transports.ApplicationsRestTransport, "rest", "false"), - ], -) -@mock.patch.object( - ApplicationsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ApplicationsClient) -) -@mock.patch.object( - ApplicationsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(ApplicationsAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_applications_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient]) -@mock.patch.object( - ApplicationsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ApplicationsClient) -) -@mock.patch.object( - ApplicationsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(ApplicationsAsyncClient), -) -def test_applications_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (ApplicationsClient, transports.ApplicationsGrpcTransport, "grpc"), - ( - ApplicationsAsyncClient, - transports.ApplicationsGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (ApplicationsClient, transports.ApplicationsRestTransport, "rest"), - ], -) -def test_applications_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - ApplicationsClient, - transports.ApplicationsGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - ApplicationsAsyncClient, - transports.ApplicationsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - (ApplicationsClient, transports.ApplicationsRestTransport, "rest", None), - ], -) -def test_applications_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_applications_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.applications.transports.ApplicationsGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = ApplicationsClient(client_options={"api_endpoint": "squid.clam.whelk"}) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - ApplicationsClient, - transports.ApplicationsGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - ApplicationsAsyncClient, - transports.ApplicationsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_applications_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetApplicationRequest, - dict, - ], -) -def test_get_application(request_type, transport: str = "grpc"): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_application), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = application.Application( - name="name_value", - id="id_value", - auth_domain="auth_domain_value", - location_id="location_id_value", - code_bucket="code_bucket_value", - serving_status=application.Application.ServingStatus.SERVING, - default_hostname="default_hostname_value", - default_bucket="default_bucket_value", - service_account="service_account_value", - gcr_domain="gcr_domain_value", - database_type=application.Application.DatabaseType.CLOUD_DATASTORE, - ) - response = client.get_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, application.Application) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.auth_domain == "auth_domain_value" - assert response.location_id == "location_id_value" - assert response.code_bucket == "code_bucket_value" - assert response.serving_status == application.Application.ServingStatus.SERVING - assert response.default_hostname == "default_hostname_value" - assert response.default_bucket == "default_bucket_value" - assert response.service_account == "service_account_value" - assert response.gcr_domain == "gcr_domain_value" - assert ( - response.database_type == application.Application.DatabaseType.CLOUD_DATASTORE - ) - - -def test_get_application_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 = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_application), "__call__") as call: - client.get_application() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetApplicationRequest() - - -@pytest.mark.asyncio -async def test_get_application_async( - transport: str = "grpc_asyncio", request_type=appengine.GetApplicationRequest -): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_application), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - application.Application( - name="name_value", - id="id_value", - auth_domain="auth_domain_value", - location_id="location_id_value", - code_bucket="code_bucket_value", - serving_status=application.Application.ServingStatus.SERVING, - default_hostname="default_hostname_value", - default_bucket="default_bucket_value", - service_account="service_account_value", - gcr_domain="gcr_domain_value", - database_type=application.Application.DatabaseType.CLOUD_DATASTORE, - ) - ) - response = await client.get_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, application.Application) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.auth_domain == "auth_domain_value" - assert response.location_id == "location_id_value" - assert response.code_bucket == "code_bucket_value" - assert response.serving_status == application.Application.ServingStatus.SERVING - assert response.default_hostname == "default_hostname_value" - assert response.default_bucket == "default_bucket_value" - assert response.service_account == "service_account_value" - assert response.gcr_domain == "gcr_domain_value" - assert ( - response.database_type == application.Application.DatabaseType.CLOUD_DATASTORE - ) - - -@pytest.mark.asyncio -async def test_get_application_async_from_dict(): - await test_get_application_async(request_type=dict) - - -def test_get_application_field_headers(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetApplicationRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_application), "__call__") as call: - call.return_value = application.Application() - client.get_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_application_field_headers_async(): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetApplicationRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_application), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - application.Application() - ) - await client.get_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -def test_get_application_flattened(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_application), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = application.Application() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_application( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -def test_get_application_flattened_error(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_application( - appengine.GetApplicationRequest(), - name="name_value", - ) - - -@pytest.mark.asyncio -async def test_get_application_flattened_async(): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_application), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = application.Application() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - application.Application() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_application( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_get_application_flattened_error_async(): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_application( - appengine.GetApplicationRequest(), - name="name_value", - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateApplicationRequest, - dict, - ], -) -def test_create_application(request_type, transport: str = "grpc"): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_application), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.create_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_application_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 = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_application), "__call__" - ) as call: - client.create_application() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateApplicationRequest() - - -@pytest.mark.asyncio -async def test_create_application_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateApplicationRequest -): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_application), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.create_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_application_async_from_dict(): - await test_create_application_async(request_type=dict) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateApplicationRequest, - dict, - ], -) -def test_update_application(request_type, transport: str = "grpc"): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_application), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_update_application_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 = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_application), "__call__" - ) as call: - client.update_application() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateApplicationRequest() - - -@pytest.mark.asyncio -async def test_update_application_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateApplicationRequest -): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_application), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.update_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_application_async_from_dict(): - await test_update_application_async(request_type=dict) - - -def test_update_application_field_headers(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateApplicationRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_application), "__call__" - ) as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.update_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_application_field_headers_async(): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateApplicationRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_application), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.update_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.RepairApplicationRequest, - dict, - ], -) -def test_repair_application(request_type, transport: str = "grpc"): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.repair_application), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.repair_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.RepairApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_repair_application_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 = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.repair_application), "__call__" - ) as call: - client.repair_application() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.RepairApplicationRequest() - - -@pytest.mark.asyncio -async def test_repair_application_async( - transport: str = "grpc_asyncio", request_type=appengine.RepairApplicationRequest -): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.repair_application), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.repair_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.RepairApplicationRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_repair_application_async_from_dict(): - await test_repair_application_async(request_type=dict) - - -def test_repair_application_field_headers(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.RepairApplicationRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.repair_application), "__call__" - ) as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.repair_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_repair_application_field_headers_async(): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.RepairApplicationRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.repair_application), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.repair_application(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetApplicationRequest, - dict, - ], -) -def test_get_application_rest(request_type): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = application.Application( - name="name_value", - id="id_value", - auth_domain="auth_domain_value", - location_id="location_id_value", - code_bucket="code_bucket_value", - serving_status=application.Application.ServingStatus.SERVING, - default_hostname="default_hostname_value", - default_bucket="default_bucket_value", - service_account="service_account_value", - gcr_domain="gcr_domain_value", - database_type=application.Application.DatabaseType.CLOUD_DATASTORE, - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = application.Application.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_application(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, application.Application) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.auth_domain == "auth_domain_value" - assert response.location_id == "location_id_value" - assert response.code_bucket == "code_bucket_value" - assert response.serving_status == application.Application.ServingStatus.SERVING - assert response.default_hostname == "default_hostname_value" - assert response.default_bucket == "default_bucket_value" - assert response.service_account == "service_account_value" - assert response.gcr_domain == "gcr_domain_value" - assert ( - response.database_type == application.Application.DatabaseType.CLOUD_DATASTORE - ) - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_application_rest_interceptors(null_interceptor): - transport = transports.ApplicationsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.ApplicationsRestInterceptor(), - ) - client = ApplicationsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.ApplicationsRestInterceptor, "post_get_application" - ) as post, mock.patch.object( - transports.ApplicationsRestInterceptor, "pre_get_application" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.GetApplicationRequest.pb( - appengine.GetApplicationRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = application.Application.to_json( - application.Application() - ) - - request = appengine.GetApplicationRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = application.Application() - - client.get_application( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_application_rest_bad_request( - transport: str = "rest", request_type=appengine.GetApplicationRequest -): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_application(request) - - -def test_get_application_rest_flattened(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = application.Application() - - # get arguments that satisfy an http rule for this method - sample_request = {"name": "apps/sample1"} - - # get truthy value for each flattened field - mock_args = dict( - name="name_value", - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = application.Application.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.get_application(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1/{name=apps/*}" % client.transport._host, args[1] - ) - - -def test_get_application_rest_flattened_error(transport: str = "rest"): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_application( - appengine.GetApplicationRequest(), - name="name_value", - ) - - -def test_get_application_rest_error(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateApplicationRequest, - dict, - ], -) -def test_create_application_rest(request_type): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {} - request_init["application"] = { - "name": "name_value", - "id": "id_value", - "dispatch_rules": [ - {"domain": "domain_value", "path": "path_value", "service": "service_value"} - ], - "auth_domain": "auth_domain_value", - "location_id": "location_id_value", - "code_bucket": "code_bucket_value", - "default_cookie_expiration": {"seconds": 751, "nanos": 543}, - "serving_status": 1, - "default_hostname": "default_hostname_value", - "default_bucket": "default_bucket_value", - "service_account": "service_account_value", - "iap": { - "enabled": True, - "oauth2_client_id": "oauth2_client_id_value", - "oauth2_client_secret": "oauth2_client_secret_value", - "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", - }, - "gcr_domain": "gcr_domain_value", - "database_type": 1, - "feature_settings": { - "split_health_checks": True, - "use_container_optimized_os": True, - }, - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.CreateApplicationRequest.meta.fields["application"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["application"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["application"][field])): - del request_init["application"][field][i][subfield] - else: - del request_init["application"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.create_application(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_application_rest_interceptors(null_interceptor): - transport = transports.ApplicationsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.ApplicationsRestInterceptor(), - ) - client = ApplicationsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.ApplicationsRestInterceptor, "post_create_application" - ) as post, mock.patch.object( - transports.ApplicationsRestInterceptor, "pre_create_application" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.CreateApplicationRequest.pb( - appengine.CreateApplicationRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.CreateApplicationRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.create_application( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_application_rest_bad_request( - transport: str = "rest", request_type=appengine.CreateApplicationRequest -): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.create_application(request) - - -def test_create_application_rest_error(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateApplicationRequest, - dict, - ], -) -def test_update_application_rest(request_type): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1"} - request_init["application"] = { - "name": "name_value", - "id": "id_value", - "dispatch_rules": [ - {"domain": "domain_value", "path": "path_value", "service": "service_value"} - ], - "auth_domain": "auth_domain_value", - "location_id": "location_id_value", - "code_bucket": "code_bucket_value", - "default_cookie_expiration": {"seconds": 751, "nanos": 543}, - "serving_status": 1, - "default_hostname": "default_hostname_value", - "default_bucket": "default_bucket_value", - "service_account": "service_account_value", - "iap": { - "enabled": True, - "oauth2_client_id": "oauth2_client_id_value", - "oauth2_client_secret": "oauth2_client_secret_value", - "oauth2_client_secret_sha256": "oauth2_client_secret_sha256_value", - }, - "gcr_domain": "gcr_domain_value", - "database_type": 1, - "feature_settings": { - "split_health_checks": True, - "use_container_optimized_os": True, - }, - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.UpdateApplicationRequest.meta.fields["application"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["application"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["application"][field])): - del request_init["application"][field][i][subfield] - else: - del request_init["application"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.update_application(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_application_rest_interceptors(null_interceptor): - transport = transports.ApplicationsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.ApplicationsRestInterceptor(), - ) - client = ApplicationsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.ApplicationsRestInterceptor, "post_update_application" - ) as post, mock.patch.object( - transports.ApplicationsRestInterceptor, "pre_update_application" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.UpdateApplicationRequest.pb( - appengine.UpdateApplicationRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.UpdateApplicationRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.update_application( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_application_rest_bad_request( - transport: str = "rest", request_type=appengine.UpdateApplicationRequest -): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.update_application(request) - - -def test_update_application_rest_error(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.RepairApplicationRequest, - dict, - ], -) -def test_repair_application_rest(request_type): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.repair_application(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_repair_application_rest_interceptors(null_interceptor): - transport = transports.ApplicationsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.ApplicationsRestInterceptor(), - ) - client = ApplicationsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.ApplicationsRestInterceptor, "post_repair_application" - ) as post, mock.patch.object( - transports.ApplicationsRestInterceptor, "pre_repair_application" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.RepairApplicationRequest.pb( - appengine.RepairApplicationRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.RepairApplicationRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.repair_application( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_repair_application_rest_bad_request( - transport: str = "rest", request_type=appengine.RepairApplicationRequest -): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.repair_application(request) - - -def test_repair_application_rest_error(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.ApplicationsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.ApplicationsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ApplicationsClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.ApplicationsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ApplicationsClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ApplicationsClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.ApplicationsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ApplicationsClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.ApplicationsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = ApplicationsClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.ApplicationsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.ApplicationsGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.ApplicationsGrpcTransport, - transports.ApplicationsGrpcAsyncIOTransport, - transports.ApplicationsRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = ApplicationsClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.ApplicationsGrpcTransport, - ) - - -def test_applications_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.ApplicationsTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_applications_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.applications.transports.ApplicationsTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.ApplicationsTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - "get_application", - "create_application", - "update_application", - "repair_application", - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_applications_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.applications.transports.ApplicationsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ApplicationsTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_applications_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.applications.transports.ApplicationsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ApplicationsTransport() - adc.assert_called_once() - - -def test_applications_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - ApplicationsClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.ApplicationsGrpcTransport, - transports.ApplicationsGrpcAsyncIOTransport, - ], -) -def test_applications_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.ApplicationsGrpcTransport, - transports.ApplicationsGrpcAsyncIOTransport, - transports.ApplicationsRestTransport, - ], -) -def test_applications_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.ApplicationsGrpcTransport, grpc_helpers), - (transports.ApplicationsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_applications_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [transports.ApplicationsGrpcTransport, transports.ApplicationsGrpcAsyncIOTransport], -) -def test_applications_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = ga_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=None, - 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_applications_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.ApplicationsRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -def test_applications_rest_lro_client(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.AbstractOperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_applications_host_no_port(transport_name): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_applications_host_with_port(transport_name): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_applications_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = ApplicationsClient( - credentials=creds1, - transport=transport_name, - ) - client2 = ApplicationsClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.get_application._session - session2 = client2.transport.get_application._session - assert session1 != session2 - session1 = client1.transport.create_application._session - session2 = client2.transport.create_application._session - assert session1 != session2 - session1 = client1.transport.update_application._session - session2 = client2.transport.update_application._session - assert session1 != session2 - session1 = client1.transport.repair_application._session - session2 = client2.transport.repair_application._session - assert session1 != session2 - - -def test_applications_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ApplicationsGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_applications_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ApplicationsGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.ApplicationsGrpcTransport, transports.ApplicationsGrpcAsyncIOTransport], -) -def test_applications_transport_channel_mtls_with_client_cert_source(transport_class): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.ApplicationsGrpcTransport, transports.ApplicationsGrpcAsyncIOTransport], -) -def test_applications_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_applications_grpc_lro_client(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_applications_grpc_lro_async_client(): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = ApplicationsClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = ApplicationsClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = ApplicationsClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = ApplicationsClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = ApplicationsClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = ApplicationsClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = ApplicationsClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = ApplicationsClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = ApplicationsClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format( - project=project, - ) - actual = ApplicationsClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = ApplicationsClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = ApplicationsClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = ApplicationsClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = ApplicationsClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = ApplicationsClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.ApplicationsTransport, "_prep_wrapped_messages" - ) as prep: - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.ApplicationsTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = ApplicationsClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (ApplicationsClient, transports.ApplicationsGrpcTransport), - (ApplicationsAsyncClient, transports.ApplicationsGrpcAsyncIOTransport), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py deleted file mode 100644 index 16099a0..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ /dev/null @@ -1,3469 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.oauth2 import service_account -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import json_format -from google.protobuf import timestamp_pb2 # type: ignore -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.authorized_certificates import ( - AuthorizedCertificatesAsyncClient, - AuthorizedCertificatesClient, - pagers, - transports, -) -from google.cloud.appengine_admin_v1.types import appengine, certificate - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert AuthorizedCertificatesClient._get_default_mtls_endpoint(None) is None - assert ( - AuthorizedCertificatesClient._get_default_mtls_endpoint(api_endpoint) - == api_mtls_endpoint - ) - assert ( - AuthorizedCertificatesClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - AuthorizedCertificatesClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - AuthorizedCertificatesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - AuthorizedCertificatesClient._get_default_mtls_endpoint(non_googleapi) - == non_googleapi - ) - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (AuthorizedCertificatesClient, "grpc"), - (AuthorizedCertificatesAsyncClient, "grpc_asyncio"), - (AuthorizedCertificatesClient, "rest"), - ], -) -def test_authorized_certificates_client_from_service_account_info( - client_class, transport_name -): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.AuthorizedCertificatesGrpcTransport, "grpc"), - (transports.AuthorizedCertificatesGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.AuthorizedCertificatesRestTransport, "rest"), - ], -) -def test_authorized_certificates_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (AuthorizedCertificatesClient, "grpc"), - (AuthorizedCertificatesAsyncClient, "grpc_asyncio"), - (AuthorizedCertificatesClient, "rest"), - ], -) -def test_authorized_certificates_client_from_service_account_file( - client_class, transport_name -): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_authorized_certificates_client_get_transport_class(): - transport = AuthorizedCertificatesClient.get_transport_class() - available_transports = [ - transports.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesRestTransport, - ] - assert transport in available_transports - - transport = AuthorizedCertificatesClient.get_transport_class("grpc") - assert transport == transports.AuthorizedCertificatesGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesGrpcTransport, - "grpc", - ), - ( - AuthorizedCertificatesAsyncClient, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - "grpc_asyncio", - ), - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesRestTransport, - "rest", - ), - ], -) -@mock.patch.object( - AuthorizedCertificatesClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedCertificatesClient), -) -@mock.patch.object( - AuthorizedCertificatesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedCertificatesAsyncClient), -) -def test_authorized_certificates_client_client_options( - client_class, transport_class, transport_name -): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(AuthorizedCertificatesClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(AuthorizedCertificatesClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesGrpcTransport, - "grpc", - "true", - ), - ( - AuthorizedCertificatesAsyncClient, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesGrpcTransport, - "grpc", - "false", - ), - ( - AuthorizedCertificatesAsyncClient, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesRestTransport, - "rest", - "true", - ), - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesRestTransport, - "rest", - "false", - ), - ], -) -@mock.patch.object( - AuthorizedCertificatesClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedCertificatesClient), -) -@mock.patch.object( - AuthorizedCertificatesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedCertificatesAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_authorized_certificates_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient] -) -@mock.patch.object( - AuthorizedCertificatesClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedCertificatesClient), -) -@mock.patch.object( - AuthorizedCertificatesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedCertificatesAsyncClient), -) -def test_authorized_certificates_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesGrpcTransport, - "grpc", - ), - ( - AuthorizedCertificatesAsyncClient, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - "grpc_asyncio", - ), - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesRestTransport, - "rest", - ), - ], -) -def test_authorized_certificates_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - AuthorizedCertificatesAsyncClient, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesRestTransport, - "rest", - None, - ), - ], -) -def test_authorized_certificates_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_authorized_certificates_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_certificates.transports.AuthorizedCertificatesGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = AuthorizedCertificatesClient( - client_options={"api_endpoint": "squid.clam.whelk"} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - AuthorizedCertificatesClient, - transports.AuthorizedCertificatesGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - AuthorizedCertificatesAsyncClient, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_authorized_certificates_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListAuthorizedCertificatesRequest, - dict, - ], -) -def test_list_authorized_certificates(request_type, transport: str = "grpc"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.ListAuthorizedCertificatesResponse( - next_page_token="next_page_token_value", - ) - response = client.list_authorized_certificates(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedCertificatesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAuthorizedCertificatesPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_authorized_certificates_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 = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), "__call__" - ) as call: - client.list_authorized_certificates() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedCertificatesRequest() - - -@pytest.mark.asyncio -async def test_list_authorized_certificates_async( - transport: str = "grpc_asyncio", - request_type=appengine.ListAuthorizedCertificatesRequest, -): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListAuthorizedCertificatesResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_authorized_certificates(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedCertificatesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAuthorizedCertificatesAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_authorized_certificates_async_from_dict(): - await test_list_authorized_certificates_async(request_type=dict) - - -def test_list_authorized_certificates_field_headers(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListAuthorizedCertificatesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), "__call__" - ) as call: - call.return_value = appengine.ListAuthorizedCertificatesResponse() - client.list_authorized_certificates(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_authorized_certificates_field_headers_async(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListAuthorizedCertificatesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListAuthorizedCertificatesResponse() - ) - await client.list_authorized_certificates(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_authorized_certificates_pager(transport_name: str = "grpc"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[], - next_page_token="def", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_authorized_certificates(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, certificate.AuthorizedCertificate) for i in results) - - -def test_list_authorized_certificates_pages(transport_name: str = "grpc"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[], - next_page_token="def", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - ), - RuntimeError, - ) - pages = list(client.list_authorized_certificates(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_authorized_certificates_async_pager(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[], - next_page_token="def", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_authorized_certificates( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, certificate.AuthorizedCertificate) for i in responses) - - -@pytest.mark.asyncio -async def test_list_authorized_certificates_async_pages(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_certificates), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[], - next_page_token="def", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_authorized_certificates(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetAuthorizedCertificateRequest, - dict, - ], -) -def test_get_authorized_certificate(request_type, transport: str = "grpc"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - response = client.get_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -def test_get_authorized_certificate_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 = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_authorized_certificate), "__call__" - ) as call: - client.get_authorized_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetAuthorizedCertificateRequest() - - -@pytest.mark.asyncio -async def test_get_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.GetAuthorizedCertificateRequest, -): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - ) - response = await client.get_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -@pytest.mark.asyncio -async def test_get_authorized_certificate_async_from_dict(): - await test_get_authorized_certificate_async(request_type=dict) - - -def test_get_authorized_certificate_field_headers(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetAuthorizedCertificateRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_authorized_certificate), "__call__" - ) as call: - call.return_value = certificate.AuthorizedCertificate() - client.get_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_authorized_certificate_field_headers_async(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetAuthorizedCertificateRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_authorized_certificate), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - certificate.AuthorizedCertificate() - ) - await client.get_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateAuthorizedCertificateRequest, - dict, - ], -) -def test_create_authorized_certificate(request_type, transport: str = "grpc"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - response = client.create_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -def test_create_authorized_certificate_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 = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_authorized_certificate), "__call__" - ) as call: - client.create_authorized_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateAuthorizedCertificateRequest() - - -@pytest.mark.asyncio -async def test_create_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.CreateAuthorizedCertificateRequest, -): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - ) - response = await client.create_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -@pytest.mark.asyncio -async def test_create_authorized_certificate_async_from_dict(): - await test_create_authorized_certificate_async(request_type=dict) - - -def test_create_authorized_certificate_field_headers(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateAuthorizedCertificateRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_authorized_certificate), "__call__" - ) as call: - call.return_value = certificate.AuthorizedCertificate() - client.create_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_create_authorized_certificate_field_headers_async(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateAuthorizedCertificateRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_authorized_certificate), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - certificate.AuthorizedCertificate() - ) - await client.create_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateAuthorizedCertificateRequest, - dict, - ], -) -def test_update_authorized_certificate(request_type, transport: str = "grpc"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - response = client.update_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -def test_update_authorized_certificate_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 = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_authorized_certificate), "__call__" - ) as call: - client.update_authorized_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateAuthorizedCertificateRequest() - - -@pytest.mark.asyncio -async def test_update_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.UpdateAuthorizedCertificateRequest, -): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - ) - response = await client.update_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -@pytest.mark.asyncio -async def test_update_authorized_certificate_async_from_dict(): - await test_update_authorized_certificate_async(request_type=dict) - - -def test_update_authorized_certificate_field_headers(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateAuthorizedCertificateRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_authorized_certificate), "__call__" - ) as call: - call.return_value = certificate.AuthorizedCertificate() - client.update_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_authorized_certificate_field_headers_async(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateAuthorizedCertificateRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_authorized_certificate), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - certificate.AuthorizedCertificate() - ) - await client.update_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteAuthorizedCertificateRequest, - dict, - ], -) -def test_delete_authorized_certificate(request_type, transport: str = "grpc"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_authorized_certificate_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 = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_authorized_certificate), "__call__" - ) as call: - client.delete_authorized_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteAuthorizedCertificateRequest() - - -@pytest.mark.asyncio -async def test_delete_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.DeleteAuthorizedCertificateRequest, -): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_authorized_certificate), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteAuthorizedCertificateRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_delete_authorized_certificate_async_from_dict(): - await test_delete_authorized_certificate_async(request_type=dict) - - -def test_delete_authorized_certificate_field_headers(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteAuthorizedCertificateRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_authorized_certificate), "__call__" - ) as call: - call.return_value = None - client.delete_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_authorized_certificate_field_headers_async(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteAuthorizedCertificateRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_authorized_certificate), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_authorized_certificate(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListAuthorizedCertificatesRequest, - dict, - ], -) -def test_list_authorized_certificates_rest(request_type): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.ListAuthorizedCertificatesResponse( - next_page_token="next_page_token_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.ListAuthorizedCertificatesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_authorized_certificates(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAuthorizedCertificatesPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_authorized_certificates_rest_interceptors(null_interceptor): - transport = transports.AuthorizedCertificatesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AuthorizedCertificatesRestInterceptor(), - ) - client = AuthorizedCertificatesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "post_list_authorized_certificates", - ) as post, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "pre_list_authorized_certificates", - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.ListAuthorizedCertificatesRequest.pb( - appengine.ListAuthorizedCertificatesRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = ( - appengine.ListAuthorizedCertificatesResponse.to_json( - appengine.ListAuthorizedCertificatesResponse() - ) - ) - - request = appengine.ListAuthorizedCertificatesRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.ListAuthorizedCertificatesResponse() - - client.list_authorized_certificates( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_authorized_certificates_rest_bad_request( - transport: str = "rest", request_type=appengine.ListAuthorizedCertificatesRequest -): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_authorized_certificates(request) - - -def test_list_authorized_certificates_rest_pager(transport: str = "rest"): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[], - next_page_token="def", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedCertificatesResponse( - certificates=[ - certificate.AuthorizedCertificate(), - certificate.AuthorizedCertificate(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - appengine.ListAuthorizedCertificatesResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "apps/sample1"} - - pager = client.list_authorized_certificates(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, certificate.AuthorizedCertificate) for i in results) - - pages = list(client.list_authorized_certificates(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetAuthorizedCertificateRequest, - dict, - ], -) -def test_get_authorized_certificate_rest(request_type): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = certificate.AuthorizedCertificate.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_authorized_certificate(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_authorized_certificate_rest_interceptors(null_interceptor): - transport = transports.AuthorizedCertificatesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AuthorizedCertificatesRestInterceptor(), - ) - client = AuthorizedCertificatesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "post_get_authorized_certificate", - ) as post, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "pre_get_authorized_certificate", - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.GetAuthorizedCertificateRequest.pb( - appengine.GetAuthorizedCertificateRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = certificate.AuthorizedCertificate.to_json( - certificate.AuthorizedCertificate() - ) - - request = appengine.GetAuthorizedCertificateRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = certificate.AuthorizedCertificate() - - client.get_authorized_certificate( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_authorized_certificate_rest_bad_request( - transport: str = "rest", request_type=appengine.GetAuthorizedCertificateRequest -): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_authorized_certificate(request) - - -def test_get_authorized_certificate_rest_error(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateAuthorizedCertificateRequest, - dict, - ], -) -def test_create_authorized_certificate_rest(request_type): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request_init["certificate"] = { - "name": "name_value", - "id": "id_value", - "display_name": "display_name_value", - "domain_names": ["domain_names_value1", "domain_names_value2"], - "expire_time": {"seconds": 751, "nanos": 543}, - "certificate_raw_data": { - "public_certificate": "public_certificate_value", - "private_key": "private_key_value", - }, - "managed_certificate": {"last_renewal_time": {}, "status": 1}, - "visible_domain_mappings": [ - "visible_domain_mappings_value1", - "visible_domain_mappings_value2", - ], - "domain_mappings_count": 2238, - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.CreateAuthorizedCertificateRequest.meta.fields["certificate"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["certificate"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["certificate"][field])): - del request_init["certificate"][field][i][subfield] - else: - del request_init["certificate"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = certificate.AuthorizedCertificate.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.create_authorized_certificate(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_authorized_certificate_rest_interceptors(null_interceptor): - transport = transports.AuthorizedCertificatesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AuthorizedCertificatesRestInterceptor(), - ) - client = AuthorizedCertificatesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "post_create_authorized_certificate", - ) as post, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "pre_create_authorized_certificate", - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.CreateAuthorizedCertificateRequest.pb( - appengine.CreateAuthorizedCertificateRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = certificate.AuthorizedCertificate.to_json( - certificate.AuthorizedCertificate() - ) - - request = appengine.CreateAuthorizedCertificateRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = certificate.AuthorizedCertificate() - - client.create_authorized_certificate( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_authorized_certificate_rest_bad_request( - transport: str = "rest", request_type=appengine.CreateAuthorizedCertificateRequest -): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.create_authorized_certificate(request) - - -def test_create_authorized_certificate_rest_error(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateAuthorizedCertificateRequest, - dict, - ], -) -def test_update_authorized_certificate_rest(request_type): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} - request_init["certificate"] = { - "name": "name_value", - "id": "id_value", - "display_name": "display_name_value", - "domain_names": ["domain_names_value1", "domain_names_value2"], - "expire_time": {"seconds": 751, "nanos": 543}, - "certificate_raw_data": { - "public_certificate": "public_certificate_value", - "private_key": "private_key_value", - }, - "managed_certificate": {"last_renewal_time": {}, "status": 1}, - "visible_domain_mappings": [ - "visible_domain_mappings_value1", - "visible_domain_mappings_value2", - ], - "domain_mappings_count": 2238, - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.UpdateAuthorizedCertificateRequest.meta.fields["certificate"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["certificate"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["certificate"][field])): - del request_init["certificate"][field][i][subfield] - else: - del request_init["certificate"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = certificate.AuthorizedCertificate( - name="name_value", - id="id_value", - display_name="display_name_value", - domain_names=["domain_names_value"], - visible_domain_mappings=["visible_domain_mappings_value"], - domain_mappings_count=2238, - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = certificate.AuthorizedCertificate.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.update_authorized_certificate(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, certificate.AuthorizedCertificate) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.display_name == "display_name_value" - assert response.domain_names == ["domain_names_value"] - assert response.visible_domain_mappings == ["visible_domain_mappings_value"] - assert response.domain_mappings_count == 2238 - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_authorized_certificate_rest_interceptors(null_interceptor): - transport = transports.AuthorizedCertificatesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AuthorizedCertificatesRestInterceptor(), - ) - client = AuthorizedCertificatesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "post_update_authorized_certificate", - ) as post, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "pre_update_authorized_certificate", - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.UpdateAuthorizedCertificateRequest.pb( - appengine.UpdateAuthorizedCertificateRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = certificate.AuthorizedCertificate.to_json( - certificate.AuthorizedCertificate() - ) - - request = appengine.UpdateAuthorizedCertificateRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = certificate.AuthorizedCertificate() - - client.update_authorized_certificate( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_authorized_certificate_rest_bad_request( - transport: str = "rest", request_type=appengine.UpdateAuthorizedCertificateRequest -): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.update_authorized_certificate(request) - - -def test_update_authorized_certificate_rest_error(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteAuthorizedCertificateRequest, - dict, - ], -) -def test_delete_authorized_certificate_rest(request_type): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.delete_authorized_certificate(request) - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_authorized_certificate_rest_interceptors(null_interceptor): - transport = transports.AuthorizedCertificatesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AuthorizedCertificatesRestInterceptor(), - ) - client = AuthorizedCertificatesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AuthorizedCertificatesRestInterceptor, - "pre_delete_authorized_certificate", - ) as pre: - pre.assert_not_called() - pb_message = appengine.DeleteAuthorizedCertificateRequest.pb( - appengine.DeleteAuthorizedCertificateRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - - request = appengine.DeleteAuthorizedCertificateRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - - client.delete_authorized_certificate( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - - -def test_delete_authorized_certificate_rest_bad_request( - transport: str = "rest", request_type=appengine.DeleteAuthorizedCertificateRequest -): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/authorizedCertificates/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_authorized_certificate(request) - - -def test_delete_authorized_certificate_rest_error(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = AuthorizedCertificatesClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = AuthorizedCertificatesClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = AuthorizedCertificatesClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = AuthorizedCertificatesClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = AuthorizedCertificatesClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.AuthorizedCertificatesGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - transports.AuthorizedCertificatesRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = AuthorizedCertificatesClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.AuthorizedCertificatesGrpcTransport, - ) - - -def test_authorized_certificates_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.AuthorizedCertificatesTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_authorized_certificates_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_certificates.transports.AuthorizedCertificatesTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.AuthorizedCertificatesTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - "list_authorized_certificates", - "get_authorized_certificate", - "create_authorized_certificate", - "update_authorized_certificate", - "delete_authorized_certificate", - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_authorized_certificates_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_certificates.transports.AuthorizedCertificatesTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.AuthorizedCertificatesTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_authorized_certificates_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_certificates.transports.AuthorizedCertificatesTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.AuthorizedCertificatesTransport() - adc.assert_called_once() - - -def test_authorized_certificates_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - AuthorizedCertificatesClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - ], -) -def test_authorized_certificates_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - transports.AuthorizedCertificatesRestTransport, - ], -) -def test_authorized_certificates_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.AuthorizedCertificatesGrpcTransport, grpc_helpers), - (transports.AuthorizedCertificatesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_authorized_certificates_transport_create_channel( - transport_class, grpc_helpers -): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - ], -) -def test_authorized_certificates_grpc_transport_client_cert_source_for_mtls( - transport_class, -): - cred = ga_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=None, - 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_authorized_certificates_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.AuthorizedCertificatesRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_authorized_certificates_host_no_port(transport_name): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_authorized_certificates_host_with_port(transport_name): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_authorized_certificates_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = AuthorizedCertificatesClient( - credentials=creds1, - transport=transport_name, - ) - client2 = AuthorizedCertificatesClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_authorized_certificates._session - session2 = client2.transport.list_authorized_certificates._session - assert session1 != session2 - session1 = client1.transport.get_authorized_certificate._session - session2 = client2.transport.get_authorized_certificate._session - assert session1 != session2 - session1 = client1.transport.create_authorized_certificate._session - session2 = client2.transport.create_authorized_certificate._session - assert session1 != session2 - session1 = client1.transport.update_authorized_certificate._session - session2 = client2.transport.update_authorized_certificate._session - assert session1 != session2 - session1 = client1.transport.delete_authorized_certificate._session - session2 = client2.transport.delete_authorized_certificate._session - assert session1 != session2 - - -def test_authorized_certificates_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.AuthorizedCertificatesGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_authorized_certificates_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.AuthorizedCertificatesGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - ], -) -def test_authorized_certificates_transport_channel_mtls_with_client_cert_source( - transport_class, -): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - ], -) -def test_authorized_certificates_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = AuthorizedCertificatesClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = AuthorizedCertificatesClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedCertificatesClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = AuthorizedCertificatesClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = AuthorizedCertificatesClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedCertificatesClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = AuthorizedCertificatesClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = AuthorizedCertificatesClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedCertificatesClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format( - project=project, - ) - actual = AuthorizedCertificatesClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = AuthorizedCertificatesClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedCertificatesClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = AuthorizedCertificatesClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = AuthorizedCertificatesClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedCertificatesClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.AuthorizedCertificatesTransport, "_prep_wrapped_messages" - ) as prep: - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.AuthorizedCertificatesTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = AuthorizedCertificatesClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (AuthorizedCertificatesClient, transports.AuthorizedCertificatesGrpcTransport), - ( - AuthorizedCertificatesAsyncClient, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - ), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py deleted file mode 100644 index 044ec94..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ /dev/null @@ -1,2030 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.oauth2 import service_account -from google.protobuf import json_format -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.authorized_domains import ( - AuthorizedDomainsAsyncClient, - AuthorizedDomainsClient, - pagers, - transports, -) -from google.cloud.appengine_admin_v1.types import appengine, domain - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert AuthorizedDomainsClient._get_default_mtls_endpoint(None) is None - assert ( - AuthorizedDomainsClient._get_default_mtls_endpoint(api_endpoint) - == api_mtls_endpoint - ) - assert ( - AuthorizedDomainsClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - AuthorizedDomainsClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - AuthorizedDomainsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - AuthorizedDomainsClient._get_default_mtls_endpoint(non_googleapi) - == non_googleapi - ) - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (AuthorizedDomainsClient, "grpc"), - (AuthorizedDomainsAsyncClient, "grpc_asyncio"), - (AuthorizedDomainsClient, "rest"), - ], -) -def test_authorized_domains_client_from_service_account_info( - client_class, transport_name -): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.AuthorizedDomainsGrpcTransport, "grpc"), - (transports.AuthorizedDomainsGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.AuthorizedDomainsRestTransport, "rest"), - ], -) -def test_authorized_domains_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (AuthorizedDomainsClient, "grpc"), - (AuthorizedDomainsAsyncClient, "grpc_asyncio"), - (AuthorizedDomainsClient, "rest"), - ], -) -def test_authorized_domains_client_from_service_account_file( - client_class, transport_name -): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_authorized_domains_client_get_transport_class(): - transport = AuthorizedDomainsClient.get_transport_class() - available_transports = [ - transports.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsRestTransport, - ] - assert transport in available_transports - - transport = AuthorizedDomainsClient.get_transport_class("grpc") - assert transport == transports.AuthorizedDomainsGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (AuthorizedDomainsClient, transports.AuthorizedDomainsGrpcTransport, "grpc"), - ( - AuthorizedDomainsAsyncClient, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (AuthorizedDomainsClient, transports.AuthorizedDomainsRestTransport, "rest"), - ], -) -@mock.patch.object( - AuthorizedDomainsClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedDomainsClient), -) -@mock.patch.object( - AuthorizedDomainsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedDomainsAsyncClient), -) -def test_authorized_domains_client_client_options( - client_class, transport_class, transport_name -): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(AuthorizedDomainsClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(AuthorizedDomainsClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - ( - AuthorizedDomainsClient, - transports.AuthorizedDomainsGrpcTransport, - "grpc", - "true", - ), - ( - AuthorizedDomainsAsyncClient, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - ( - AuthorizedDomainsClient, - transports.AuthorizedDomainsGrpcTransport, - "grpc", - "false", - ), - ( - AuthorizedDomainsAsyncClient, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - ( - AuthorizedDomainsClient, - transports.AuthorizedDomainsRestTransport, - "rest", - "true", - ), - ( - AuthorizedDomainsClient, - transports.AuthorizedDomainsRestTransport, - "rest", - "false", - ), - ], -) -@mock.patch.object( - AuthorizedDomainsClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedDomainsClient), -) -@mock.patch.object( - AuthorizedDomainsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedDomainsAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_authorized_domains_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient] -) -@mock.patch.object( - AuthorizedDomainsClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedDomainsClient), -) -@mock.patch.object( - AuthorizedDomainsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(AuthorizedDomainsAsyncClient), -) -def test_authorized_domains_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (AuthorizedDomainsClient, transports.AuthorizedDomainsGrpcTransport, "grpc"), - ( - AuthorizedDomainsAsyncClient, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (AuthorizedDomainsClient, transports.AuthorizedDomainsRestTransport, "rest"), - ], -) -def test_authorized_domains_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - AuthorizedDomainsClient, - transports.AuthorizedDomainsGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - AuthorizedDomainsAsyncClient, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ( - AuthorizedDomainsClient, - transports.AuthorizedDomainsRestTransport, - "rest", - None, - ), - ], -) -def test_authorized_domains_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_authorized_domains_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_domains.transports.AuthorizedDomainsGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = AuthorizedDomainsClient( - client_options={"api_endpoint": "squid.clam.whelk"} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - AuthorizedDomainsClient, - transports.AuthorizedDomainsGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - AuthorizedDomainsAsyncClient, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_authorized_domains_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListAuthorizedDomainsRequest, - dict, - ], -) -def test_list_authorized_domains(request_type, transport: str = "grpc"): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.ListAuthorizedDomainsResponse( - next_page_token="next_page_token_value", - ) - response = client.list_authorized_domains(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedDomainsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAuthorizedDomainsPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_authorized_domains_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 = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), "__call__" - ) as call: - client.list_authorized_domains() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedDomainsRequest() - - -@pytest.mark.asyncio -async def test_list_authorized_domains_async( - transport: str = "grpc_asyncio", request_type=appengine.ListAuthorizedDomainsRequest -): - client = AuthorizedDomainsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListAuthorizedDomainsResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_authorized_domains(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedDomainsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAuthorizedDomainsAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_authorized_domains_async_from_dict(): - await test_list_authorized_domains_async(request_type=dict) - - -def test_list_authorized_domains_field_headers(): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListAuthorizedDomainsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), "__call__" - ) as call: - call.return_value = appengine.ListAuthorizedDomainsResponse() - client.list_authorized_domains(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_authorized_domains_field_headers_async(): - client = AuthorizedDomainsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListAuthorizedDomainsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListAuthorizedDomainsResponse() - ) - await client.list_authorized_domains(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_authorized_domains_pager(transport_name: str = "grpc"): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[], - next_page_token="def", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_authorized_domains(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, domain.AuthorizedDomain) for i in results) - - -def test_list_authorized_domains_pages(transport_name: str = "grpc"): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[], - next_page_token="def", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - ), - RuntimeError, - ) - pages = list(client.list_authorized_domains(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_authorized_domains_async_pager(): - client = AuthorizedDomainsAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[], - next_page_token="def", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_authorized_domains( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, domain.AuthorizedDomain) for i in responses) - - -@pytest.mark.asyncio -async def test_list_authorized_domains_async_pages(): - client = AuthorizedDomainsAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_authorized_domains), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[], - next_page_token="def", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_authorized_domains(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListAuthorizedDomainsRequest, - dict, - ], -) -def test_list_authorized_domains_rest(request_type): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.ListAuthorizedDomainsResponse( - next_page_token="next_page_token_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.ListAuthorizedDomainsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_authorized_domains(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAuthorizedDomainsPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_authorized_domains_rest_interceptors(null_interceptor): - transport = transports.AuthorizedDomainsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AuthorizedDomainsRestInterceptor(), - ) - client = AuthorizedDomainsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AuthorizedDomainsRestInterceptor, "post_list_authorized_domains" - ) as post, mock.patch.object( - transports.AuthorizedDomainsRestInterceptor, "pre_list_authorized_domains" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.ListAuthorizedDomainsRequest.pb( - appengine.ListAuthorizedDomainsRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = appengine.ListAuthorizedDomainsResponse.to_json( - appengine.ListAuthorizedDomainsResponse() - ) - - request = appengine.ListAuthorizedDomainsRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.ListAuthorizedDomainsResponse() - - client.list_authorized_domains( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_authorized_domains_rest_bad_request( - transport: str = "rest", request_type=appengine.ListAuthorizedDomainsRequest -): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_authorized_domains(request) - - -def test_list_authorized_domains_rest_pager(transport: str = "rest"): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - next_page_token="abc", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[], - next_page_token="def", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - ], - next_page_token="ghi", - ), - appengine.ListAuthorizedDomainsResponse( - domains=[ - domain.AuthorizedDomain(), - domain.AuthorizedDomain(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - appengine.ListAuthorizedDomainsResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "apps/sample1"} - - pager = client.list_authorized_domains(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, domain.AuthorizedDomain) for i in results) - - pages = list(client.list_authorized_domains(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.AuthorizedDomainsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.AuthorizedDomainsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = AuthorizedDomainsClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.AuthorizedDomainsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = AuthorizedDomainsClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = AuthorizedDomainsClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.AuthorizedDomainsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = AuthorizedDomainsClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.AuthorizedDomainsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = AuthorizedDomainsClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.AuthorizedDomainsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.AuthorizedDomainsGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - transports.AuthorizedDomainsRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = AuthorizedDomainsClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.AuthorizedDomainsGrpcTransport, - ) - - -def test_authorized_domains_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.AuthorizedDomainsTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_authorized_domains_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_domains.transports.AuthorizedDomainsTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.AuthorizedDomainsTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ("list_authorized_domains",) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_authorized_domains_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_domains.transports.AuthorizedDomainsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.AuthorizedDomainsTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_authorized_domains_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.authorized_domains.transports.AuthorizedDomainsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.AuthorizedDomainsTransport() - adc.assert_called_once() - - -def test_authorized_domains_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - AuthorizedDomainsClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - ], -) -def test_authorized_domains_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - transports.AuthorizedDomainsRestTransport, - ], -) -def test_authorized_domains_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.AuthorizedDomainsGrpcTransport, grpc_helpers), - (transports.AuthorizedDomainsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_authorized_domains_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - ], -) -def test_authorized_domains_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = ga_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=None, - 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_authorized_domains_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.AuthorizedDomainsRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_authorized_domains_host_no_port(transport_name): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_authorized_domains_host_with_port(transport_name): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_authorized_domains_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = AuthorizedDomainsClient( - credentials=creds1, - transport=transport_name, - ) - client2 = AuthorizedDomainsClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_authorized_domains._session - session2 = client2.transport.list_authorized_domains._session - assert session1 != session2 - - -def test_authorized_domains_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.AuthorizedDomainsGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_authorized_domains_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.AuthorizedDomainsGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - ], -) -def test_authorized_domains_transport_channel_mtls_with_client_cert_source( - transport_class, -): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - ], -) -def test_authorized_domains_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = AuthorizedDomainsClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = AuthorizedDomainsClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedDomainsClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = AuthorizedDomainsClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = AuthorizedDomainsClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedDomainsClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = AuthorizedDomainsClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = AuthorizedDomainsClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedDomainsClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format( - project=project, - ) - actual = AuthorizedDomainsClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = AuthorizedDomainsClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedDomainsClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = AuthorizedDomainsClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = AuthorizedDomainsClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = AuthorizedDomainsClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.AuthorizedDomainsTransport, "_prep_wrapped_messages" - ) as prep: - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.AuthorizedDomainsTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = AuthorizedDomainsClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = AuthorizedDomainsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (AuthorizedDomainsClient, transports.AuthorizedDomainsGrpcTransport), - ( - AuthorizedDomainsAsyncClient, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - ), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py deleted file mode 100644 index 5e2ff40..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ /dev/null @@ -1,3369 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import ( - future, - gapic_v1, - grpc_helpers, - grpc_helpers_async, - operation, - operations_v1, - path_template, -) -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -from google.api_core import operation_async # type: ignore -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import json_format -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.domain_mappings import ( - DomainMappingsAsyncClient, - DomainMappingsClient, - pagers, - transports, -) -from google.cloud.appengine_admin_v1.types import appengine, domain_mapping -from google.cloud.appengine_admin_v1.types import operation as ga_operation - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert DomainMappingsClient._get_default_mtls_endpoint(None) is None - assert ( - DomainMappingsClient._get_default_mtls_endpoint(api_endpoint) - == api_mtls_endpoint - ) - assert ( - DomainMappingsClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - DomainMappingsClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - DomainMappingsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - DomainMappingsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - ) - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (DomainMappingsClient, "grpc"), - (DomainMappingsAsyncClient, "grpc_asyncio"), - (DomainMappingsClient, "rest"), - ], -) -def test_domain_mappings_client_from_service_account_info(client_class, transport_name): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.DomainMappingsGrpcTransport, "grpc"), - (transports.DomainMappingsGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.DomainMappingsRestTransport, "rest"), - ], -) -def test_domain_mappings_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (DomainMappingsClient, "grpc"), - (DomainMappingsAsyncClient, "grpc_asyncio"), - (DomainMappingsClient, "rest"), - ], -) -def test_domain_mappings_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_domain_mappings_client_get_transport_class(): - transport = DomainMappingsClient.get_transport_class() - available_transports = [ - transports.DomainMappingsGrpcTransport, - transports.DomainMappingsRestTransport, - ] - assert transport in available_transports - - transport = DomainMappingsClient.get_transport_class("grpc") - assert transport == transports.DomainMappingsGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (DomainMappingsClient, transports.DomainMappingsGrpcTransport, "grpc"), - ( - DomainMappingsAsyncClient, - transports.DomainMappingsGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest"), - ], -) -@mock.patch.object( - DomainMappingsClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(DomainMappingsClient), -) -@mock.patch.object( - DomainMappingsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(DomainMappingsAsyncClient), -) -def test_domain_mappings_client_client_options( - client_class, transport_class, transport_name -): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(DomainMappingsClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(DomainMappingsClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - (DomainMappingsClient, transports.DomainMappingsGrpcTransport, "grpc", "true"), - ( - DomainMappingsAsyncClient, - transports.DomainMappingsGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - (DomainMappingsClient, transports.DomainMappingsGrpcTransport, "grpc", "false"), - ( - DomainMappingsAsyncClient, - transports.DomainMappingsGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest", "true"), - (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest", "false"), - ], -) -@mock.patch.object( - DomainMappingsClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(DomainMappingsClient), -) -@mock.patch.object( - DomainMappingsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(DomainMappingsAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_domain_mappings_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class", [DomainMappingsClient, DomainMappingsAsyncClient] -) -@mock.patch.object( - DomainMappingsClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(DomainMappingsClient), -) -@mock.patch.object( - DomainMappingsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(DomainMappingsAsyncClient), -) -def test_domain_mappings_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (DomainMappingsClient, transports.DomainMappingsGrpcTransport, "grpc"), - ( - DomainMappingsAsyncClient, - transports.DomainMappingsGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest"), - ], -) -def test_domain_mappings_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - DomainMappingsClient, - transports.DomainMappingsGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - DomainMappingsAsyncClient, - transports.DomainMappingsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - (DomainMappingsClient, transports.DomainMappingsRestTransport, "rest", None), - ], -) -def test_domain_mappings_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_domain_mappings_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.domain_mappings.transports.DomainMappingsGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = DomainMappingsClient( - client_options={"api_endpoint": "squid.clam.whelk"} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - ( - DomainMappingsClient, - transports.DomainMappingsGrpcTransport, - "grpc", - grpc_helpers, - ), - ( - DomainMappingsAsyncClient, - transports.DomainMappingsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_domain_mappings_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListDomainMappingsRequest, - dict, - ], -) -def test_list_domain_mappings(request_type, transport: str = "grpc"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.ListDomainMappingsResponse( - next_page_token="next_page_token_value", - ) - response = client.list_domain_mappings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListDomainMappingsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDomainMappingsPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_domain_mappings_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 = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), "__call__" - ) as call: - client.list_domain_mappings() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListDomainMappingsRequest() - - -@pytest.mark.asyncio -async def test_list_domain_mappings_async( - transport: str = "grpc_asyncio", request_type=appengine.ListDomainMappingsRequest -): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListDomainMappingsResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_domain_mappings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListDomainMappingsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDomainMappingsAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_domain_mappings_async_from_dict(): - await test_list_domain_mappings_async(request_type=dict) - - -def test_list_domain_mappings_field_headers(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListDomainMappingsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), "__call__" - ) as call: - call.return_value = appengine.ListDomainMappingsResponse() - client.list_domain_mappings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_domain_mappings_field_headers_async(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListDomainMappingsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListDomainMappingsResponse() - ) - await client.list_domain_mappings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_domain_mappings_pager(transport_name: str = "grpc"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - next_page_token="abc", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[], - next_page_token="def", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - ], - next_page_token="ghi", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_domain_mappings(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, domain_mapping.DomainMapping) for i in results) - - -def test_list_domain_mappings_pages(transport_name: str = "grpc"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - next_page_token="abc", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[], - next_page_token="def", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - ], - next_page_token="ghi", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - ), - RuntimeError, - ) - pages = list(client.list_domain_mappings(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_domain_mappings_async_pager(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - next_page_token="abc", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[], - next_page_token="def", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - ], - next_page_token="ghi", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_domain_mappings( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, domain_mapping.DomainMapping) for i in responses) - - -@pytest.mark.asyncio -async def test_list_domain_mappings_async_pages(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_domain_mappings), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - next_page_token="abc", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[], - next_page_token="def", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - ], - next_page_token="ghi", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_domain_mappings(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetDomainMappingRequest, - dict, - ], -) -def test_get_domain_mapping(request_type, transport: str = "grpc"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = domain_mapping.DomainMapping( - name="name_value", - id="id_value", - ) - response = client.get_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, domain_mapping.DomainMapping) - assert response.name == "name_value" - assert response.id == "id_value" - - -def test_get_domain_mapping_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 = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_domain_mapping), "__call__" - ) as call: - client.get_domain_mapping() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetDomainMappingRequest() - - -@pytest.mark.asyncio -async def test_get_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.GetDomainMappingRequest -): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - domain_mapping.DomainMapping( - name="name_value", - id="id_value", - ) - ) - response = await client.get_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, domain_mapping.DomainMapping) - assert response.name == "name_value" - assert response.id == "id_value" - - -@pytest.mark.asyncio -async def test_get_domain_mapping_async_from_dict(): - await test_get_domain_mapping_async(request_type=dict) - - -def test_get_domain_mapping_field_headers(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetDomainMappingRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_domain_mapping), "__call__" - ) as call: - call.return_value = domain_mapping.DomainMapping() - client.get_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetDomainMappingRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_domain_mapping), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - domain_mapping.DomainMapping() - ) - await client.get_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateDomainMappingRequest, - dict, - ], -) -def test_create_domain_mapping(request_type, transport: str = "grpc"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.create_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_domain_mapping_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 = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_domain_mapping), "__call__" - ) as call: - client.create_domain_mapping() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateDomainMappingRequest() - - -@pytest.mark.asyncio -async def test_create_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateDomainMappingRequest -): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.create_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_domain_mapping_async_from_dict(): - await test_create_domain_mapping_async(request_type=dict) - - -def test_create_domain_mapping_field_headers(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateDomainMappingRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_domain_mapping), "__call__" - ) as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.create_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_create_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateDomainMappingRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_domain_mapping), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.create_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateDomainMappingRequest, - dict, - ], -) -def test_update_domain_mapping(request_type, transport: str = "grpc"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_update_domain_mapping_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 = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_domain_mapping), "__call__" - ) as call: - client.update_domain_mapping() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateDomainMappingRequest() - - -@pytest.mark.asyncio -async def test_update_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateDomainMappingRequest -): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.update_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_domain_mapping_async_from_dict(): - await test_update_domain_mapping_async(request_type=dict) - - -def test_update_domain_mapping_field_headers(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateDomainMappingRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_domain_mapping), "__call__" - ) as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.update_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateDomainMappingRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_domain_mapping), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.update_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteDomainMappingRequest, - dict, - ], -) -def test_delete_domain_mapping(request_type, transport: str = "grpc"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.delete_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_delete_domain_mapping_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 = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_domain_mapping), "__call__" - ) as call: - client.delete_domain_mapping() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteDomainMappingRequest() - - -@pytest.mark.asyncio -async def test_delete_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteDomainMappingRequest -): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_domain_mapping), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.delete_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteDomainMappingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_domain_mapping_async_from_dict(): - await test_delete_domain_mapping_async(request_type=dict) - - -def test_delete_domain_mapping_field_headers(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteDomainMappingRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_domain_mapping), "__call__" - ) as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.delete_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteDomainMappingRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_domain_mapping), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.delete_domain_mapping(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListDomainMappingsRequest, - dict, - ], -) -def test_list_domain_mappings_rest(request_type): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.ListDomainMappingsResponse( - next_page_token="next_page_token_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.ListDomainMappingsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_domain_mappings(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDomainMappingsPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_domain_mappings_rest_interceptors(null_interceptor): - transport = transports.DomainMappingsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.DomainMappingsRestInterceptor(), - ) - client = DomainMappingsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.DomainMappingsRestInterceptor, "post_list_domain_mappings" - ) as post, mock.patch.object( - transports.DomainMappingsRestInterceptor, "pre_list_domain_mappings" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.ListDomainMappingsRequest.pb( - appengine.ListDomainMappingsRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = appengine.ListDomainMappingsResponse.to_json( - appengine.ListDomainMappingsResponse() - ) - - request = appengine.ListDomainMappingsRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.ListDomainMappingsResponse() - - client.list_domain_mappings( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_domain_mappings_rest_bad_request( - transport: str = "rest", request_type=appengine.ListDomainMappingsRequest -): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_domain_mappings(request) - - -def test_list_domain_mappings_rest_pager(transport: str = "rest"): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - next_page_token="abc", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[], - next_page_token="def", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - ], - next_page_token="ghi", - ), - appengine.ListDomainMappingsResponse( - domain_mappings=[ - domain_mapping.DomainMapping(), - domain_mapping.DomainMapping(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - appengine.ListDomainMappingsResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "apps/sample1"} - - pager = client.list_domain_mappings(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, domain_mapping.DomainMapping) for i in results) - - pages = list(client.list_domain_mappings(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetDomainMappingRequest, - dict, - ], -) -def test_get_domain_mapping_rest(request_type): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/domainMappings/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = domain_mapping.DomainMapping( - name="name_value", - id="id_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = domain_mapping.DomainMapping.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_domain_mapping(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, domain_mapping.DomainMapping) - assert response.name == "name_value" - assert response.id == "id_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_domain_mapping_rest_interceptors(null_interceptor): - transport = transports.DomainMappingsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.DomainMappingsRestInterceptor(), - ) - client = DomainMappingsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.DomainMappingsRestInterceptor, "post_get_domain_mapping" - ) as post, mock.patch.object( - transports.DomainMappingsRestInterceptor, "pre_get_domain_mapping" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.GetDomainMappingRequest.pb( - appengine.GetDomainMappingRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = domain_mapping.DomainMapping.to_json( - domain_mapping.DomainMapping() - ) - - request = appengine.GetDomainMappingRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = domain_mapping.DomainMapping() - - client.get_domain_mapping( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_domain_mapping_rest_bad_request( - transport: str = "rest", request_type=appengine.GetDomainMappingRequest -): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/domainMappings/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_domain_mapping(request) - - -def test_get_domain_mapping_rest_error(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateDomainMappingRequest, - dict, - ], -) -def test_create_domain_mapping_rest(request_type): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request_init["domain_mapping"] = { - "name": "name_value", - "id": "id_value", - "ssl_settings": { - "certificate_id": "certificate_id_value", - "ssl_management_type": 1, - "pending_managed_certificate_id": "pending_managed_certificate_id_value", - }, - "resource_records": [ - {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} - ], - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.CreateDomainMappingRequest.meta.fields["domain_mapping"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["domain_mapping"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["domain_mapping"][field])): - del request_init["domain_mapping"][field][i][subfield] - else: - del request_init["domain_mapping"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.create_domain_mapping(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_domain_mapping_rest_interceptors(null_interceptor): - transport = transports.DomainMappingsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.DomainMappingsRestInterceptor(), - ) - client = DomainMappingsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.DomainMappingsRestInterceptor, "post_create_domain_mapping" - ) as post, mock.patch.object( - transports.DomainMappingsRestInterceptor, "pre_create_domain_mapping" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.CreateDomainMappingRequest.pb( - appengine.CreateDomainMappingRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.CreateDomainMappingRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.create_domain_mapping( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_domain_mapping_rest_bad_request( - transport: str = "rest", request_type=appengine.CreateDomainMappingRequest -): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.create_domain_mapping(request) - - -def test_create_domain_mapping_rest_error(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateDomainMappingRequest, - dict, - ], -) -def test_update_domain_mapping_rest(request_type): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/domainMappings/sample2"} - request_init["domain_mapping"] = { - "name": "name_value", - "id": "id_value", - "ssl_settings": { - "certificate_id": "certificate_id_value", - "ssl_management_type": 1, - "pending_managed_certificate_id": "pending_managed_certificate_id_value", - }, - "resource_records": [ - {"name": "name_value", "rrdata": "rrdata_value", "type_": 1} - ], - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.UpdateDomainMappingRequest.meta.fields["domain_mapping"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["domain_mapping"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["domain_mapping"][field])): - del request_init["domain_mapping"][field][i][subfield] - else: - del request_init["domain_mapping"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.update_domain_mapping(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_domain_mapping_rest_interceptors(null_interceptor): - transport = transports.DomainMappingsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.DomainMappingsRestInterceptor(), - ) - client = DomainMappingsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.DomainMappingsRestInterceptor, "post_update_domain_mapping" - ) as post, mock.patch.object( - transports.DomainMappingsRestInterceptor, "pre_update_domain_mapping" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.UpdateDomainMappingRequest.pb( - appengine.UpdateDomainMappingRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.UpdateDomainMappingRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.update_domain_mapping( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_domain_mapping_rest_bad_request( - transport: str = "rest", request_type=appengine.UpdateDomainMappingRequest -): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/domainMappings/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.update_domain_mapping(request) - - -def test_update_domain_mapping_rest_error(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteDomainMappingRequest, - dict, - ], -) -def test_delete_domain_mapping_rest(request_type): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/domainMappings/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.delete_domain_mapping(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_domain_mapping_rest_interceptors(null_interceptor): - transport = transports.DomainMappingsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.DomainMappingsRestInterceptor(), - ) - client = DomainMappingsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.DomainMappingsRestInterceptor, "post_delete_domain_mapping" - ) as post, mock.patch.object( - transports.DomainMappingsRestInterceptor, "pre_delete_domain_mapping" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.DeleteDomainMappingRequest.pb( - appengine.DeleteDomainMappingRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.DeleteDomainMappingRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.delete_domain_mapping( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_delete_domain_mapping_rest_bad_request( - transport: str = "rest", request_type=appengine.DeleteDomainMappingRequest -): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/domainMappings/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_domain_mapping(request) - - -def test_delete_domain_mapping_rest_error(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.DomainMappingsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.DomainMappingsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DomainMappingsClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.DomainMappingsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = DomainMappingsClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = DomainMappingsClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.DomainMappingsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DomainMappingsClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.DomainMappingsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = DomainMappingsClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.DomainMappingsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.DomainMappingsGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DomainMappingsGrpcTransport, - transports.DomainMappingsGrpcAsyncIOTransport, - transports.DomainMappingsRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = DomainMappingsClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.DomainMappingsGrpcTransport, - ) - - -def test_domain_mappings_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.DomainMappingsTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_domain_mappings_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.domain_mappings.transports.DomainMappingsTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.DomainMappingsTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - "list_domain_mappings", - "get_domain_mapping", - "create_domain_mapping", - "update_domain_mapping", - "delete_domain_mapping", - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_domain_mappings_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.domain_mappings.transports.DomainMappingsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DomainMappingsTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_domain_mappings_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.domain_mappings.transports.DomainMappingsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DomainMappingsTransport() - adc.assert_called_once() - - -def test_domain_mappings_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - DomainMappingsClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DomainMappingsGrpcTransport, - transports.DomainMappingsGrpcAsyncIOTransport, - ], -) -def test_domain_mappings_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DomainMappingsGrpcTransport, - transports.DomainMappingsGrpcAsyncIOTransport, - transports.DomainMappingsRestTransport, - ], -) -def test_domain_mappings_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.DomainMappingsGrpcTransport, grpc_helpers), - (transports.DomainMappingsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_domain_mappings_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DomainMappingsGrpcTransport, - transports.DomainMappingsGrpcAsyncIOTransport, - ], -) -def test_domain_mappings_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = ga_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=None, - 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_domain_mappings_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.DomainMappingsRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -def test_domain_mappings_rest_lro_client(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.AbstractOperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_domain_mappings_host_no_port(transport_name): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_domain_mappings_host_with_port(transport_name): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_domain_mappings_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = DomainMappingsClient( - credentials=creds1, - transport=transport_name, - ) - client2 = DomainMappingsClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_domain_mappings._session - session2 = client2.transport.list_domain_mappings._session - assert session1 != session2 - session1 = client1.transport.get_domain_mapping._session - session2 = client2.transport.get_domain_mapping._session - assert session1 != session2 - session1 = client1.transport.create_domain_mapping._session - session2 = client2.transport.create_domain_mapping._session - assert session1 != session2 - session1 = client1.transport.update_domain_mapping._session - session2 = client2.transport.update_domain_mapping._session - assert session1 != session2 - session1 = client1.transport.delete_domain_mapping._session - session2 = client2.transport.delete_domain_mapping._session - assert session1 != session2 - - -def test_domain_mappings_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.DomainMappingsGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_domain_mappings_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.DomainMappingsGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.DomainMappingsGrpcTransport, - transports.DomainMappingsGrpcAsyncIOTransport, - ], -) -def test_domain_mappings_transport_channel_mtls_with_client_cert_source( - transport_class, -): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.DomainMappingsGrpcTransport, - transports.DomainMappingsGrpcAsyncIOTransport, - ], -) -def test_domain_mappings_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_domain_mappings_grpc_lro_client(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_domain_mappings_grpc_lro_async_client(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = DomainMappingsClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = DomainMappingsClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = DomainMappingsClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = DomainMappingsClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = DomainMappingsClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = DomainMappingsClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = DomainMappingsClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = DomainMappingsClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = DomainMappingsClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format( - project=project, - ) - actual = DomainMappingsClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = DomainMappingsClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = DomainMappingsClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = DomainMappingsClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = DomainMappingsClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = DomainMappingsClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.DomainMappingsTransport, "_prep_wrapped_messages" - ) as prep: - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.DomainMappingsTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = DomainMappingsClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (DomainMappingsClient, transports.DomainMappingsGrpcTransport), - (DomainMappingsAsyncClient, transports.DomainMappingsGrpcAsyncIOTransport), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py deleted file mode 100644 index ba7381b..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ /dev/null @@ -1,3556 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.oauth2 import service_account -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import json_format -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.firewall import ( - FirewallAsyncClient, - FirewallClient, - pagers, - transports, -) -from google.cloud.appengine_admin_v1.types import appengine, firewall - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert FirewallClient._get_default_mtls_endpoint(None) is None - assert FirewallClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert ( - FirewallClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - FirewallClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - FirewallClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert FirewallClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (FirewallClient, "grpc"), - (FirewallAsyncClient, "grpc_asyncio"), - (FirewallClient, "rest"), - ], -) -def test_firewall_client_from_service_account_info(client_class, transport_name): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.FirewallGrpcTransport, "grpc"), - (transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.FirewallRestTransport, "rest"), - ], -) -def test_firewall_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (FirewallClient, "grpc"), - (FirewallAsyncClient, "grpc_asyncio"), - (FirewallClient, "rest"), - ], -) -def test_firewall_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_firewall_client_get_transport_class(): - transport = FirewallClient.get_transport_class() - available_transports = [ - transports.FirewallGrpcTransport, - transports.FirewallRestTransport, - ] - assert transport in available_transports - - transport = FirewallClient.get_transport_class("grpc") - assert transport == transports.FirewallGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (FirewallClient, transports.FirewallGrpcTransport, "grpc"), - (FirewallAsyncClient, transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), - (FirewallClient, transports.FirewallRestTransport, "rest"), - ], -) -@mock.patch.object( - FirewallClient, "DEFAULT_ENDPOINT", modify_default_endpoint(FirewallClient) -) -@mock.patch.object( - FirewallAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(FirewallAsyncClient), -) -def test_firewall_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(FirewallClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(FirewallClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - (FirewallClient, transports.FirewallGrpcTransport, "grpc", "true"), - ( - FirewallAsyncClient, - transports.FirewallGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - (FirewallClient, transports.FirewallGrpcTransport, "grpc", "false"), - ( - FirewallAsyncClient, - transports.FirewallGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - (FirewallClient, transports.FirewallRestTransport, "rest", "true"), - (FirewallClient, transports.FirewallRestTransport, "rest", "false"), - ], -) -@mock.patch.object( - FirewallClient, "DEFAULT_ENDPOINT", modify_default_endpoint(FirewallClient) -) -@mock.patch.object( - FirewallAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(FirewallAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_firewall_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient]) -@mock.patch.object( - FirewallClient, "DEFAULT_ENDPOINT", modify_default_endpoint(FirewallClient) -) -@mock.patch.object( - FirewallAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(FirewallAsyncClient), -) -def test_firewall_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (FirewallClient, transports.FirewallGrpcTransport, "grpc"), - (FirewallAsyncClient, transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), - (FirewallClient, transports.FirewallRestTransport, "rest"), - ], -) -def test_firewall_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (FirewallClient, transports.FirewallGrpcTransport, "grpc", grpc_helpers), - ( - FirewallAsyncClient, - transports.FirewallGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - (FirewallClient, transports.FirewallRestTransport, "rest", None), - ], -) -def test_firewall_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_firewall_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.firewall.transports.FirewallGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = FirewallClient(client_options={"api_endpoint": "squid.clam.whelk"}) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (FirewallClient, transports.FirewallGrpcTransport, "grpc", grpc_helpers), - ( - FirewallAsyncClient, - transports.FirewallGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_firewall_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListIngressRulesRequest, - dict, - ], -) -def test_list_ingress_rules(request_type, transport: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.ListIngressRulesResponse( - next_page_token="next_page_token_value", - ) - response = client.list_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListIngressRulesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListIngressRulesPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_ingress_rules_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 = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), "__call__" - ) as call: - client.list_ingress_rules() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListIngressRulesRequest() - - -@pytest.mark.asyncio -async def test_list_ingress_rules_async( - transport: str = "grpc_asyncio", request_type=appengine.ListIngressRulesRequest -): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListIngressRulesResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListIngressRulesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListIngressRulesAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_ingress_rules_async_from_dict(): - await test_list_ingress_rules_async(request_type=dict) - - -def test_list_ingress_rules_field_headers(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListIngressRulesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), "__call__" - ) as call: - call.return_value = appengine.ListIngressRulesResponse() - client.list_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_ingress_rules_field_headers_async(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListIngressRulesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListIngressRulesResponse() - ) - await client.list_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_ingress_rules_pager(transport_name: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - next_page_token="abc", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[], - next_page_token="def", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - ], - next_page_token="ghi", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_ingress_rules(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, firewall.FirewallRule) for i in results) - - -def test_list_ingress_rules_pages(transport_name: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - next_page_token="abc", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[], - next_page_token="def", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - ], - next_page_token="ghi", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - ), - RuntimeError, - ) - pages = list(client.list_ingress_rules(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_ingress_rules_async_pager(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - next_page_token="abc", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[], - next_page_token="def", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - ], - next_page_token="ghi", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_ingress_rules( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, firewall.FirewallRule) for i in responses) - - -@pytest.mark.asyncio -async def test_list_ingress_rules_async_pages(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ingress_rules), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - next_page_token="abc", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[], - next_page_token="def", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - ], - next_page_token="ghi", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_ingress_rules(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.BatchUpdateIngressRulesRequest, - dict, - ], -) -def test_batch_update_ingress_rules(request_type, transport: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_update_ingress_rules), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.BatchUpdateIngressRulesResponse() - response = client.batch_update_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.BatchUpdateIngressRulesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, appengine.BatchUpdateIngressRulesResponse) - - -def test_batch_update_ingress_rules_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 = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_update_ingress_rules), "__call__" - ) as call: - client.batch_update_ingress_rules() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.BatchUpdateIngressRulesRequest() - - -@pytest.mark.asyncio -async def test_batch_update_ingress_rules_async( - transport: str = "grpc_asyncio", - request_type=appengine.BatchUpdateIngressRulesRequest, -): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_update_ingress_rules), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.BatchUpdateIngressRulesResponse() - ) - response = await client.batch_update_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.BatchUpdateIngressRulesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, appengine.BatchUpdateIngressRulesResponse) - - -@pytest.mark.asyncio -async def test_batch_update_ingress_rules_async_from_dict(): - await test_batch_update_ingress_rules_async(request_type=dict) - - -def test_batch_update_ingress_rules_field_headers(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.BatchUpdateIngressRulesRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_update_ingress_rules), "__call__" - ) as call: - call.return_value = appengine.BatchUpdateIngressRulesResponse() - client.batch_update_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_batch_update_ingress_rules_field_headers_async(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.BatchUpdateIngressRulesRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_update_ingress_rules), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.BatchUpdateIngressRulesResponse() - ) - await client.batch_update_ingress_rules(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateIngressRuleRequest, - dict, - ], -) -def test_create_ingress_rule(request_type, transport: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_ingress_rule), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - response = client.create_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -def test_create_ingress_rule_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 = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_ingress_rule), "__call__" - ) as call: - client.create_ingress_rule() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateIngressRuleRequest() - - -@pytest.mark.asyncio -async def test_create_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateIngressRuleRequest -): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_ingress_rule), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - ) - response = await client.create_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -@pytest.mark.asyncio -async def test_create_ingress_rule_async_from_dict(): - await test_create_ingress_rule_async(request_type=dict) - - -def test_create_ingress_rule_field_headers(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateIngressRuleRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_ingress_rule), "__call__" - ) as call: - call.return_value = firewall.FirewallRule() - client.create_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_create_ingress_rule_field_headers_async(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateIngressRuleRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_ingress_rule), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - firewall.FirewallRule() - ) - await client.create_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetIngressRuleRequest, - dict, - ], -) -def test_get_ingress_rule(request_type, transport: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_ingress_rule), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - response = client.get_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -def test_get_ingress_rule_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 = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_ingress_rule), "__call__") as call: - client.get_ingress_rule() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetIngressRuleRequest() - - -@pytest.mark.asyncio -async def test_get_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.GetIngressRuleRequest -): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_ingress_rule), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - ) - response = await client.get_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -@pytest.mark.asyncio -async def test_get_ingress_rule_async_from_dict(): - await test_get_ingress_rule_async(request_type=dict) - - -def test_get_ingress_rule_field_headers(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetIngressRuleRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_ingress_rule), "__call__") as call: - call.return_value = firewall.FirewallRule() - client.get_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_ingress_rule_field_headers_async(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetIngressRuleRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_ingress_rule), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - firewall.FirewallRule() - ) - await client.get_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateIngressRuleRequest, - dict, - ], -) -def test_update_ingress_rule(request_type, transport: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_ingress_rule), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - response = client.update_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -def test_update_ingress_rule_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 = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_ingress_rule), "__call__" - ) as call: - client.update_ingress_rule() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateIngressRuleRequest() - - -@pytest.mark.asyncio -async def test_update_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateIngressRuleRequest -): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_ingress_rule), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - ) - response = await client.update_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -@pytest.mark.asyncio -async def test_update_ingress_rule_async_from_dict(): - await test_update_ingress_rule_async(request_type=dict) - - -def test_update_ingress_rule_field_headers(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateIngressRuleRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_ingress_rule), "__call__" - ) as call: - call.return_value = firewall.FirewallRule() - client.update_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_ingress_rule_field_headers_async(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateIngressRuleRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_ingress_rule), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - firewall.FirewallRule() - ) - await client.update_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteIngressRuleRequest, - dict, - ], -) -def test_delete_ingress_rule(request_type, transport: str = "grpc"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_ingress_rule), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_ingress_rule_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 = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_ingress_rule), "__call__" - ) as call: - client.delete_ingress_rule() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteIngressRuleRequest() - - -@pytest.mark.asyncio -async def test_delete_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteIngressRuleRequest -): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_ingress_rule), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteIngressRuleRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_delete_ingress_rule_async_from_dict(): - await test_delete_ingress_rule_async(request_type=dict) - - -def test_delete_ingress_rule_field_headers(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteIngressRuleRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_ingress_rule), "__call__" - ) as call: - call.return_value = None - client.delete_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_ingress_rule_field_headers_async(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteIngressRuleRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_ingress_rule), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_ingress_rule(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListIngressRulesRequest, - dict, - ], -) -def test_list_ingress_rules_rest(request_type): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.ListIngressRulesResponse( - next_page_token="next_page_token_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.ListIngressRulesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_ingress_rules(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListIngressRulesPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_ingress_rules_rest_interceptors(null_interceptor): - transport = transports.FirewallRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), - ) - client = FirewallClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.FirewallRestInterceptor, "post_list_ingress_rules" - ) as post, mock.patch.object( - transports.FirewallRestInterceptor, "pre_list_ingress_rules" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.ListIngressRulesRequest.pb( - appengine.ListIngressRulesRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = appengine.ListIngressRulesResponse.to_json( - appengine.ListIngressRulesResponse() - ) - - request = appengine.ListIngressRulesRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.ListIngressRulesResponse() - - client.list_ingress_rules( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_ingress_rules_rest_bad_request( - transport: str = "rest", request_type=appengine.ListIngressRulesRequest -): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_ingress_rules(request) - - -def test_list_ingress_rules_rest_pager(transport: str = "rest"): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - next_page_token="abc", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[], - next_page_token="def", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - ], - next_page_token="ghi", - ), - appengine.ListIngressRulesResponse( - ingress_rules=[ - firewall.FirewallRule(), - firewall.FirewallRule(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - appengine.ListIngressRulesResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "apps/sample1"} - - pager = client.list_ingress_rules(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, firewall.FirewallRule) for i in results) - - pages = list(client.list_ingress_rules(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.BatchUpdateIngressRulesRequest, - dict, - ], -) -def test_batch_update_ingress_rules_rest(request_type): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.BatchUpdateIngressRulesResponse() - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.BatchUpdateIngressRulesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.batch_update_ingress_rules(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, appengine.BatchUpdateIngressRulesResponse) - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_update_ingress_rules_rest_interceptors(null_interceptor): - transport = transports.FirewallRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), - ) - client = FirewallClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.FirewallRestInterceptor, "post_batch_update_ingress_rules" - ) as post, mock.patch.object( - transports.FirewallRestInterceptor, "pre_batch_update_ingress_rules" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.BatchUpdateIngressRulesRequest.pb( - appengine.BatchUpdateIngressRulesRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = appengine.BatchUpdateIngressRulesResponse.to_json( - appengine.BatchUpdateIngressRulesResponse() - ) - - request = appengine.BatchUpdateIngressRulesRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.BatchUpdateIngressRulesResponse() - - client.batch_update_ingress_rules( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_batch_update_ingress_rules_rest_bad_request( - transport: str = "rest", request_type=appengine.BatchUpdateIngressRulesRequest -): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.batch_update_ingress_rules(request) - - -def test_batch_update_ingress_rules_rest_error(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateIngressRuleRequest, - dict, - ], -) -def test_create_ingress_rule_rest(request_type): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request_init["rule"] = { - "priority": 898, - "action": 1, - "source_range": "source_range_value", - "description": "description_value", - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.CreateIngressRuleRequest.meta.fields["rule"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["rule"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["rule"][field])): - del request_init["rule"][field][i][subfield] - else: - del request_init["rule"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = firewall.FirewallRule.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.create_ingress_rule(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_ingress_rule_rest_interceptors(null_interceptor): - transport = transports.FirewallRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), - ) - client = FirewallClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.FirewallRestInterceptor, "post_create_ingress_rule" - ) as post, mock.patch.object( - transports.FirewallRestInterceptor, "pre_create_ingress_rule" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.CreateIngressRuleRequest.pb( - appengine.CreateIngressRuleRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = firewall.FirewallRule.to_json( - firewall.FirewallRule() - ) - - request = appengine.CreateIngressRuleRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = firewall.FirewallRule() - - client.create_ingress_rule( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_ingress_rule_rest_bad_request( - transport: str = "rest", request_type=appengine.CreateIngressRuleRequest -): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.create_ingress_rule(request) - - -def test_create_ingress_rule_rest_error(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetIngressRuleRequest, - dict, - ], -) -def test_get_ingress_rule_rest(request_type): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = firewall.FirewallRule.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_ingress_rule(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_ingress_rule_rest_interceptors(null_interceptor): - transport = transports.FirewallRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), - ) - client = FirewallClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.FirewallRestInterceptor, "post_get_ingress_rule" - ) as post, mock.patch.object( - transports.FirewallRestInterceptor, "pre_get_ingress_rule" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.GetIngressRuleRequest.pb( - appengine.GetIngressRuleRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = firewall.FirewallRule.to_json( - firewall.FirewallRule() - ) - - request = appengine.GetIngressRuleRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = firewall.FirewallRule() - - client.get_ingress_rule( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_ingress_rule_rest_bad_request( - transport: str = "rest", request_type=appengine.GetIngressRuleRequest -): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_ingress_rule(request) - - -def test_get_ingress_rule_rest_error(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateIngressRuleRequest, - dict, - ], -) -def test_update_ingress_rule_rest(request_type): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} - request_init["rule"] = { - "priority": 898, - "action": 1, - "source_range": "source_range_value", - "description": "description_value", - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.UpdateIngressRuleRequest.meta.fields["rule"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["rule"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["rule"][field])): - del request_init["rule"][field][i][subfield] - else: - del request_init["rule"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = firewall.FirewallRule( - priority=898, - action=firewall.FirewallRule.Action.ALLOW, - source_range="source_range_value", - description="description_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = firewall.FirewallRule.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.update_ingress_rule(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, firewall.FirewallRule) - assert response.priority == 898 - assert response.action == firewall.FirewallRule.Action.ALLOW - assert response.source_range == "source_range_value" - assert response.description == "description_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_ingress_rule_rest_interceptors(null_interceptor): - transport = transports.FirewallRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), - ) - client = FirewallClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.FirewallRestInterceptor, "post_update_ingress_rule" - ) as post, mock.patch.object( - transports.FirewallRestInterceptor, "pre_update_ingress_rule" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.UpdateIngressRuleRequest.pb( - appengine.UpdateIngressRuleRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = firewall.FirewallRule.to_json( - firewall.FirewallRule() - ) - - request = appengine.UpdateIngressRuleRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = firewall.FirewallRule() - - client.update_ingress_rule( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_ingress_rule_rest_bad_request( - transport: str = "rest", request_type=appengine.UpdateIngressRuleRequest -): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.update_ingress_rule(request) - - -def test_update_ingress_rule_rest_error(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteIngressRuleRequest, - dict, - ], -) -def test_delete_ingress_rule_rest(request_type): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.delete_ingress_rule(request) - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_ingress_rule_rest_interceptors(null_interceptor): - transport = transports.FirewallRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.FirewallRestInterceptor(), - ) - client = FirewallClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.FirewallRestInterceptor, "pre_delete_ingress_rule" - ) as pre: - pre.assert_not_called() - pb_message = appengine.DeleteIngressRuleRequest.pb( - appengine.DeleteIngressRuleRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - - request = appengine.DeleteIngressRuleRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - - client.delete_ingress_rule( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - - -def test_delete_ingress_rule_rest_bad_request( - transport: str = "rest", request_type=appengine.DeleteIngressRuleRequest -): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/firewall/ingressRules/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_ingress_rule(request) - - -def test_delete_ingress_rule_rest_error(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.FirewallGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.FirewallGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = FirewallClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.FirewallGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = FirewallClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = FirewallClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.FirewallGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = FirewallClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.FirewallGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = FirewallClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.FirewallGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.FirewallGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.FirewallGrpcTransport, - transports.FirewallGrpcAsyncIOTransport, - transports.FirewallRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = FirewallClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.FirewallGrpcTransport, - ) - - -def test_firewall_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.FirewallTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_firewall_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.firewall.transports.FirewallTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.FirewallTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - "list_ingress_rules", - "batch_update_ingress_rules", - "create_ingress_rule", - "get_ingress_rule", - "update_ingress_rule", - "delete_ingress_rule", - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_firewall_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.firewall.transports.FirewallTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.FirewallTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_firewall_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.firewall.transports.FirewallTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.FirewallTransport() - adc.assert_called_once() - - -def test_firewall_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - FirewallClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.FirewallGrpcTransport, - transports.FirewallGrpcAsyncIOTransport, - ], -) -def test_firewall_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.FirewallGrpcTransport, - transports.FirewallGrpcAsyncIOTransport, - transports.FirewallRestTransport, - ], -) -def test_firewall_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.FirewallGrpcTransport, grpc_helpers), - (transports.FirewallGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_firewall_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [transports.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport], -) -def test_firewall_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = ga_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=None, - 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_firewall_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.FirewallRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_firewall_host_no_port(transport_name): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_firewall_host_with_port(transport_name): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_firewall_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = FirewallClient( - credentials=creds1, - transport=transport_name, - ) - client2 = FirewallClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_ingress_rules._session - session2 = client2.transport.list_ingress_rules._session - assert session1 != session2 - session1 = client1.transport.batch_update_ingress_rules._session - session2 = client2.transport.batch_update_ingress_rules._session - assert session1 != session2 - session1 = client1.transport.create_ingress_rule._session - session2 = client2.transport.create_ingress_rule._session - assert session1 != session2 - session1 = client1.transport.get_ingress_rule._session - session2 = client2.transport.get_ingress_rule._session - assert session1 != session2 - session1 = client1.transport.update_ingress_rule._session - session2 = client2.transport.update_ingress_rule._session - assert session1 != session2 - session1 = client1.transport.delete_ingress_rule._session - session2 = client2.transport.delete_ingress_rule._session - assert session1 != session2 - - -def test_firewall_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.FirewallGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_firewall_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.FirewallGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport], -) -def test_firewall_transport_channel_mtls_with_client_cert_source(transport_class): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport], -) -def test_firewall_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = FirewallClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = FirewallClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = FirewallClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = FirewallClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = FirewallClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = FirewallClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = FirewallClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = FirewallClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = FirewallClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format( - project=project, - ) - actual = FirewallClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = FirewallClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = FirewallClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = FirewallClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = FirewallClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = FirewallClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.FirewallTransport, "_prep_wrapped_messages" - ) as prep: - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.FirewallTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = FirewallClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (FirewallClient, transports.FirewallGrpcTransport), - (FirewallAsyncClient, transports.FirewallGrpcAsyncIOTransport), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py deleted file mode 100644 index 4a001e7..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ /dev/null @@ -1,2950 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import ( - future, - gapic_v1, - grpc_helpers, - grpc_helpers_async, - operation, - operations_v1, - path_template, -) -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -from google.api_core import operation_async # type: ignore -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import json_format -from google.protobuf import timestamp_pb2 # type: ignore -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.instances import ( - InstancesAsyncClient, - InstancesClient, - pagers, - transports, -) -from google.cloud.appengine_admin_v1.types import appengine, instance -from google.cloud.appengine_admin_v1.types import operation as ga_operation - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert InstancesClient._get_default_mtls_endpoint(None) is None - assert InstancesClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert ( - InstancesClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - InstancesClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - InstancesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert InstancesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (InstancesClient, "grpc"), - (InstancesAsyncClient, "grpc_asyncio"), - (InstancesClient, "rest"), - ], -) -def test_instances_client_from_service_account_info(client_class, transport_name): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.InstancesGrpcTransport, "grpc"), - (transports.InstancesGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.InstancesRestTransport, "rest"), - ], -) -def test_instances_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (InstancesClient, "grpc"), - (InstancesAsyncClient, "grpc_asyncio"), - (InstancesClient, "rest"), - ], -) -def test_instances_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_instances_client_get_transport_class(): - transport = InstancesClient.get_transport_class() - available_transports = [ - transports.InstancesGrpcTransport, - transports.InstancesRestTransport, - ] - assert transport in available_transports - - transport = InstancesClient.get_transport_class("grpc") - assert transport == transports.InstancesGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (InstancesClient, transports.InstancesGrpcTransport, "grpc"), - ( - InstancesAsyncClient, - transports.InstancesGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (InstancesClient, transports.InstancesRestTransport, "rest"), - ], -) -@mock.patch.object( - InstancesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(InstancesClient) -) -@mock.patch.object( - InstancesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(InstancesAsyncClient), -) -def test_instances_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(InstancesClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(InstancesClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - (InstancesClient, transports.InstancesGrpcTransport, "grpc", "true"), - ( - InstancesAsyncClient, - transports.InstancesGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - (InstancesClient, transports.InstancesGrpcTransport, "grpc", "false"), - ( - InstancesAsyncClient, - transports.InstancesGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - (InstancesClient, transports.InstancesRestTransport, "rest", "true"), - (InstancesClient, transports.InstancesRestTransport, "rest", "false"), - ], -) -@mock.patch.object( - InstancesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(InstancesClient) -) -@mock.patch.object( - InstancesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(InstancesAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_instances_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient]) -@mock.patch.object( - InstancesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(InstancesClient) -) -@mock.patch.object( - InstancesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(InstancesAsyncClient), -) -def test_instances_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (InstancesClient, transports.InstancesGrpcTransport, "grpc"), - ( - InstancesAsyncClient, - transports.InstancesGrpcAsyncIOTransport, - "grpc_asyncio", - ), - (InstancesClient, transports.InstancesRestTransport, "rest"), - ], -) -def test_instances_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (InstancesClient, transports.InstancesGrpcTransport, "grpc", grpc_helpers), - ( - InstancesAsyncClient, - transports.InstancesGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - (InstancesClient, transports.InstancesRestTransport, "rest", None), - ], -) -def test_instances_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_instances_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.instances.transports.InstancesGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = InstancesClient(client_options={"api_endpoint": "squid.clam.whelk"}) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (InstancesClient, transports.InstancesGrpcTransport, "grpc", grpc_helpers), - ( - InstancesAsyncClient, - transports.InstancesGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_instances_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListInstancesRequest, - dict, - ], -) -def test_list_instances(request_type, transport: str = "grpc"): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_instances), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.ListInstancesResponse( - next_page_token="next_page_token_value", - ) - response = client.list_instances(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListInstancesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListInstancesPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_instances_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 = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_instances), "__call__") as call: - client.list_instances() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListInstancesRequest() - - -@pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=appengine.ListInstancesRequest -): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_instances), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListInstancesResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_instances(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListInstancesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListInstancesAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_instances_async_from_dict(): - await test_list_instances_async(request_type=dict) - - -def test_list_instances_field_headers(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListInstancesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_instances), "__call__") as call: - call.return_value = appengine.ListInstancesResponse() - client.list_instances(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_instances_field_headers_async(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListInstancesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_instances), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListInstancesResponse() - ) - await client.list_instances(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_instances_pager(transport_name: str = "grpc"): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_instances), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - instance.Instance(), - ], - next_page_token="abc", - ), - appengine.ListInstancesResponse( - instances=[], - next_page_token="def", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - ], - next_page_token="ghi", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_instances(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, instance.Instance) for i in results) - - -def test_list_instances_pages(transport_name: str = "grpc"): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_instances), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - instance.Instance(), - ], - next_page_token="abc", - ), - appengine.ListInstancesResponse( - instances=[], - next_page_token="def", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - ], - next_page_token="ghi", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - ], - ), - RuntimeError, - ) - pages = list(client.list_instances(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_instances_async_pager(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_instances), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - instance.Instance(), - ], - next_page_token="abc", - ), - appengine.ListInstancesResponse( - instances=[], - next_page_token="def", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - ], - next_page_token="ghi", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_instances( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, instance.Instance) for i in responses) - - -@pytest.mark.asyncio -async def test_list_instances_async_pages(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_instances), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - instance.Instance(), - ], - next_page_token="abc", - ), - appengine.ListInstancesResponse( - instances=[], - next_page_token="def", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - ], - next_page_token="ghi", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_instances(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetInstanceRequest, - dict, - ], -) -def test_get_instance(request_type, transport: str = "grpc"): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_instance), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = instance.Instance( - name="name_value", - id="id_value", - app_engine_release="app_engine_release_value", - availability=instance.Instance.Availability.RESIDENT, - vm_name="vm_name_value", - vm_zone_name="vm_zone_name_value", - vm_id="vm_id_value", - requests=892, - errors=669, - qps=0.34, - average_latency=1578, - memory_usage=1293, - vm_status="vm_status_value", - vm_debug_enabled=True, - vm_ip="vm_ip_value", - vm_liveness=instance.Instance.Liveness.LivenessState.UNKNOWN, - ) - response = client.get_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetInstanceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, instance.Instance) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.app_engine_release == "app_engine_release_value" - assert response.availability == instance.Instance.Availability.RESIDENT - assert response.vm_name == "vm_name_value" - assert response.vm_zone_name == "vm_zone_name_value" - assert response.vm_id == "vm_id_value" - assert response.requests == 892 - assert response.errors == 669 - assert math.isclose(response.qps, 0.34, rel_tol=1e-6) - assert response.average_latency == 1578 - assert response.memory_usage == 1293 - assert response.vm_status == "vm_status_value" - assert response.vm_debug_enabled is True - assert response.vm_ip == "vm_ip_value" - assert response.vm_liveness == instance.Instance.Liveness.LivenessState.UNKNOWN - - -def test_get_instance_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 = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_instance), "__call__") as call: - client.get_instance() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetInstanceRequest() - - -@pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=appengine.GetInstanceRequest -): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_instance), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - instance.Instance( - name="name_value", - id="id_value", - app_engine_release="app_engine_release_value", - availability=instance.Instance.Availability.RESIDENT, - vm_name="vm_name_value", - vm_zone_name="vm_zone_name_value", - vm_id="vm_id_value", - requests=892, - errors=669, - qps=0.34, - average_latency=1578, - memory_usage=1293, - vm_status="vm_status_value", - vm_debug_enabled=True, - vm_ip="vm_ip_value", - vm_liveness=instance.Instance.Liveness.LivenessState.UNKNOWN, - ) - ) - response = await client.get_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetInstanceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, instance.Instance) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.app_engine_release == "app_engine_release_value" - assert response.availability == instance.Instance.Availability.RESIDENT - assert response.vm_name == "vm_name_value" - assert response.vm_zone_name == "vm_zone_name_value" - assert response.vm_id == "vm_id_value" - assert response.requests == 892 - assert response.errors == 669 - assert math.isclose(response.qps, 0.34, rel_tol=1e-6) - assert response.average_latency == 1578 - assert response.memory_usage == 1293 - assert response.vm_status == "vm_status_value" - assert response.vm_debug_enabled is True - assert response.vm_ip == "vm_ip_value" - assert response.vm_liveness == instance.Instance.Liveness.LivenessState.UNKNOWN - - -@pytest.mark.asyncio -async def test_get_instance_async_from_dict(): - await test_get_instance_async(request_type=dict) - - -def test_get_instance_field_headers(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetInstanceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_instance), "__call__") as call: - call.return_value = instance.Instance() - client.get_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_instance_field_headers_async(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetInstanceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_instance), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(instance.Instance()) - await client.get_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteInstanceRequest, - dict, - ], -) -def test_delete_instance(request_type, transport: str = "grpc"): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_instance), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.delete_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteInstanceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_delete_instance_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 = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_instance), "__call__") as call: - client.delete_instance() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteInstanceRequest() - - -@pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteInstanceRequest -): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_instance), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.delete_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteInstanceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_instance_async_from_dict(): - await test_delete_instance_async(request_type=dict) - - -def test_delete_instance_field_headers(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteInstanceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_instance), "__call__") as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.delete_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_instance_field_headers_async(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteInstanceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_instance), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.delete_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DebugInstanceRequest, - dict, - ], -) -def test_debug_instance(request_type, transport: str = "grpc"): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.debug_instance), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.debug_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DebugInstanceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_debug_instance_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 = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.debug_instance), "__call__") as call: - client.debug_instance() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DebugInstanceRequest() - - -@pytest.mark.asyncio -async def test_debug_instance_async( - transport: str = "grpc_asyncio", request_type=appengine.DebugInstanceRequest -): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.debug_instance), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.debug_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DebugInstanceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_debug_instance_async_from_dict(): - await test_debug_instance_async(request_type=dict) - - -def test_debug_instance_field_headers(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DebugInstanceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.debug_instance), "__call__") as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.debug_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_debug_instance_field_headers_async(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DebugInstanceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.debug_instance), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.debug_instance(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListInstancesRequest, - dict, - ], -) -def test_list_instances_rest(request_type): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1/services/sample2/versions/sample3"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.ListInstancesResponse( - next_page_token="next_page_token_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.ListInstancesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_instances(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListInstancesPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_instances_rest_interceptors(null_interceptor): - transport = transports.InstancesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), - ) - client = InstancesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.InstancesRestInterceptor, "post_list_instances" - ) as post, mock.patch.object( - transports.InstancesRestInterceptor, "pre_list_instances" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.ListInstancesRequest.pb(appengine.ListInstancesRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = appengine.ListInstancesResponse.to_json( - appengine.ListInstancesResponse() - ) - - request = appengine.ListInstancesRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.ListInstancesResponse() - - client.list_instances( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_instances_rest_bad_request( - transport: str = "rest", request_type=appengine.ListInstancesRequest -): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1/services/sample2/versions/sample3"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_instances(request) - - -def test_list_instances_rest_pager(transport: str = "rest"): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - instance.Instance(), - ], - next_page_token="abc", - ), - appengine.ListInstancesResponse( - instances=[], - next_page_token="def", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - ], - next_page_token="ghi", - ), - appengine.ListInstancesResponse( - instances=[ - instance.Instance(), - instance.Instance(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple(appengine.ListInstancesResponse.to_json(x) for x in response) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "apps/sample1/services/sample2/versions/sample3"} - - pager = client.list_instances(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, instance.Instance) for i in results) - - pages = list(client.list_instances(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetInstanceRequest, - dict, - ], -) -def test_get_instance_rest(request_type): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = { - "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" - } - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = instance.Instance( - name="name_value", - id="id_value", - app_engine_release="app_engine_release_value", - availability=instance.Instance.Availability.RESIDENT, - vm_name="vm_name_value", - vm_zone_name="vm_zone_name_value", - vm_id="vm_id_value", - requests=892, - errors=669, - qps=0.34, - average_latency=1578, - memory_usage=1293, - vm_status="vm_status_value", - vm_debug_enabled=True, - vm_ip="vm_ip_value", - vm_liveness=instance.Instance.Liveness.LivenessState.UNKNOWN, - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = instance.Instance.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_instance(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, instance.Instance) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.app_engine_release == "app_engine_release_value" - assert response.availability == instance.Instance.Availability.RESIDENT - assert response.vm_name == "vm_name_value" - assert response.vm_zone_name == "vm_zone_name_value" - assert response.vm_id == "vm_id_value" - assert response.requests == 892 - assert response.errors == 669 - assert math.isclose(response.qps, 0.34, rel_tol=1e-6) - assert response.average_latency == 1578 - assert response.memory_usage == 1293 - assert response.vm_status == "vm_status_value" - assert response.vm_debug_enabled is True - assert response.vm_ip == "vm_ip_value" - assert response.vm_liveness == instance.Instance.Liveness.LivenessState.UNKNOWN - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_instance_rest_interceptors(null_interceptor): - transport = transports.InstancesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), - ) - client = InstancesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.InstancesRestInterceptor, "post_get_instance" - ) as post, mock.patch.object( - transports.InstancesRestInterceptor, "pre_get_instance" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.GetInstanceRequest.pb(appengine.GetInstanceRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = instance.Instance.to_json(instance.Instance()) - - request = appengine.GetInstanceRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = instance.Instance() - - client.get_instance( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_instance_rest_bad_request( - transport: str = "rest", request_type=appengine.GetInstanceRequest -): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = { - "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" - } - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_instance(request) - - -def test_get_instance_rest_error(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteInstanceRequest, - dict, - ], -) -def test_delete_instance_rest(request_type): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = { - "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" - } - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.delete_instance(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_instance_rest_interceptors(null_interceptor): - transport = transports.InstancesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), - ) - client = InstancesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.InstancesRestInterceptor, "post_delete_instance" - ) as post, mock.patch.object( - transports.InstancesRestInterceptor, "pre_delete_instance" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.DeleteInstanceRequest.pb( - appengine.DeleteInstanceRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.DeleteInstanceRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.delete_instance( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_delete_instance_rest_bad_request( - transport: str = "rest", request_type=appengine.DeleteInstanceRequest -): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = { - "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" - } - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_instance(request) - - -def test_delete_instance_rest_error(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DebugInstanceRequest, - dict, - ], -) -def test_debug_instance_rest(request_type): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = { - "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" - } - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.debug_instance(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_debug_instance_rest_interceptors(null_interceptor): - transport = transports.InstancesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.InstancesRestInterceptor(), - ) - client = InstancesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.InstancesRestInterceptor, "post_debug_instance" - ) as post, mock.patch.object( - transports.InstancesRestInterceptor, "pre_debug_instance" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.DebugInstanceRequest.pb(appengine.DebugInstanceRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.DebugInstanceRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.debug_instance( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_debug_instance_rest_bad_request( - transport: str = "rest", request_type=appengine.DebugInstanceRequest -): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = { - "name": "apps/sample1/services/sample2/versions/sample3/instances/sample4" - } - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.debug_instance(request) - - -def test_debug_instance_rest_error(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.InstancesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.InstancesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = InstancesClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.InstancesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = InstancesClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = InstancesClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.InstancesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = InstancesClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.InstancesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = InstancesClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.InstancesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.InstancesGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.InstancesGrpcTransport, - transports.InstancesGrpcAsyncIOTransport, - transports.InstancesRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = InstancesClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.InstancesGrpcTransport, - ) - - -def test_instances_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.InstancesTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_instances_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.instances.transports.InstancesTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.InstancesTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - "list_instances", - "get_instance", - "delete_instance", - "debug_instance", - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_instances_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.instances.transports.InstancesTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.InstancesTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_instances_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.instances.transports.InstancesTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.InstancesTransport() - adc.assert_called_once() - - -def test_instances_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - InstancesClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.InstancesGrpcTransport, - transports.InstancesGrpcAsyncIOTransport, - ], -) -def test_instances_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.InstancesGrpcTransport, - transports.InstancesGrpcAsyncIOTransport, - transports.InstancesRestTransport, - ], -) -def test_instances_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.InstancesGrpcTransport, grpc_helpers), - (transports.InstancesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_instances_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [transports.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport], -) -def test_instances_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = ga_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=None, - 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_instances_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.InstancesRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -def test_instances_rest_lro_client(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.AbstractOperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_instances_host_no_port(transport_name): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_instances_host_with_port(transport_name): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_instances_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = InstancesClient( - credentials=creds1, - transport=transport_name, - ) - client2 = InstancesClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_instances._session - session2 = client2.transport.list_instances._session - assert session1 != session2 - session1 = client1.transport.get_instance._session - session2 = client2.transport.get_instance._session - assert session1 != session2 - session1 = client1.transport.delete_instance._session - session2 = client2.transport.delete_instance._session - assert session1 != session2 - session1 = client1.transport.debug_instance._session - session2 = client2.transport.debug_instance._session - assert session1 != session2 - - -def test_instances_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.InstancesGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_instances_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.InstancesGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport], -) -def test_instances_transport_channel_mtls_with_client_cert_source(transport_class): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport], -) -def test_instances_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_instances_grpc_lro_client(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_instances_grpc_lro_async_client(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_instance_path(): - app = "squid" - service = "clam" - version = "whelk" - instance = "octopus" - expected = ( - "apps/{app}/services/{service}/versions/{version}/instances/{instance}".format( - app=app, - service=service, - version=version, - instance=instance, - ) - ) - actual = InstancesClient.instance_path(app, service, version, instance) - assert expected == actual - - -def test_parse_instance_path(): - expected = { - "app": "oyster", - "service": "nudibranch", - "version": "cuttlefish", - "instance": "mussel", - } - path = InstancesClient.instance_path(**expected) - - # Check that the path construction is reversible. - actual = InstancesClient.parse_instance_path(path) - assert expected == actual - - -def test_common_billing_account_path(): - billing_account = "winkle" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = InstancesClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "nautilus", - } - path = InstancesClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = InstancesClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "scallop" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = InstancesClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "abalone", - } - path = InstancesClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = InstancesClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "squid" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = InstancesClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "clam", - } - path = InstancesClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = InstancesClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "whelk" - expected = "projects/{project}".format( - project=project, - ) - actual = InstancesClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "octopus", - } - path = InstancesClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = InstancesClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "oyster" - location = "nudibranch" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = InstancesClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "cuttlefish", - "location": "mussel", - } - path = InstancesClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = InstancesClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.InstancesTransport, "_prep_wrapped_messages" - ) as prep: - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.InstancesTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = InstancesClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (InstancesClient, transports.InstancesGrpcTransport), - (InstancesAsyncClient, transports.InstancesGrpcAsyncIOTransport), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py deleted file mode 100644 index 6b4b665..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ /dev/null @@ -1,2888 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import ( - future, - gapic_v1, - grpc_helpers, - grpc_helpers_async, - operation, - operations_v1, - path_template, -) -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -from google.api_core import operation_async # type: ignore -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import json_format -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.services import ( - ServicesAsyncClient, - ServicesClient, - pagers, - transports, -) -from google.cloud.appengine_admin_v1.types import appengine, network_settings -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import service - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert ServicesClient._get_default_mtls_endpoint(None) is None - assert ServicesClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert ( - ServicesClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - ServicesClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - ServicesClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert ServicesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (ServicesClient, "grpc"), - (ServicesAsyncClient, "grpc_asyncio"), - (ServicesClient, "rest"), - ], -) -def test_services_client_from_service_account_info(client_class, transport_name): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.ServicesGrpcTransport, "grpc"), - (transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.ServicesRestTransport, "rest"), - ], -) -def test_services_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (ServicesClient, "grpc"), - (ServicesAsyncClient, "grpc_asyncio"), - (ServicesClient, "rest"), - ], -) -def test_services_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_services_client_get_transport_class(): - transport = ServicesClient.get_transport_class() - available_transports = [ - transports.ServicesGrpcTransport, - transports.ServicesRestTransport, - ] - assert transport in available_transports - - transport = ServicesClient.get_transport_class("grpc") - assert transport == transports.ServicesGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (ServicesClient, transports.ServicesGrpcTransport, "grpc"), - (ServicesAsyncClient, transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), - (ServicesClient, transports.ServicesRestTransport, "rest"), - ], -) -@mock.patch.object( - ServicesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ServicesClient) -) -@mock.patch.object( - ServicesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(ServicesAsyncClient), -) -def test_services_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(ServicesClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(ServicesClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - (ServicesClient, transports.ServicesGrpcTransport, "grpc", "true"), - ( - ServicesAsyncClient, - transports.ServicesGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - (ServicesClient, transports.ServicesGrpcTransport, "grpc", "false"), - ( - ServicesAsyncClient, - transports.ServicesGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - (ServicesClient, transports.ServicesRestTransport, "rest", "true"), - (ServicesClient, transports.ServicesRestTransport, "rest", "false"), - ], -) -@mock.patch.object( - ServicesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ServicesClient) -) -@mock.patch.object( - ServicesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(ServicesAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_services_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient]) -@mock.patch.object( - ServicesClient, "DEFAULT_ENDPOINT", modify_default_endpoint(ServicesClient) -) -@mock.patch.object( - ServicesAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(ServicesAsyncClient), -) -def test_services_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (ServicesClient, transports.ServicesGrpcTransport, "grpc"), - (ServicesAsyncClient, transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), - (ServicesClient, transports.ServicesRestTransport, "rest"), - ], -) -def test_services_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (ServicesClient, transports.ServicesGrpcTransport, "grpc", grpc_helpers), - ( - ServicesAsyncClient, - transports.ServicesGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - (ServicesClient, transports.ServicesRestTransport, "rest", None), - ], -) -def test_services_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_services_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.services.transports.ServicesGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = ServicesClient(client_options={"api_endpoint": "squid.clam.whelk"}) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (ServicesClient, transports.ServicesGrpcTransport, "grpc", grpc_helpers), - ( - ServicesAsyncClient, - transports.ServicesGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_services_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListServicesRequest, - dict, - ], -) -def test_list_services(request_type, transport: str = "grpc"): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_services), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.ListServicesResponse( - next_page_token="next_page_token_value", - ) - response = client.list_services(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListServicesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListServicesPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_services_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 = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_services), "__call__") as call: - client.list_services() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListServicesRequest() - - -@pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=appengine.ListServicesRequest -): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_services), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListServicesResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_services(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListServicesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListServicesAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - -def test_list_services_field_headers(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListServicesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_services), "__call__") as call: - call.return_value = appengine.ListServicesResponse() - client.list_services(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_services_field_headers_async(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListServicesRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_services), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListServicesResponse() - ) - await client.list_services(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_services_pager(transport_name: str = "grpc"): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_services), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - service.Service(), - ], - next_page_token="abc", - ), - appengine.ListServicesResponse( - services=[], - next_page_token="def", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - ], - next_page_token="ghi", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_services(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, service.Service) for i in results) - - -def test_list_services_pages(transport_name: str = "grpc"): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_services), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - service.Service(), - ], - next_page_token="abc", - ), - appengine.ListServicesResponse( - services=[], - next_page_token="def", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - ], - next_page_token="ghi", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - ], - ), - RuntimeError, - ) - pages = list(client.list_services(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_services_async_pager(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_services), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - service.Service(), - ], - next_page_token="abc", - ), - appengine.ListServicesResponse( - services=[], - next_page_token="def", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - ], - next_page_token="ghi", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_services( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, service.Service) for i in responses) - - -@pytest.mark.asyncio -async def test_list_services_async_pages(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_services), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - service.Service(), - ], - next_page_token="abc", - ), - appengine.ListServicesResponse( - services=[], - next_page_token="def", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - ], - next_page_token="ghi", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_services(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetServiceRequest, - dict, - ], -) -def test_get_service(request_type, transport: str = "grpc"): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_service), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = service.Service( - name="name_value", - id="id_value", - ) - response = client.get_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.Service) - assert response.name == "name_value" - assert response.id == "id_value" - - -def test_get_service_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 = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_service), "__call__") as call: - client.get_service() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetServiceRequest() - - -@pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=appengine.GetServiceRequest -): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_service), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.Service( - name="name_value", - id="id_value", - ) - ) - response = await client.get_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.Service) - assert response.name == "name_value" - assert response.id == "id_value" - - -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - -def test_get_service_field_headers(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetServiceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_service), "__call__") as call: - call.return_value = service.Service() - client.get_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_service_field_headers_async(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetServiceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_service), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.Service()) - await client.get_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateServiceRequest, - dict, - ], -) -def test_update_service(request_type, transport: str = "grpc"): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_service), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_update_service_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 = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_service), "__call__") as call: - client.update_service() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateServiceRequest() - - -@pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateServiceRequest -): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_service), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.update_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - -def test_update_service_field_headers(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateServiceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_service), "__call__") as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.update_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_service_field_headers_async(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateServiceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_service), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.update_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteServiceRequest, - dict, - ], -) -def test_delete_service(request_type, transport: str = "grpc"): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_service), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.delete_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_delete_service_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 = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_service), "__call__") as call: - client.delete_service() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteServiceRequest() - - -@pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteServiceRequest -): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_service), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.delete_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - -def test_delete_service_field_headers(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteServiceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_service), "__call__") as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.delete_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_service_field_headers_async(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteServiceRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_service), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.delete_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListServicesRequest, - dict, - ], -) -def test_list_services_rest(request_type): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.ListServicesResponse( - next_page_token="next_page_token_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.ListServicesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_services(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListServicesPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_services_rest_interceptors(null_interceptor): - transport = transports.ServicesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), - ) - client = ServicesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.ServicesRestInterceptor, "post_list_services" - ) as post, mock.patch.object( - transports.ServicesRestInterceptor, "pre_list_services" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.ListServicesRequest.pb(appengine.ListServicesRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = appengine.ListServicesResponse.to_json( - appengine.ListServicesResponse() - ) - - request = appengine.ListServicesRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.ListServicesResponse() - - client.list_services( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_services_rest_bad_request( - transport: str = "rest", request_type=appengine.ListServicesRequest -): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_services(request) - - -def test_list_services_rest_pager(transport: str = "rest"): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - service.Service(), - ], - next_page_token="abc", - ), - appengine.ListServicesResponse( - services=[], - next_page_token="def", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - ], - next_page_token="ghi", - ), - appengine.ListServicesResponse( - services=[ - service.Service(), - service.Service(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple(appengine.ListServicesResponse.to_json(x) for x in response) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "apps/sample1"} - - pager = client.list_services(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, service.Service) for i in results) - - pages = list(client.list_services(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetServiceRequest, - dict, - ], -) -def test_get_service_rest(request_type): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = service.Service( - name="name_value", - id="id_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = service.Service.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_service(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, service.Service) - assert response.name == "name_value" - assert response.id == "id_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_service_rest_interceptors(null_interceptor): - transport = transports.ServicesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), - ) - client = ServicesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.ServicesRestInterceptor, "post_get_service" - ) as post, mock.patch.object( - transports.ServicesRestInterceptor, "pre_get_service" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.GetServiceRequest.pb(appengine.GetServiceRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = service.Service.to_json(service.Service()) - - request = appengine.GetServiceRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = service.Service() - - client.get_service( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_service_rest_bad_request( - transport: str = "rest", request_type=appengine.GetServiceRequest -): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_service(request) - - -def test_get_service_rest_error(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateServiceRequest, - dict, - ], -) -def test_update_service_rest(request_type): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2"} - request_init["service"] = { - "name": "name_value", - "id": "id_value", - "split": {"shard_by": 1, "allocations": {}}, - "labels": {}, - "network_settings": {"ingress_traffic_allowed": 1}, - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.UpdateServiceRequest.meta.fields["service"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["service"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["service"][field])): - del request_init["service"][field][i][subfield] - else: - del request_init["service"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.update_service(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_service_rest_interceptors(null_interceptor): - transport = transports.ServicesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), - ) - client = ServicesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.ServicesRestInterceptor, "post_update_service" - ) as post, mock.patch.object( - transports.ServicesRestInterceptor, "pre_update_service" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.UpdateServiceRequest.pb(appengine.UpdateServiceRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.UpdateServiceRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.update_service( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_service_rest_bad_request( - transport: str = "rest", request_type=appengine.UpdateServiceRequest -): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.update_service(request) - - -def test_update_service_rest_error(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteServiceRequest, - dict, - ], -) -def test_delete_service_rest(request_type): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.delete_service(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_service_rest_interceptors(null_interceptor): - transport = transports.ServicesRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), - ) - client = ServicesClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.ServicesRestInterceptor, "post_delete_service" - ) as post, mock.patch.object( - transports.ServicesRestInterceptor, "pre_delete_service" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.DeleteServiceRequest.pb(appengine.DeleteServiceRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.DeleteServiceRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.delete_service( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_delete_service_rest_bad_request( - transport: str = "rest", request_type=appengine.DeleteServiceRequest -): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_service(request) - - -def test_delete_service_rest_error(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.ServicesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.ServicesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ServicesClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.ServicesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ServicesClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = ServicesClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.ServicesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = ServicesClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.ServicesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = ServicesClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.ServicesGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.ServicesGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.ServicesGrpcTransport, - transports.ServicesGrpcAsyncIOTransport, - transports.ServicesRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = ServicesClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.ServicesGrpcTransport, - ) - - -def test_services_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.ServicesTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_services_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.services.transports.ServicesTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.ServicesTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - "list_services", - "get_service", - "update_service", - "delete_service", - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_services_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.services.transports.ServicesTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ServicesTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_services_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.services.transports.ServicesTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ServicesTransport() - adc.assert_called_once() - - -def test_services_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - ServicesClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.ServicesGrpcTransport, - transports.ServicesGrpcAsyncIOTransport, - ], -) -def test_services_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.ServicesGrpcTransport, - transports.ServicesGrpcAsyncIOTransport, - transports.ServicesRestTransport, - ], -) -def test_services_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.ServicesGrpcTransport, grpc_helpers), - (transports.ServicesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_services_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport], -) -def test_services_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = ga_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=None, - 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_services_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.ServicesRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -def test_services_rest_lro_client(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.AbstractOperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_services_host_no_port(transport_name): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_services_host_with_port(transport_name): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_services_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = ServicesClient( - credentials=creds1, - transport=transport_name, - ) - client2 = ServicesClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_services._session - session2 = client2.transport.list_services._session - assert session1 != session2 - session1 = client1.transport.get_service._session - session2 = client2.transport.get_service._session - assert session1 != session2 - session1 = client1.transport.update_service._session - session2 = client2.transport.update_service._session - assert session1 != session2 - session1 = client1.transport.delete_service._session - session2 = client2.transport.delete_service._session - assert session1 != session2 - - -def test_services_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ServicesGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_services_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.ServicesGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport], -) -def test_services_transport_channel_mtls_with_client_cert_source(transport_class): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport], -) -def test_services_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_services_grpc_lro_client(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_services_grpc_lro_async_client(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = ServicesClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = ServicesClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = ServicesClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = ServicesClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = ServicesClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = ServicesClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = ServicesClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = ServicesClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = ServicesClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format( - project=project, - ) - actual = ServicesClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = ServicesClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = ServicesClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = ServicesClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = ServicesClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = ServicesClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.ServicesTransport, "_prep_wrapped_messages" - ) as prep: - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.ServicesTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = ServicesClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (ServicesClient, transports.ServicesGrpcTransport), - (ServicesAsyncClient, transports.ServicesGrpcAsyncIOTransport), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py deleted file mode 100644 index 131e505..0000000 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ /dev/null @@ -1,3652 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os - -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -from collections.abc import Iterable -import json -import math - -from google.api_core import ( - future, - gapic_v1, - grpc_helpers, - grpc_helpers_async, - operation, - operations_v1, - path_template, -) -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -from google.api_core import operation_async # type: ignore -import google.auth -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.longrunning import operations_pb2 # type: ignore -from google.oauth2 import service_account -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import json_format -from google.protobuf import timestamp_pb2 # type: ignore -import grpc -from grpc.experimental import aio -from proto.marshal.rules import wrappers -from proto.marshal.rules.dates import DurationRule, TimestampRule -import pytest -from requests import PreparedRequest, Request, Response -from requests.sessions import Session - -from google.cloud.appengine_admin_v1.services.versions import ( - VersionsAsyncClient, - VersionsClient, - pagers, - transports, -) -from google.cloud.appengine_admin_v1.types import app_yaml, appengine, deploy -from google.cloud.appengine_admin_v1.types import operation as ga_operation -from google.cloud.appengine_admin_v1.types import version - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return ( - "foo.googleapis.com" - if ("localhost" in client.DEFAULT_ENDPOINT) - else client.DEFAULT_ENDPOINT - ) - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert VersionsClient._get_default_mtls_endpoint(None) is None - assert VersionsClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert ( - VersionsClient._get_default_mtls_endpoint(api_mtls_endpoint) - == api_mtls_endpoint - ) - assert ( - VersionsClient._get_default_mtls_endpoint(sandbox_endpoint) - == sandbox_mtls_endpoint - ) - assert ( - VersionsClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) - == sandbox_mtls_endpoint - ) - assert VersionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (VersionsClient, "grpc"), - (VersionsAsyncClient, "grpc_asyncio"), - (VersionsClient, "rest"), - ], -) -def test_versions_client_from_service_account_info(client_class, transport_name): - creds = ga_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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_class,transport_name", - [ - (transports.VersionsGrpcTransport, "grpc"), - (transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), - (transports.VersionsRestTransport, "rest"), - ], -) -def test_versions_client_service_account_always_use_jwt( - transport_class, transport_name -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize( - "client_class,transport_name", - [ - (VersionsClient, "grpc"), - (VersionsAsyncClient, "grpc_asyncio"), - (VersionsClient, "rest"), - ], -) -def test_versions_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_file" - ) as factory: - factory.return_value = creds - client = client_class.from_service_account_file( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json( - "dummy/file/path.json", transport=transport_name - ) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -def test_versions_client_get_transport_class(): - transport = VersionsClient.get_transport_class() - available_transports = [ - transports.VersionsGrpcTransport, - transports.VersionsRestTransport, - ] - assert transport in available_transports - - transport = VersionsClient.get_transport_class("grpc") - assert transport == transports.VersionsGrpcTransport - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (VersionsClient, transports.VersionsGrpcTransport, "grpc"), - (VersionsAsyncClient, transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), - (VersionsClient, transports.VersionsRestTransport, "rest"), - ], -) -@mock.patch.object( - VersionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(VersionsClient) -) -@mock.patch.object( - VersionsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(VersionsAsyncClient), -) -def test_versions_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(VersionsClient, "get_transport_class") as gtc: - transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(VersionsClient, "get_transport_class") as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} - ): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions( - api_audience="https://language.googleapis.com" - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com", - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,use_client_cert_env", - [ - (VersionsClient, transports.VersionsGrpcTransport, "grpc", "true"), - ( - VersionsAsyncClient, - transports.VersionsGrpcAsyncIOTransport, - "grpc_asyncio", - "true", - ), - (VersionsClient, transports.VersionsGrpcTransport, "grpc", "false"), - ( - VersionsAsyncClient, - transports.VersionsGrpcAsyncIOTransport, - "grpc_asyncio", - "false", - ), - (VersionsClient, transports.VersionsRestTransport, "rest", "true"), - (VersionsClient, transports.VersionsRestTransport, "rest", "false"), - ], -) -@mock.patch.object( - VersionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(VersionsClient) -) -@mock.patch.object( - VersionsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(VersionsAsyncClient), -) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_versions_client_mtls_env_auto( - client_class, transport_class, transport_name, use_client_cert_env -): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - options = client_options.ClientOptions( - client_cert_source=client_cert_source_callback - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - 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, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - 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=True, - ): - with mock.patch( - "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 - - patched.return_value = None - client = client_class(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - # 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(transport=transport_name) - 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, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient]) -@mock.patch.object( - VersionsClient, "DEFAULT_ENDPOINT", modify_default_endpoint(VersionsClient) -) -@mock.patch.object( - VersionsAsyncClient, - "DEFAULT_ENDPOINT", - modify_default_endpoint(VersionsAsyncClient), -) -def test_versions_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions( - client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint - ) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( - options - ) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=False, - ): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch( - "google.auth.transport.mtls.has_default_client_cert_source", - return_value=True, - ): - with mock.patch( - "google.auth.transport.mtls.default_client_cert_source", - return_value=mock_client_cert_source, - ): - ( - api_endpoint, - cert_source, - ) = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name", - [ - (VersionsClient, transports.VersionsGrpcTransport, "grpc"), - (VersionsAsyncClient, transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), - (VersionsClient, transports.VersionsRestTransport, "rest"), - ], -) -def test_versions_client_client_options_scopes( - client_class, transport_class, transport_name -): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (VersionsClient, transports.VersionsGrpcTransport, "grpc", grpc_helpers), - ( - VersionsAsyncClient, - transports.VersionsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - (VersionsClient, transports.VersionsRestTransport, "rest", None), - ], -) -def test_versions_client_client_options_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -def test_versions_client_client_options_from_dict(): - with mock.patch( - "google.cloud.appengine_admin_v1.services.versions.transports.VersionsGrpcTransport.__init__" - ) as grpc_transport: - grpc_transport.return_value = None - client = VersionsClient(client_options={"api_endpoint": "squid.clam.whelk"}) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize( - "client_class,transport_class,transport_name,grpc_helpers", - [ - (VersionsClient, transports.VersionsGrpcTransport, "grpc", grpc_helpers), - ( - VersionsAsyncClient, - transports.VersionsGrpcAsyncIOTransport, - "grpc_asyncio", - grpc_helpers_async, - ), - ], -) -def test_versions_client_create_channel_credentials_file( - client_class, transport_class, transport_name, grpc_helpers -): - # Check the case credentials file is provided. - options = client_options.ClientOptions(credentials_file="credentials.json") - - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=None, - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListVersionsRequest, - dict, - ], -) -def test_list_versions(request_type, transport: str = "grpc"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_versions), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = appengine.ListVersionsResponse( - next_page_token="next_page_token_value", - ) - response = client.list_versions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListVersionsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListVersionsPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_versions_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 = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_versions), "__call__") as call: - client.list_versions() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListVersionsRequest() - - -@pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=appengine.ListVersionsRequest -): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_versions), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListVersionsResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_versions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListVersionsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListVersionsAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - -def test_list_versions_field_headers(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListVersionsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_versions), "__call__") as call: - call.return_value = appengine.ListVersionsResponse() - client.list_versions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_versions_field_headers_async(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.ListVersionsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_versions), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - appengine.ListVersionsResponse() - ) - await client.list_versions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_versions_pager(transport_name: str = "grpc"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_versions), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - version.Version(), - ], - next_page_token="abc", - ), - appengine.ListVersionsResponse( - versions=[], - next_page_token="def", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - ], - next_page_token="ghi", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_versions(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, version.Version) for i in results) - - -def test_list_versions_pages(transport_name: str = "grpc"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_versions), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - version.Version(), - ], - next_page_token="abc", - ), - appengine.ListVersionsResponse( - versions=[], - next_page_token="def", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - ], - next_page_token="ghi", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - ], - ), - RuntimeError, - ) - pages = list(client.list_versions(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_versions_async_pager(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_versions), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - version.Version(), - ], - next_page_token="abc", - ), - appengine.ListVersionsResponse( - versions=[], - next_page_token="def", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - ], - next_page_token="ghi", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_versions( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, version.Version) for i in responses) - - -@pytest.mark.asyncio -async def test_list_versions_async_pages(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_versions), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - version.Version(), - ], - next_page_token="abc", - ), - appengine.ListVersionsResponse( - versions=[], - next_page_token="def", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - ], - next_page_token="ghi", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_versions(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetVersionRequest, - dict, - ], -) -def test_get_version(request_type, transport: str = "grpc"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = version.Version( - name="name_value", - id="id_value", - inbound_services=[version.InboundServiceType.INBOUND_SERVICE_MAIL], - instance_class="instance_class_value", - zones=["zones_value"], - runtime="runtime_value", - runtime_channel="runtime_channel_value", - threadsafe=True, - vm=True, - app_engine_apis=True, - env="env_value", - serving_status=version.ServingStatus.SERVING, - created_by="created_by_value", - disk_usage_bytes=1701, - runtime_api_version="runtime_api_version_value", - runtime_main_executable_path="runtime_main_executable_path_value", - service_account="service_account_value", - nobuild_files_regex="nobuild_files_regex_value", - version_url="version_url_value", - ) - response = client.get_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, version.Version) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.inbound_services == [ - version.InboundServiceType.INBOUND_SERVICE_MAIL - ] - assert response.instance_class == "instance_class_value" - assert response.zones == ["zones_value"] - assert response.runtime == "runtime_value" - assert response.runtime_channel == "runtime_channel_value" - assert response.threadsafe is True - assert response.vm is True - assert response.app_engine_apis is True - assert response.env == "env_value" - assert response.serving_status == version.ServingStatus.SERVING - assert response.created_by == "created_by_value" - assert response.disk_usage_bytes == 1701 - assert response.runtime_api_version == "runtime_api_version_value" - assert response.runtime_main_executable_path == "runtime_main_executable_path_value" - assert response.service_account == "service_account_value" - assert response.nobuild_files_regex == "nobuild_files_regex_value" - assert response.version_url == "version_url_value" - - -def test_get_version_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 = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_version), "__call__") as call: - client.get_version() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetVersionRequest() - - -@pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=appengine.GetVersionRequest -): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - version.Version( - name="name_value", - id="id_value", - inbound_services=[version.InboundServiceType.INBOUND_SERVICE_MAIL], - instance_class="instance_class_value", - zones=["zones_value"], - runtime="runtime_value", - runtime_channel="runtime_channel_value", - threadsafe=True, - vm=True, - app_engine_apis=True, - env="env_value", - serving_status=version.ServingStatus.SERVING, - created_by="created_by_value", - disk_usage_bytes=1701, - runtime_api_version="runtime_api_version_value", - runtime_main_executable_path="runtime_main_executable_path_value", - service_account="service_account_value", - nobuild_files_regex="nobuild_files_regex_value", - version_url="version_url_value", - ) - ) - response = await client.get_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, version.Version) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.inbound_services == [ - version.InboundServiceType.INBOUND_SERVICE_MAIL - ] - assert response.instance_class == "instance_class_value" - assert response.zones == ["zones_value"] - assert response.runtime == "runtime_value" - assert response.runtime_channel == "runtime_channel_value" - assert response.threadsafe is True - assert response.vm is True - assert response.app_engine_apis is True - assert response.env == "env_value" - assert response.serving_status == version.ServingStatus.SERVING - assert response.created_by == "created_by_value" - assert response.disk_usage_bytes == 1701 - assert response.runtime_api_version == "runtime_api_version_value" - assert response.runtime_main_executable_path == "runtime_main_executable_path_value" - assert response.service_account == "service_account_value" - assert response.nobuild_files_regex == "nobuild_files_regex_value" - assert response.version_url == "version_url_value" - - -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - -def test_get_version_field_headers(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetVersionRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_version), "__call__") as call: - call.return_value = version.Version() - client.get_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_version_field_headers_async(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.GetVersionRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_version), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(version.Version()) - await client.get_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateVersionRequest, - dict, - ], -) -def test_create_version(request_type, transport: str = "grpc"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.create_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_version_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 = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_version), "__call__") as call: - client.create_version() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateVersionRequest() - - -@pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateVersionRequest -): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.create_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - -def test_create_version_field_headers(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateVersionRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_version), "__call__") as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.create_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_create_version_field_headers_async(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.CreateVersionRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_version), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.create_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateVersionRequest, - dict, - ], -) -def test_update_version(request_type, transport: str = "grpc"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.update_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_update_version_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 = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_version), "__call__") as call: - client.update_version() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateVersionRequest() - - -@pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateVersionRequest -): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.update_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - -def test_update_version_field_headers(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateVersionRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_version), "__call__") as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.update_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_version_field_headers_async(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.UpdateVersionRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_version), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.update_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteVersionRequest, - dict, - ], -) -def test_delete_version(request_type, transport: str = "grpc"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name="operations/spam") - response = client.delete_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_delete_version_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 = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_version), "__call__") as call: - client.delete_version() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteVersionRequest() - - -@pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteVersionRequest -): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_version), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/spam") - ) - response = await client.delete_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteVersionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - -def test_delete_version_field_headers(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteVersionRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_version), "__call__") as call: - call.return_value = operations_pb2.Operation(name="operations/op") - client.delete_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_version_field_headers_async(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = appengine.DeleteVersionRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_version), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name="operations/op") - ) - await client.delete_version(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.ListVersionsRequest, - dict, - ], -) -def test_list_versions_rest(request_type): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = appengine.ListVersionsResponse( - next_page_token="next_page_token_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = appengine.ListVersionsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_versions(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListVersionsPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_versions_rest_interceptors(null_interceptor): - transport = transports.VersionsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), - ) - client = VersionsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.VersionsRestInterceptor, "post_list_versions" - ) as post, mock.patch.object( - transports.VersionsRestInterceptor, "pre_list_versions" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.ListVersionsRequest.pb(appengine.ListVersionsRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = appengine.ListVersionsResponse.to_json( - appengine.ListVersionsResponse() - ) - - request = appengine.ListVersionsRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = appengine.ListVersionsResponse() - - client.list_versions( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_versions_rest_bad_request( - transport: str = "rest", request_type=appengine.ListVersionsRequest -): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_versions(request) - - -def test_list_versions_rest_pager(transport: str = "rest"): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - version.Version(), - ], - next_page_token="abc", - ), - appengine.ListVersionsResponse( - versions=[], - next_page_token="def", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - ], - next_page_token="ghi", - ), - appengine.ListVersionsResponse( - versions=[ - version.Version(), - version.Version(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple(appengine.ListVersionsResponse.to_json(x) for x in response) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "apps/sample1/services/sample2"} - - pager = client.list_versions(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, version.Version) for i in results) - - pages = list(client.list_versions(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.GetVersionRequest, - dict, - ], -) -def test_get_version_rest(request_type): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = version.Version( - name="name_value", - id="id_value", - inbound_services=[version.InboundServiceType.INBOUND_SERVICE_MAIL], - instance_class="instance_class_value", - zones=["zones_value"], - runtime="runtime_value", - runtime_channel="runtime_channel_value", - threadsafe=True, - vm=True, - app_engine_apis=True, - env="env_value", - serving_status=version.ServingStatus.SERVING, - created_by="created_by_value", - disk_usage_bytes=1701, - runtime_api_version="runtime_api_version_value", - runtime_main_executable_path="runtime_main_executable_path_value", - service_account="service_account_value", - nobuild_files_regex="nobuild_files_regex_value", - version_url="version_url_value", - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - # Convert return value to protobuf type - return_value = version.Version.pb(return_value) - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_version(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, version.Version) - assert response.name == "name_value" - assert response.id == "id_value" - assert response.inbound_services == [ - version.InboundServiceType.INBOUND_SERVICE_MAIL - ] - assert response.instance_class == "instance_class_value" - assert response.zones == ["zones_value"] - assert response.runtime == "runtime_value" - assert response.runtime_channel == "runtime_channel_value" - assert response.threadsafe is True - assert response.vm is True - assert response.app_engine_apis is True - assert response.env == "env_value" - assert response.serving_status == version.ServingStatus.SERVING - assert response.created_by == "created_by_value" - assert response.disk_usage_bytes == 1701 - assert response.runtime_api_version == "runtime_api_version_value" - assert response.runtime_main_executable_path == "runtime_main_executable_path_value" - assert response.service_account == "service_account_value" - assert response.nobuild_files_regex == "nobuild_files_regex_value" - assert response.version_url == "version_url_value" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_version_rest_interceptors(null_interceptor): - transport = transports.VersionsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), - ) - client = VersionsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.VersionsRestInterceptor, "post_get_version" - ) as post, mock.patch.object( - transports.VersionsRestInterceptor, "pre_get_version" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.GetVersionRequest.pb(appengine.GetVersionRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = version.Version.to_json(version.Version()) - - request = appengine.GetVersionRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = version.Version() - - client.get_version( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_get_version_rest_bad_request( - transport: str = "rest", request_type=appengine.GetVersionRequest -): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_version(request) - - -def test_get_version_rest_error(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.CreateVersionRequest, - dict, - ], -) -def test_create_version_rest(request_type): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1/services/sample2"} - request_init["version"] = { - "name": "name_value", - "id": "id_value", - "automatic_scaling": { - "cool_down_period": {"seconds": 751, "nanos": 543}, - "cpu_utilization": { - "aggregation_window_length": {}, - "target_utilization": 0.19540000000000002, - }, - "max_concurrent_requests": 2499, - "max_idle_instances": 1898, - "max_total_instances": 2032, - "max_pending_latency": {}, - "min_idle_instances": 1896, - "min_total_instances": 2030, - "min_pending_latency": {}, - "request_utilization": { - "target_request_count_per_second": 3320, - "target_concurrent_requests": 2820, - }, - "disk_utilization": { - "target_write_bytes_per_second": 3096, - "target_write_ops_per_second": 2883, - "target_read_bytes_per_second": 2953, - "target_read_ops_per_second": 2740, - }, - "network_utilization": { - "target_sent_bytes_per_second": 2983, - "target_sent_packets_per_second": 3179, - "target_received_bytes_per_second": 3380, - "target_received_packets_per_second": 3576, - }, - "standard_scheduler_settings": { - "target_cpu_utilization": 0.23770000000000002, - "target_throughput_utilization": 0.3163, - "min_instances": 1387, - "max_instances": 1389, - }, - }, - "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, - "manual_scaling": {"instances": 968}, - "inbound_services": [1], - "instance_class": "instance_class_value", - "network": { - "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], - "instance_tag": "instance_tag_value", - "name": "name_value", - "subnetwork_name": "subnetwork_name_value", - "session_affinity": True, - }, - "zones": ["zones_value1", "zones_value2"], - "resources": { - "cpu": 0.328, - "disk_gb": 0.723, - "memory_gb": 0.961, - "volumes": [ - { - "name": "name_value", - "volume_type": "volume_type_value", - "size_gb": 0.739, - } - ], - "kms_key_reference": "kms_key_reference_value", - }, - "runtime": "runtime_value", - "runtime_channel": "runtime_channel_value", - "threadsafe": True, - "vm": True, - "app_engine_apis": True, - "beta_settings": {}, - "env": "env_value", - "serving_status": 1, - "created_by": "created_by_value", - "create_time": {"seconds": 751, "nanos": 543}, - "disk_usage_bytes": 1701, - "runtime_api_version": "runtime_api_version_value", - "runtime_main_executable_path": "runtime_main_executable_path_value", - "service_account": "service_account_value", - "handlers": [ - { - "url_regex": "url_regex_value", - "static_files": { - "path": "path_value", - "upload_path_regex": "upload_path_regex_value", - "http_headers": {}, - "mime_type": "mime_type_value", - "expiration": {}, - "require_matching_file": True, - "application_readable": True, - }, - "script": {"script_path": "script_path_value"}, - "api_endpoint": {"script_path": "script_path_value"}, - "security_level": 1, - "login": 1, - "auth_fail_action": 1, - "redirect_http_response_code": 1, - } - ], - "error_handlers": [ - { - "error_code": 1, - "static_file": "static_file_value", - "mime_type": "mime_type_value", - } - ], - "libraries": [{"name": "name_value", "version": "version_value"}], - "api_config": { - "auth_fail_action": 1, - "login": 1, - "script": "script_value", - "security_level": 1, - "url": "url_value", - }, - "env_variables": {}, - "build_env_variables": {}, - "default_expiration": {}, - "health_check": { - "disable_health_check": True, - "host": "host_value", - "healthy_threshold": 1819, - "unhealthy_threshold": 2046, - "restart_threshold": 1841, - "check_interval": {}, - "timeout": {}, - }, - "readiness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "app_start_timeout": {}, - }, - "liveness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "initial_delay": {}, - }, - "nobuild_files_regex": "nobuild_files_regex_value", - "deployment": { - "files": {}, - "container": {"image": "image_value"}, - "zip_": {"source_url": "source_url_value", "files_count": 1179}, - "cloud_build_options": { - "app_yaml_path": "app_yaml_path_value", - "cloud_build_timeout": {}, - }, - }, - "version_url": "version_url_value", - "endpoints_api_service": { - "name": "name_value", - "config_id": "config_id_value", - "rollout_strategy": 1, - "disable_trace_sampling": True, - }, - "entrypoint": {"shell": "shell_value"}, - "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.CreateVersionRequest.meta.fields["version"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["version"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["version"][field])): - del request_init["version"][field][i][subfield] - else: - del request_init["version"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.create_version(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_version_rest_interceptors(null_interceptor): - transport = transports.VersionsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), - ) - client = VersionsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.VersionsRestInterceptor, "post_create_version" - ) as post, mock.patch.object( - transports.VersionsRestInterceptor, "pre_create_version" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.CreateVersionRequest.pb(appengine.CreateVersionRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.CreateVersionRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.create_version( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_version_rest_bad_request( - transport: str = "rest", request_type=appengine.CreateVersionRequest -): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "apps/sample1/services/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.create_version(request) - - -def test_create_version_rest_error(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.UpdateVersionRequest, - dict, - ], -) -def test_update_version_rest(request_type): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} - request_init["version"] = { - "name": "name_value", - "id": "id_value", - "automatic_scaling": { - "cool_down_period": {"seconds": 751, "nanos": 543}, - "cpu_utilization": { - "aggregation_window_length": {}, - "target_utilization": 0.19540000000000002, - }, - "max_concurrent_requests": 2499, - "max_idle_instances": 1898, - "max_total_instances": 2032, - "max_pending_latency": {}, - "min_idle_instances": 1896, - "min_total_instances": 2030, - "min_pending_latency": {}, - "request_utilization": { - "target_request_count_per_second": 3320, - "target_concurrent_requests": 2820, - }, - "disk_utilization": { - "target_write_bytes_per_second": 3096, - "target_write_ops_per_second": 2883, - "target_read_bytes_per_second": 2953, - "target_read_ops_per_second": 2740, - }, - "network_utilization": { - "target_sent_bytes_per_second": 2983, - "target_sent_packets_per_second": 3179, - "target_received_bytes_per_second": 3380, - "target_received_packets_per_second": 3576, - }, - "standard_scheduler_settings": { - "target_cpu_utilization": 0.23770000000000002, - "target_throughput_utilization": 0.3163, - "min_instances": 1387, - "max_instances": 1389, - }, - }, - "basic_scaling": {"idle_timeout": {}, "max_instances": 1389}, - "manual_scaling": {"instances": 968}, - "inbound_services": [1], - "instance_class": "instance_class_value", - "network": { - "forwarded_ports": ["forwarded_ports_value1", "forwarded_ports_value2"], - "instance_tag": "instance_tag_value", - "name": "name_value", - "subnetwork_name": "subnetwork_name_value", - "session_affinity": True, - }, - "zones": ["zones_value1", "zones_value2"], - "resources": { - "cpu": 0.328, - "disk_gb": 0.723, - "memory_gb": 0.961, - "volumes": [ - { - "name": "name_value", - "volume_type": "volume_type_value", - "size_gb": 0.739, - } - ], - "kms_key_reference": "kms_key_reference_value", - }, - "runtime": "runtime_value", - "runtime_channel": "runtime_channel_value", - "threadsafe": True, - "vm": True, - "app_engine_apis": True, - "beta_settings": {}, - "env": "env_value", - "serving_status": 1, - "created_by": "created_by_value", - "create_time": {"seconds": 751, "nanos": 543}, - "disk_usage_bytes": 1701, - "runtime_api_version": "runtime_api_version_value", - "runtime_main_executable_path": "runtime_main_executable_path_value", - "service_account": "service_account_value", - "handlers": [ - { - "url_regex": "url_regex_value", - "static_files": { - "path": "path_value", - "upload_path_regex": "upload_path_regex_value", - "http_headers": {}, - "mime_type": "mime_type_value", - "expiration": {}, - "require_matching_file": True, - "application_readable": True, - }, - "script": {"script_path": "script_path_value"}, - "api_endpoint": {"script_path": "script_path_value"}, - "security_level": 1, - "login": 1, - "auth_fail_action": 1, - "redirect_http_response_code": 1, - } - ], - "error_handlers": [ - { - "error_code": 1, - "static_file": "static_file_value", - "mime_type": "mime_type_value", - } - ], - "libraries": [{"name": "name_value", "version": "version_value"}], - "api_config": { - "auth_fail_action": 1, - "login": 1, - "script": "script_value", - "security_level": 1, - "url": "url_value", - }, - "env_variables": {}, - "build_env_variables": {}, - "default_expiration": {}, - "health_check": { - "disable_health_check": True, - "host": "host_value", - "healthy_threshold": 1819, - "unhealthy_threshold": 2046, - "restart_threshold": 1841, - "check_interval": {}, - "timeout": {}, - }, - "readiness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "app_start_timeout": {}, - }, - "liveness_check": { - "path": "path_value", - "host": "host_value", - "failure_threshold": 1812, - "success_threshold": 1829, - "check_interval": {}, - "timeout": {}, - "initial_delay": {}, - }, - "nobuild_files_regex": "nobuild_files_regex_value", - "deployment": { - "files": {}, - "container": {"image": "image_value"}, - "zip_": {"source_url": "source_url_value", "files_count": 1179}, - "cloud_build_options": { - "app_yaml_path": "app_yaml_path_value", - "cloud_build_timeout": {}, - }, - }, - "version_url": "version_url_value", - "endpoints_api_service": { - "name": "name_value", - "config_id": "config_id_value", - "rollout_strategy": 1, - "disable_trace_sampling": True, - }, - "entrypoint": {"shell": "shell_value"}, - "vpc_access_connector": {"name": "name_value", "egress_setting": 1}, - } - # The version of a generated dependency at test runtime may differ from the version used during generation. - # Delete any fields which are not present in the current runtime dependency - # See https://github.com/googleapis/gapic-generator-python/issues/1748 - - # Determine if the message type is proto-plus or protobuf - test_field = appengine.UpdateVersionRequest.meta.fields["version"] - - def get_message_fields(field): - # Given a field which is a message (composite type), return a list with - # all the fields of the message. - # If the field is not a composite type, return an empty list. - message_fields = [] - - if hasattr(field, "message") and field.message: - is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") - - if is_field_type_proto_plus_type: - message_fields = field.message.meta.fields.values() - # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types - else: # pragma: NO COVER - message_fields = field.message.DESCRIPTOR.fields - return message_fields - - runtime_nested_fields = [ - (field.name, nested_field.name) - for field in get_message_fields(test_field) - for nested_field in get_message_fields(field) - ] - - subfields_not_in_runtime = [] - - # For each item in the sample request, create a list of sub fields which are not present at runtime - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for field, value in request_init["version"].items(): # pragma: NO COVER - result = None - is_repeated = False - # For repeated fields - if isinstance(value, list) and len(value): - is_repeated = True - result = value[0] - # For fields where the type is another message - if isinstance(value, dict): - result = value - - if result and hasattr(result, "keys"): - for subfield in result.keys(): - if (field, subfield) not in runtime_nested_fields: - subfields_not_in_runtime.append( - { - "field": field, - "subfield": subfield, - "is_repeated": is_repeated, - } - ) - - # Remove fields from the sample request which are not present in the runtime version of the dependency - # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime - for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER - field = subfield_to_delete.get("field") - field_repeated = subfield_to_delete.get("is_repeated") - subfield = subfield_to_delete.get("subfield") - if subfield: - if field_repeated: - for i in range(0, len(request_init["version"][field])): - del request_init["version"][field][i][subfield] - else: - del request_init["version"][field][subfield] - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.update_version(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_version_rest_interceptors(null_interceptor): - transport = transports.VersionsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), - ) - client = VersionsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.VersionsRestInterceptor, "post_update_version" - ) as post, mock.patch.object( - transports.VersionsRestInterceptor, "pre_update_version" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.UpdateVersionRequest.pb(appengine.UpdateVersionRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.UpdateVersionRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.update_version( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_update_version_rest_bad_request( - transport: str = "rest", request_type=appengine.UpdateVersionRequest -): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.update_version(request) - - -def test_update_version_rest_error(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - appengine.DeleteVersionRequest, - dict, - ], -) -def test_delete_version_rest(request_type): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = operations_pb2.Operation(name="operations/spam") - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = json_format.MessageToJson(return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.delete_version(request) - - # Establish that the response is the type that we expect. - assert response.operation.name == "operations/spam" - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_version_rest_interceptors(null_interceptor): - transport = transports.VersionsRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None if null_interceptor else transports.VersionsRestInterceptor(), - ) - client = VersionsClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - operation.Operation, "_set_result_from_operation" - ), mock.patch.object( - transports.VersionsRestInterceptor, "post_delete_version" - ) as post, mock.patch.object( - transports.VersionsRestInterceptor, "pre_delete_version" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = appengine.DeleteVersionRequest.pb(appengine.DeleteVersionRequest()) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = json_format.MessageToJson( - operations_pb2.Operation() - ) - - request = appengine.DeleteVersionRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = operations_pb2.Operation() - - client.delete_version( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_delete_version_rest_bad_request( - transport: str = "rest", request_type=appengine.DeleteVersionRequest -): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"name": "apps/sample1/services/sample2/versions/sample3"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_version(request) - - -def test_delete_version_rest_error(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.VersionsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.VersionsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = VersionsClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.VersionsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = VersionsClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = VersionsClient( - client_options=options, credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.VersionsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = VersionsClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.VersionsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = VersionsClient(transport=transport) - assert client.transport is transport - - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.VersionsGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.VersionsGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.VersionsGrpcTransport, - transports.VersionsGrpcAsyncIOTransport, - transports.VersionsRestTransport, - ], -) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "rest", - ], -) -def test_transport_kind(transport_name): - transport = VersionsClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.VersionsGrpcTransport, - ) - - -def test_versions_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.VersionsTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json", - ) - - -def test_versions_base_transport(): - # Instantiate the base transport. - with mock.patch( - "google.cloud.appengine_admin_v1.services.versions.transports.VersionsTransport.__init__" - ) as Transport: - Transport.return_value = None - transport = transports.VersionsTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - "list_versions", - "get_version", - "create_version", - "update_version", - "delete_version", - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - "kind", - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_versions_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.appengine_admin_v1.services.versions.transports.VersionsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.VersionsTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -def test_versions_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( - "google.cloud.appengine_admin_v1.services.versions.transports.VersionsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.VersionsTransport() - adc.assert_called_once() - - -def test_versions_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - VersionsClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.VersionsGrpcTransport, - transports.VersionsGrpcAsyncIOTransport, - ], -) -def test_versions_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.VersionsGrpcTransport, - transports.VersionsGrpcAsyncIOTransport, - transports.VersionsRestTransport, - ], -) -def test_versions_transport_auth_gdch_credentials(transport_class): - host = "https://language.com" - api_audience_tests = [None, "https://language2.com"] - api_audience_expect = [host, "https://language2.com"] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, "default", autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock( - return_value=gdch_mock - ) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with(e) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.VersionsGrpcTransport, grpc_helpers), - (transports.VersionsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -def test_versions_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - scopes=["1", "2"], - default_host="appengine.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport], -) -def test_versions_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = ga_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=None, - 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_versions_http_transport_client_cert_source_for_mtls(): - cred = ga_credentials.AnonymousCredentials() - with mock.patch( - "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" - ) as mock_configure_mtls_channel: - transports.VersionsRestTransport( - credentials=cred, client_cert_source_for_mtls=client_cert_source_callback - ) - mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) - - -def test_versions_rest_lro_client(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.AbstractOperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_versions_host_no_port(transport_name): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:443" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "grpc", - "grpc_asyncio", - "rest", - ], -) -def test_versions_host_with_port(transport_name): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions( - api_endpoint="appengine.googleapis.com:8000" - ), - transport=transport_name, - ) - assert client.transport._host == ( - "appengine.googleapis.com:8000" - if transport_name in ["grpc", "grpc_asyncio"] - else "https://appengine.googleapis.com:8000" - ) - - -@pytest.mark.parametrize( - "transport_name", - [ - "rest", - ], -) -def test_versions_client_transport_session_collision(transport_name): - creds1 = ga_credentials.AnonymousCredentials() - creds2 = ga_credentials.AnonymousCredentials() - client1 = VersionsClient( - credentials=creds1, - transport=transport_name, - ) - client2 = VersionsClient( - credentials=creds2, - transport=transport_name, - ) - session1 = client1.transport.list_versions._session - session2 = client2.transport.list_versions._session - assert session1 != session2 - session1 = client1.transport.get_version._session - session2 = client2.transport.get_version._session - assert session1 != session2 - session1 = client1.transport.create_version._session - session2 = client2.transport.create_version._session - assert session1 != session2 - session1 = client1.transport.update_version._session - session2 = client2.transport.update_version._session - assert session1 != session2 - session1 = client1.transport.delete_version._session - session2 = client2.transport.delete_version._session - assert session1 != session2 - - -def test_versions_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.VersionsGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_versions_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.VersionsGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - 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.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport], -) -def test_versions_transport_channel_mtls_with_client_cert_source(transport_class): - with mock.patch( - "grpc.ssl_channel_credentials", autospec=True - ) as grpc_ssl_channel_cred: - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - 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.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport], -) -def test_versions_transport_channel_mtls_with_adc(transport_class): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object( - transport_class, "create_channel" - ) as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_versions_grpc_lro_client(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_versions_grpc_lro_async_client(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - actual = VersionsClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = VersionsClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = VersionsClient.parse_common_billing_account_path(path) - assert expected == actual - - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format( - folder=folder, - ) - actual = VersionsClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = VersionsClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = VersionsClient.parse_common_folder_path(path) - assert expected == actual - - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format( - organization=organization, - ) - actual = VersionsClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = VersionsClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = VersionsClient.parse_common_organization_path(path) - assert expected == actual - - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format( - project=project, - ) - actual = VersionsClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = VersionsClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = VersionsClient.parse_common_project_path(path) - assert expected == actual - - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = VersionsClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = VersionsClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = VersionsClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object( - transports.VersionsTransport, "_prep_wrapped_messages" - ) as prep: - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object( - transports.VersionsTransport, "_prep_wrapped_messages" - ) as prep: - transport_class = VersionsClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object( - type(getattr(client.transport, "grpc_channel")), "close" - ) as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "rest": "_session", - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - with mock.patch.object( - type(getattr(client.transport, close_name)), "close" - ) as close: - with client: - close.assert_not_called() - close.assert_called_once() - - -def test_client_ctx(): - transports = [ - "rest", - "grpc", - ] - for transport in transports: - client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - - -@pytest.mark.parametrize( - "client_class,transport_class", - [ - (VersionsClient, transports.VersionsGrpcTransport), - (VersionsAsyncClient, transports.VersionsGrpcAsyncIOTransport), - ], -) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - 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, - always_use_jwt_access=True, - api_audience=None, - )