From 197473430881e9bc68257152baf89b0917bd6114 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 7 Apr 2021 14:30:06 +0000 Subject: [PATCH 001/185] chore: release 0.1.0 (#1) :robot: I have created a release \*beep\* \*boop\* --- ## 0.1.0 (2021-04-05) ### Features * generate v1 ([1a14a9c](https://www.github.com/googleapis/python-appengine-admin/commit/1a14a9c4dba69fae84586b59da27762b5f39e58b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 825c32f..758a10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,8 @@ # Changelog + +## 0.1.0 (2021-04-05) + + +### Features + +* generate v1 ([1a14a9c](https://www.github.com/googleapis/python-appengine-admin/commit/1a14a9c4dba69fae84586b59da27762b5f39e58b)) From 29d67f947f488bd15684a525ee408f42d41fa1e6 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 7 Apr 2021 07:38:05 -0700 Subject: [PATCH 002/185] chore: track generated files (#5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-04-07 05:54:22,456 synthtool [DEBUG] > Executing /home/kbuilder/.cache/synthtool/python-appengine-admin/synth.py. On branch autosynth nothing to commit, working tree clean 2021-04-07 05:54:22,976 synthtool [DEBUG] > Ensuring dependencies. 2021-04-07 05:54:23,329 synthtool [DEBUG] > Cloning googleapis. 2021-04-07 05:54:23,711 synthtool [DEBUG] > Which version of bazel will I run? bazel 3.0.0 2021-04-07 05:54:23,715 synthtool [DEBUG] > Generating code for: //google/appengine/v1:google-cloud-appengine-v1-py. 2021-04-07 05:54:42,164 synthtool [SUCCESS] > Generated code into /tmpfs/tmp/tmp19rjmcyq. .coveragerc .flake8 .github/CONTRIBUTING.md .github/ISSUE_TEMPLATE/bug_report.md .github/ISSUE_TEMPLATE/feature_request.md .github/ISSUE_TEMPLATE/support_request.md .github/PULL_REQUEST_TEMPLATE.md .github/header-checker-lint.yml .github/release-please.yml .github/snippet-bot.yml .gitignore .kokoro/build.sh .kokoro/continuous/common.cfg .kokoro/continuous/continuous.cfg .kokoro/docker/docs/Dockerfile .kokoro/docker/docs/fetch_gpg_keys.sh .kokoro/docs/common.cfg .kokoro/docs/docs-presubmit.cfg .kokoro/docs/docs.cfg .kokoro/populate-secrets.sh .kokoro/presubmit/common.cfg .kokoro/presubmit/presubmit.cfg .kokoro/publish-docs.sh .kokoro/release.sh .kokoro/release/common.cfg .kokoro/release/release.cfg .kokoro/samples/lint/common.cfg .kokoro/samples/lint/continuous.cfg .kokoro/samples/lint/periodic.cfg .kokoro/samples/lint/presubmit.cfg .kokoro/samples/python3.6/common.cfg .kokoro/samples/python3.6/continuous.cfg .kokoro/samples/python3.6/periodic-head.cfg .kokoro/samples/python3.6/periodic.cfg .kokoro/samples/python3.6/presubmit.cfg .kokoro/samples/python3.7/common.cfg .kokoro/samples/python3.7/continuous.cfg .kokoro/samples/python3.7/periodic-head.cfg .kokoro/samples/python3.7/periodic.cfg .kokoro/samples/python3.7/presubmit.cfg .kokoro/samples/python3.8/common.cfg .kokoro/samples/python3.8/continuous.cfg .kokoro/samples/python3.8/periodic-head.cfg .kokoro/samples/python3.8/periodic.cfg .kokoro/samples/python3.8/presubmit.cfg .kokoro/test-samples-against-head.sh .kokoro/test-samples-impl.sh .kokoro/test-samples.sh .kokoro/trampoline.sh .kokoro/trampoline_v2.sh .pre-commit-config.yaml .trampolinerc CODE_OF_CONDUCT.md CONTRIBUTING.rst LICENSE MANIFEST.in docs/_static/custom.css docs/_templates/layout.html docs/conf.py.j2 docs/multiprocessing.rst noxfile.py.j2 renovate.json Skipping: samples/AUTHORING_GUIDE.md Skipping: samples/CONTRIBUTING.md scripts/decrypt-secrets.sh scripts/readme-gen/readme_gen.py.j2 scripts/readme-gen/templates/README.tmpl.rst scripts/readme-gen/templates/auth.tmpl.rst scripts/readme-gen/templates/auth_api_key.tmpl.rst scripts/readme-gen/templates/install_deps.tmpl.rst scripts/readme-gen/templates/install_portaudio.tmpl.rst setup.cfg testing/.gitignore nox > Running session blacken nox > Creating virtual environment (virtualenv) using python3.6 in .nox/blacken nox > python -m pip install black==19.10b0 nox > black docs google tests noxfile.py setup.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/applications/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/docs/conf.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/applications/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/applications/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/applications/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/applications/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/authorized_domains/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/pagers.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/firewall/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/pagers.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/instances/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/pagers.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/services/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/transports/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/pagers.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/async_client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/transports/base.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/client.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/audit_data.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/application.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/certificate.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/app_yaml.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/deployed_files.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/domain.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/deploy.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/firewall.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/domain_mapping.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/network_settings.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/location.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/operation.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/instance.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/service.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/__init__.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/appengine.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/noxfile.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/google/cloud/appengine_admin_v1/types/version.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_applications.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_instances.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_firewall.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_services.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_versions.py All done! ✨ 🍰 ✨ 93 files reformatted, 2 files left unchanged. nox > Session blacken was successful. 2021-04-07 05:55:01,196 synthtool [DEBUG] > Wrote metadata to synth.metadata. rmatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_applications.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_instances.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_firewall.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_services.py reformatted /home/kbuilder/.cache/synthtool/python-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_versions.py All done! ✨ 🍰 ✨ 93 files reformatted, 2 files left unchanged. nox > Session blacken was successful. 2021-04-07 05:55:01,196 synthtool [DEBUG] > Wrote metadata to synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/30a2d101-2124-4efb-a4a9-f09170e85baa/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) --- .pre-commit-config.yaml | 2 +- docs/appengine_admin_v1/types.rst | 2 +- google/cloud/appengine_admin_v1/__init__.py | 4 +- synth.metadata | 221 ++++++++++++++++++++ 4 files changed, 225 insertions(+), 4 deletions(-) create mode 100644 synth.metadata diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 55cc59e..8912e9b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.0 hooks: - id: flake8 diff --git a/docs/appengine_admin_v1/types.rst b/docs/appengine_admin_v1/types.rst index d2f435c..cc6979e 100644 --- a/docs/appengine_admin_v1/types.rst +++ b/docs/appengine_admin_v1/types.rst @@ -1,4 +1,4 @@ -Types for Google Cloud Appengine-admin v1 API +Types for Google Cloud Appengine Admin v1 API ============================================= .. automodule:: google.cloud.appengine_admin_v1.types diff --git a/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index a463e61..e86b67a 100644 --- a/google/cloud/appengine_admin_v1/__init__.py +++ b/google/cloud/appengine_admin_v1/__init__.py @@ -130,6 +130,7 @@ "ApiConfigHandler", "ApiEndpointHandler", "Application", + "ApplicationsClient", "AuditData", "AuthFailAction", "AuthorizedCertificate", @@ -162,7 +163,6 @@ "Deployment", "DiskUtilization", "DomainMapping", - "DomainMappingsClient", "DomainOverrideStrategy", "EndpointsApiService", "Entrypoint", @@ -235,5 +235,5 @@ "Volume", "VpcAccessConnector", "ZipInfo", - "ApplicationsClient", + "DomainMappingsClient", ) diff --git a/synth.metadata b/synth.metadata new file mode 100644 index 0000000..9901341 --- /dev/null +++ b/synth.metadata @@ -0,0 +1,221 @@ +{ + "sources": [ + { + "git": { + "name": ".", + "remote": "https://github.com/googleapis/python-appengine-admin.git", + "sha": "b23b075ae60fb5b7452e9c996b0febdeea81c50e" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "7e91915c247a5c84ab5fcdf11ce2bdf7404f2fcc", + "internalRef": "367156876" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "705743e66f5c0b24a95f7f30619c9d3ef747b317" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "705743e66f5c0b24a95f7f30619c9d3ef747b317" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "appengine", + "apiVersion": "v1", + "language": "python", + "generator": "bazel" + } + } + ], + "generatedFiles": [ + ".coveragerc", + ".flake8", + ".github/CONTRIBUTING.md", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/header-checker-lint.yml", + ".github/release-please.yml", + ".github/snippet-bot.yml", + ".gitignore", + ".kokoro/build.sh", + ".kokoro/continuous/common.cfg", + ".kokoro/continuous/continuous.cfg", + ".kokoro/docker/docs/Dockerfile", + ".kokoro/docker/docs/fetch_gpg_keys.sh", + ".kokoro/docs/common.cfg", + ".kokoro/docs/docs-presubmit.cfg", + ".kokoro/docs/docs.cfg", + ".kokoro/populate-secrets.sh", + ".kokoro/presubmit/common.cfg", + ".kokoro/presubmit/presubmit.cfg", + ".kokoro/publish-docs.sh", + ".kokoro/release.sh", + ".kokoro/release/common.cfg", + ".kokoro/release/release.cfg", + ".kokoro/samples/lint/common.cfg", + ".kokoro/samples/lint/continuous.cfg", + ".kokoro/samples/lint/periodic.cfg", + ".kokoro/samples/lint/presubmit.cfg", + ".kokoro/samples/python3.6/common.cfg", + ".kokoro/samples/python3.6/continuous.cfg", + ".kokoro/samples/python3.6/periodic-head.cfg", + ".kokoro/samples/python3.6/periodic.cfg", + ".kokoro/samples/python3.6/presubmit.cfg", + ".kokoro/samples/python3.7/common.cfg", + ".kokoro/samples/python3.7/continuous.cfg", + ".kokoro/samples/python3.7/periodic-head.cfg", + ".kokoro/samples/python3.7/periodic.cfg", + ".kokoro/samples/python3.7/presubmit.cfg", + ".kokoro/samples/python3.8/common.cfg", + ".kokoro/samples/python3.8/continuous.cfg", + ".kokoro/samples/python3.8/periodic-head.cfg", + ".kokoro/samples/python3.8/periodic.cfg", + ".kokoro/samples/python3.8/presubmit.cfg", + ".kokoro/test-samples-against-head.sh", + ".kokoro/test-samples-impl.sh", + ".kokoro/test-samples.sh", + ".kokoro/trampoline.sh", + ".kokoro/trampoline_v2.sh", + ".pre-commit-config.yaml", + ".trampolinerc", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.rst", + "LICENSE", + "MANIFEST.in", + "docs/_static/custom.css", + "docs/_templates/layout.html", + "docs/appengine_admin_v1/applications.rst", + "docs/appengine_admin_v1/authorized_certificates.rst", + "docs/appengine_admin_v1/authorized_domains.rst", + "docs/appengine_admin_v1/domain_mappings.rst", + "docs/appengine_admin_v1/firewall.rst", + "docs/appengine_admin_v1/instances.rst", + "docs/appengine_admin_v1/types.rst", + "docs/appengine_admin_v1/versions.rst", + "docs/conf.py", + "docs/multiprocessing.rst", + "google/cloud/appengine_admin/__init__.py", + "google/cloud/appengine_admin/py.typed", + "google/cloud/appengine_admin_v1/__init__.py", + "google/cloud/appengine_admin_v1/py.typed", + "google/cloud/appengine_admin_v1/services/__init__.py", + "google/cloud/appengine_admin_v1/services/applications/__init__.py", + "google/cloud/appengine_admin_v1/services/applications/async_client.py", + "google/cloud/appengine_admin_v1/services/applications/client.py", + "google/cloud/appengine_admin_v1/services/applications/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/applications/transports/base.py", + "google/cloud/appengine_admin_v1/services/applications/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/client.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/client.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/client.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/services/firewall/__init__.py", + "google/cloud/appengine_admin_v1/services/firewall/async_client.py", + "google/cloud/appengine_admin_v1/services/firewall/client.py", + "google/cloud/appengine_admin_v1/services/firewall/pagers.py", + "google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/firewall/transports/base.py", + "google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/services/instances/__init__.py", + "google/cloud/appengine_admin_v1/services/instances/async_client.py", + "google/cloud/appengine_admin_v1/services/instances/client.py", + "google/cloud/appengine_admin_v1/services/instances/pagers.py", + "google/cloud/appengine_admin_v1/services/instances/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/instances/transports/base.py", + "google/cloud/appengine_admin_v1/services/instances/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/services/services/__init__.py", + "google/cloud/appengine_admin_v1/services/services/async_client.py", + "google/cloud/appengine_admin_v1/services/services/client.py", + "google/cloud/appengine_admin_v1/services/services/pagers.py", + "google/cloud/appengine_admin_v1/services/services/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/services/transports/base.py", + "google/cloud/appengine_admin_v1/services/services/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/services/versions/__init__.py", + "google/cloud/appengine_admin_v1/services/versions/async_client.py", + "google/cloud/appengine_admin_v1/services/versions/client.py", + "google/cloud/appengine_admin_v1/services/versions/pagers.py", + "google/cloud/appengine_admin_v1/services/versions/transports/__init__.py", + "google/cloud/appengine_admin_v1/services/versions/transports/base.py", + "google/cloud/appengine_admin_v1/services/versions/transports/grpc.py", + "google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py", + "google/cloud/appengine_admin_v1/types/__init__.py", + "google/cloud/appengine_admin_v1/types/app_yaml.py", + "google/cloud/appengine_admin_v1/types/appengine.py", + "google/cloud/appengine_admin_v1/types/application.py", + "google/cloud/appengine_admin_v1/types/audit_data.py", + "google/cloud/appengine_admin_v1/types/certificate.py", + "google/cloud/appengine_admin_v1/types/deploy.py", + "google/cloud/appengine_admin_v1/types/deployed_files.py", + "google/cloud/appengine_admin_v1/types/domain.py", + "google/cloud/appengine_admin_v1/types/domain_mapping.py", + "google/cloud/appengine_admin_v1/types/firewall.py", + "google/cloud/appengine_admin_v1/types/instance.py", + "google/cloud/appengine_admin_v1/types/location.py", + "google/cloud/appengine_admin_v1/types/network_settings.py", + "google/cloud/appengine_admin_v1/types/operation.py", + "google/cloud/appengine_admin_v1/types/service.py", + "google/cloud/appengine_admin_v1/types/version.py", + "mypy.ini", + "noxfile.py", + "renovate.json", + "scripts/decrypt-secrets.sh", + "scripts/fixup_appengine_admin_v1_keywords.py", + "scripts/readme-gen/readme_gen.py", + "scripts/readme-gen/templates/README.tmpl.rst", + "scripts/readme-gen/templates/auth.tmpl.rst", + "scripts/readme-gen/templates/auth_api_key.tmpl.rst", + "scripts/readme-gen/templates/install_deps.tmpl.rst", + "scripts/readme-gen/templates/install_portaudio.tmpl.rst", + "setup.cfg", + "testing/.gitignore", + "tests/unit/gapic/appengine_admin_v1/__init__.py", + "tests/unit/gapic/appengine_admin_v1/test_applications.py", + "tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py", + "tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py", + "tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py", + "tests/unit/gapic/appengine_admin_v1/test_firewall.py", + "tests/unit/gapic/appengine_admin_v1/test_instances.py", + "tests/unit/gapic/appengine_admin_v1/test_services.py", + "tests/unit/gapic/appengine_admin_v1/test_versions.py" + ] +} \ No newline at end of file From 5165f7e7145d270585aa6f93afba339614cf2fb5 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sun, 11 Apr 2021 04:10:02 -0700 Subject: [PATCH 003/185] chore: add constraints file check for python samples (#8) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/aad321ad-c931-4b99-9785-541e8f5ce0bd/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/0a071b3460344886297a304253bf924aa68ddb7e --- .github/header-checker-lint.yml | 2 +- google/cloud/appengine_admin_v1/__init__.py | 4 ++-- renovate.json | 5 ++++- synth.metadata | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/header-checker-lint.yml b/.github/header-checker-lint.yml index fc281c0..6fe78aa 100644 --- a/.github/header-checker-lint.yml +++ b/.github/header-checker-lint.yml @@ -1,6 +1,6 @@ {"allowedCopyrightHolders": ["Google LLC"], "allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"], - "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"], + "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"], "sourceFileExtensions": [ "ts", "js", diff --git a/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index e86b67a..60a8089 100644 --- a/google/cloud/appengine_admin_v1/__init__.py +++ b/google/cloud/appengine_admin_v1/__init__.py @@ -135,7 +135,6 @@ "AuthFailAction", "AuthorizedCertificate", "AuthorizedCertificateView", - "AuthorizedCertificatesClient", "AuthorizedDomain", "AuthorizedDomainsClient", "AutomaticScaling", @@ -163,6 +162,7 @@ "Deployment", "DiskUtilization", "DomainMapping", + "DomainMappingsClient", "DomainOverrideStrategy", "EndpointsApiService", "Entrypoint", @@ -235,5 +235,5 @@ "Volume", "VpcAccessConnector", "ZipInfo", - "DomainMappingsClient", + "AuthorizedCertificatesClient", ) diff --git a/renovate.json b/renovate.json index f08bc22..c048955 100644 --- a/renovate.json +++ b/renovate.json @@ -2,5 +2,8 @@ "extends": [ "config:base", ":preserveSemverRanges" ], - "ignorePaths": [".pre-commit-config.yaml"] + "ignorePaths": [".pre-commit-config.yaml"], + "pip_requirements": { + "fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"] + } } diff --git a/synth.metadata b/synth.metadata index 9901341..bb42d8d 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-appengine-admin.git", - "sha": "b23b075ae60fb5b7452e9c996b0febdeea81c50e" + "sha": "29d67f947f488bd15684a525ee408f42d41fa1e6" } }, { @@ -19,14 +19,14 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "705743e66f5c0b24a95f7f30619c9d3ef747b317" + "sha": "0a071b3460344886297a304253bf924aa68ddb7e" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "705743e66f5c0b24a95f7f30619c9d3ef747b317" + "sha": "0a071b3460344886297a304253bf924aa68ddb7e" } } ], From 8cc55e6f651f7c96873f5f36886bd66521f87aaf Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Fri, 16 Apr 2021 17:19:56 -0400 Subject: [PATCH 004/185] chore: prevent normalization of semver versioning (#10) * chore: prevent normalization of semver versioning * chore: update workaround to make sic work --- setup.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 283fa3d..69c53ec 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,21 @@ import os import setuptools # type: ignore +# Disable version normalization performed by setuptools.setup() +try: + # Try the approach of using sic(), added in setuptools 46.1.0 + from setuptools import sic +except ImportError: + # Try the approach of replacing packaging.version.Version + sic = lambda v: v + try: + # setuptools >=39.0.0 uses packaging from setuptools.extern + from setuptools.extern import packaging + except ImportError: + # setuptools <39.0.0 uses packaging from pkg_resources.extern + from pkg_resources.extern import packaging + packaging.version.Version = packaging.version.LegacyVersion + name = "google-cloud-appengine-admin" version = "0.1.0" description = "App Engine Admin API client library" @@ -39,7 +54,7 @@ setuptools.setup( name=name, - version=version, + version=sic(version), description=description, long_description=readme, author="Google LLC", From a92535d221f1a2200d4b597e6da22830608665c4 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Mon, 26 Apr 2021 14:21:22 -0400 Subject: [PATCH 005/185] chore(revert): revert preventing normalization (#12) --- setup.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/setup.py b/setup.py index 69c53ec..283fa3d 100644 --- a/setup.py +++ b/setup.py @@ -19,21 +19,6 @@ import os import setuptools # type: ignore -# Disable version normalization performed by setuptools.setup() -try: - # Try the approach of using sic(), added in setuptools 46.1.0 - from setuptools import sic -except ImportError: - # Try the approach of replacing packaging.version.Version - sic = lambda v: v - try: - # setuptools >=39.0.0 uses packaging from setuptools.extern - from setuptools.extern import packaging - except ImportError: - # setuptools <39.0.0 uses packaging from pkg_resources.extern - from pkg_resources.extern import packaging - packaging.version.Version = packaging.version.LegacyVersion - name = "google-cloud-appengine-admin" version = "0.1.0" description = "App Engine Admin API client library" @@ -54,7 +39,7 @@ setuptools.setup( name=name, - version=sic(version), + version=version, description=description, long_description=readme, author="Google LLC", From 76cb073d3df23eb45bcc45ef19eb85487d0373d2 Mon Sep 17 00:00:00 2001 From: "google-cloud-policy-bot[bot]" <80869356+google-cloud-policy-bot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 13:34:02 +0000 Subject: [PATCH 006/185] chore: add SECURITY.md (#14) chore: add SECURITY.md --- SECURITY.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8b58ae9 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. From 00b7246111d7a1196ff33564c3c3d74e54ee1089 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 May 2021 11:58:03 -0400 Subject: [PATCH 007/185] chore: migrate to owl bot (#16) This PR migrates from autosynth to [owl bot](https://github.com/googleapis/repo-automation-bots/tree/master/packages/owl-bot). owl bot will save time for maintainers as it will automatically open PRs when there are updates in [googleapis-gen](https://github.com/googleapis/googleapis-gen/tree/master/google) without requiring maintainers to run `synthtool` to build the client from protos. Additionally, similar to autosynth, PRs will be automatically opened when there are template updates. --- .github/.OwlBot.lock.yaml | 4 + .github/.OwlBot.yaml | 26 +++ .kokoro/release.sh | 4 +- .kokoro/release/common.cfg | 14 +- .pre-commit-config.yaml | 2 +- CONTRIBUTING.rst | 16 +- docs/_static/custom.css | 13 +- google/cloud/appengine_admin_v1/__init__.py | 4 +- noxfile.py | 14 +- synth.py => owlbot.py | 19 +- synth.metadata | 221 -------------------- 11 files changed, 56 insertions(+), 281 deletions(-) create mode 100644 .github/.OwlBot.lock.yaml create mode 100644 .github/.OwlBot.yaml rename synth.py => owlbot.py (74%) delete mode 100644 synth.metadata diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 0000000..d49860b --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,4 @@ +docker: + digest: sha256:457583330eec64daa02aeb7a72a04d33e7be2428f646671ce4045dcbc0191b1e + image: gcr.io/repo-automation-bots/owlbot-python:latest + diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml new file mode 100644 index 0000000..d8bfd9a --- /dev/null +++ b/.github/.OwlBot.yaml @@ -0,0 +1,26 @@ +# 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/repo-automation-bots/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/.kokoro/release.sh b/.kokoro/release.sh index 267f0be..107a7d9 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password") +TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") cd github/python-appengine-admin python3 setup.py sdist bdist_wheel -twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/* +twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index e14b6ac..935c70f 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,18 +23,8 @@ env_vars: { 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_password" - } - } -} - # 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" -} \ No newline at end of file + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8912e9b..1bbd787 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.0 + rev: 3.9.1 hooks: - id: flake8 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 98f860f..9aec34d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -160,21 +160,7 @@ Running System Tests auth settings and change some configuration in your project to run all the tests. -- System tests will be run against an actual project and - so you'll need to provide some environment variables to facilitate - authentication to your project: - - - ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file; - Such a file can be downloaded directly from the developer's console by clicking - "Generate new JSON key". See private key - `docs `__ - for more details. - -- Once you have downloaded your json keys, set the environment variable - ``GOOGLE_APPLICATION_CREDENTIALS`` to the absolute path of the json file:: - - $ export GOOGLE_APPLICATION_CREDENTIALS="/Users//path/to/app_credentials.json" - +- 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 diff --git a/docs/_static/custom.css b/docs/_static/custom.css index bcd37bb..b0a2954 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,9 +1,20 @@ 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/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index 60a8089..a463e61 100644 --- a/google/cloud/appengine_admin_v1/__init__.py +++ b/google/cloud/appengine_admin_v1/__init__.py @@ -130,11 +130,11 @@ "ApiConfigHandler", "ApiEndpointHandler", "Application", - "ApplicationsClient", "AuditData", "AuthFailAction", "AuthorizedCertificate", "AuthorizedCertificateView", + "AuthorizedCertificatesClient", "AuthorizedDomain", "AuthorizedDomainsClient", "AutomaticScaling", @@ -235,5 +235,5 @@ "Volume", "VpcAccessConnector", "ZipInfo", - "AuthorizedCertificatesClient", + "ApplicationsClient", ) diff --git a/noxfile.py b/noxfile.py index af50a60..1d45cad 100644 --- a/noxfile.py +++ b/noxfile.py @@ -62,16 +62,9 @@ def lint(session): session.run("flake8", "google", "tests") -@nox.session(python="3.6") +@nox.session(python=DEFAULT_PYTHON_VERSION) def blacken(session): - """Run black. - - Format code to uniform standard. - - This currently uses Python 3.6 due to the automated Kokoro run of synthtool. - That run uses an image that doesn't have 3.6 installed. Before updating this - check the state of the `gcp_ubuntu_config` we use for that Kokoro run. - """ + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( "black", *BLACK_PATHS, @@ -131,9 +124,6 @@ def system(session): # 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") - # Sanity check: Only run tests if the environment variable is set. - if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): - session.skip("Credentials must be set via environment variable") # Install pyopenssl for mTLS testing. if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true": session.install("pyopenssl") diff --git a/synth.py b/owlbot.py similarity index 74% rename from synth.py rename to owlbot.py index a3eab89..30ffad7 100644 --- a/synth.py +++ b/owlbot.py @@ -20,24 +20,11 @@ import synthtool.gcp as gcp from synthtool.languages import python -gapic = gcp.GAPICBazel() common = gcp.CommonTemplates() -versions = [ - "v1", - -] # add new versions at the end of the list - -# ---------------------------------------------------------------------------- -# Generate appengine GAPIC layer -# ---------------------------------------------------------------------------- -for version in versions: - library = gapic.py_library( - service="appengine", - version=version, - bazel_target=f"//google/appengine/{version}:google-cloud-appengine-{version}-py", - ) +default_version = "v1" +for library in s.get_staging_dirs(default_version): excludes=["setup.py", "README.rst", "docs/index.rst"] # See https://github.com/googleapis/gapic-generator-python/issues/825 @@ -45,6 +32,8 @@ s.move(library, excludes=excludes) +s.remove_staging_dirs() + # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- diff --git a/synth.metadata b/synth.metadata deleted file mode 100644 index bb42d8d..0000000 --- a/synth.metadata +++ /dev/null @@ -1,221 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/python-appengine-admin.git", - "sha": "29d67f947f488bd15684a525ee408f42d41fa1e6" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "7e91915c247a5c84ab5fcdf11ce2bdf7404f2fcc", - "internalRef": "367156876" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0a071b3460344886297a304253bf924aa68ddb7e" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0a071b3460344886297a304253bf924aa68ddb7e" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "appengine", - "apiVersion": "v1", - "language": "python", - "generator": "bazel" - } - } - ], - "generatedFiles": [ - ".coveragerc", - ".flake8", - ".github/CONTRIBUTING.md", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/header-checker-lint.yml", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".gitignore", - ".kokoro/build.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/continuous.cfg", - ".kokoro/docker/docs/Dockerfile", - ".kokoro/docker/docs/fetch_gpg_keys.sh", - ".kokoro/docs/common.cfg", - ".kokoro/docs/docs-presubmit.cfg", - ".kokoro/docs/docs.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/presubmit.cfg", - ".kokoro/publish-docs.sh", - ".kokoro/release.sh", - ".kokoro/release/common.cfg", - ".kokoro/release/release.cfg", - ".kokoro/samples/lint/common.cfg", - ".kokoro/samples/lint/continuous.cfg", - ".kokoro/samples/lint/periodic.cfg", - ".kokoro/samples/lint/presubmit.cfg", - ".kokoro/samples/python3.6/common.cfg", - ".kokoro/samples/python3.6/continuous.cfg", - ".kokoro/samples/python3.6/periodic-head.cfg", - ".kokoro/samples/python3.6/periodic.cfg", - ".kokoro/samples/python3.6/presubmit.cfg", - ".kokoro/samples/python3.7/common.cfg", - ".kokoro/samples/python3.7/continuous.cfg", - ".kokoro/samples/python3.7/periodic-head.cfg", - ".kokoro/samples/python3.7/periodic.cfg", - ".kokoro/samples/python3.7/presubmit.cfg", - ".kokoro/samples/python3.8/common.cfg", - ".kokoro/samples/python3.8/continuous.cfg", - ".kokoro/samples/python3.8/periodic-head.cfg", - ".kokoro/samples/python3.8/periodic.cfg", - ".kokoro/samples/python3.8/presubmit.cfg", - ".kokoro/test-samples-against-head.sh", - ".kokoro/test-samples-impl.sh", - ".kokoro/test-samples.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".pre-commit-config.yaml", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.rst", - "LICENSE", - "MANIFEST.in", - "docs/_static/custom.css", - "docs/_templates/layout.html", - "docs/appengine_admin_v1/applications.rst", - "docs/appengine_admin_v1/authorized_certificates.rst", - "docs/appengine_admin_v1/authorized_domains.rst", - "docs/appengine_admin_v1/domain_mappings.rst", - "docs/appengine_admin_v1/firewall.rst", - "docs/appengine_admin_v1/instances.rst", - "docs/appengine_admin_v1/types.rst", - "docs/appengine_admin_v1/versions.rst", - "docs/conf.py", - "docs/multiprocessing.rst", - "google/cloud/appengine_admin/__init__.py", - "google/cloud/appengine_admin/py.typed", - "google/cloud/appengine_admin_v1/__init__.py", - "google/cloud/appengine_admin_v1/py.typed", - "google/cloud/appengine_admin_v1/services/__init__.py", - "google/cloud/appengine_admin_v1/services/applications/__init__.py", - "google/cloud/appengine_admin_v1/services/applications/async_client.py", - "google/cloud/appengine_admin_v1/services/applications/client.py", - "google/cloud/appengine_admin_v1/services/applications/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/applications/transports/base.py", - "google/cloud/appengine_admin_v1/services/applications/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/applications/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/__init__.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/client.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/base.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/__init__.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/client.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/transports/base.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/__init__.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/client.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/transports/base.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/domain_mappings/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/services/firewall/__init__.py", - "google/cloud/appengine_admin_v1/services/firewall/async_client.py", - "google/cloud/appengine_admin_v1/services/firewall/client.py", - "google/cloud/appengine_admin_v1/services/firewall/pagers.py", - "google/cloud/appengine_admin_v1/services/firewall/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/firewall/transports/base.py", - "google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/services/instances/__init__.py", - "google/cloud/appengine_admin_v1/services/instances/async_client.py", - "google/cloud/appengine_admin_v1/services/instances/client.py", - "google/cloud/appengine_admin_v1/services/instances/pagers.py", - "google/cloud/appengine_admin_v1/services/instances/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/instances/transports/base.py", - "google/cloud/appengine_admin_v1/services/instances/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/instances/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/services/services/__init__.py", - "google/cloud/appengine_admin_v1/services/services/async_client.py", - "google/cloud/appengine_admin_v1/services/services/client.py", - "google/cloud/appengine_admin_v1/services/services/pagers.py", - "google/cloud/appengine_admin_v1/services/services/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/services/transports/base.py", - "google/cloud/appengine_admin_v1/services/services/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/services/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/services/versions/__init__.py", - "google/cloud/appengine_admin_v1/services/versions/async_client.py", - "google/cloud/appengine_admin_v1/services/versions/client.py", - "google/cloud/appengine_admin_v1/services/versions/pagers.py", - "google/cloud/appengine_admin_v1/services/versions/transports/__init__.py", - "google/cloud/appengine_admin_v1/services/versions/transports/base.py", - "google/cloud/appengine_admin_v1/services/versions/transports/grpc.py", - "google/cloud/appengine_admin_v1/services/versions/transports/grpc_asyncio.py", - "google/cloud/appengine_admin_v1/types/__init__.py", - "google/cloud/appengine_admin_v1/types/app_yaml.py", - "google/cloud/appengine_admin_v1/types/appengine.py", - "google/cloud/appengine_admin_v1/types/application.py", - "google/cloud/appengine_admin_v1/types/audit_data.py", - "google/cloud/appengine_admin_v1/types/certificate.py", - "google/cloud/appengine_admin_v1/types/deploy.py", - "google/cloud/appengine_admin_v1/types/deployed_files.py", - "google/cloud/appengine_admin_v1/types/domain.py", - "google/cloud/appengine_admin_v1/types/domain_mapping.py", - "google/cloud/appengine_admin_v1/types/firewall.py", - "google/cloud/appengine_admin_v1/types/instance.py", - "google/cloud/appengine_admin_v1/types/location.py", - "google/cloud/appengine_admin_v1/types/network_settings.py", - "google/cloud/appengine_admin_v1/types/operation.py", - "google/cloud/appengine_admin_v1/types/service.py", - "google/cloud/appengine_admin_v1/types/version.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "scripts/decrypt-secrets.sh", - "scripts/fixup_appengine_admin_v1_keywords.py", - "scripts/readme-gen/readme_gen.py", - "scripts/readme-gen/templates/README.tmpl.rst", - "scripts/readme-gen/templates/auth.tmpl.rst", - "scripts/readme-gen/templates/auth_api_key.tmpl.rst", - "scripts/readme-gen/templates/install_deps.tmpl.rst", - "scripts/readme-gen/templates/install_portaudio.tmpl.rst", - "setup.cfg", - "testing/.gitignore", - "tests/unit/gapic/appengine_admin_v1/__init__.py", - "tests/unit/gapic/appengine_admin_v1/test_applications.py", - "tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py", - "tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py", - "tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py", - "tests/unit/gapic/appengine_admin_v1/test_firewall.py", - "tests/unit/gapic/appengine_admin_v1/test_instances.py", - "tests/unit/gapic/appengine_admin_v1/test_services.py", - "tests/unit/gapic/appengine_admin_v1/test_versions.py" - ] -} \ No newline at end of file From 0dd2b4ea020c1765f3968d94c1f43c2e155d225a Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 May 2021 18:26:02 -0400 Subject: [PATCH 008/185] chore: add library type to .repo-metadata.json (#15) --- .repo-metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.repo-metadata.json b/.repo-metadata.json index 1c01a63..ce8c9f0 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -6,6 +6,7 @@ "issue_tracker": "", "release_level": "beta", "language": "python", + "library_type": "GAPIC_AUTO", "repo": "googleapis/python-appengine-admin", "distribution_name": "google-cloud-appengine-admin", "api_id": "appengine.googleapis.com" From c798db287a2e85551e512e66d4bc1da344a806d2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 14 May 2021 15:16:05 +0000 Subject: [PATCH 009/185] chore: upgrade gapic-generator-python to 0.46.3 (#18) PiperOrigin-RevId: 373649163 Source-Link: https://github.com/googleapis/googleapis/commit/7e1b14e6c7a9ab96d2db7e4a131981f162446d34 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0a3c7d272d697796db75857bac73905c68e498c3 fix: add async client to %name_%version/init.py chore: add autogenerated snippets chore: remove auth, policy, and options from the reserved names list feat: support self-signed JWT flow for service accounts chore: enable GAPIC metadata generation chore: sort subpackages in %namespace/%name/init.py --- .../authorized_certificates.rst | 1 - .../appengine_admin_v1/authorized_domains.rst | 1 - docs/appengine_admin_v1/domain_mappings.rst | 1 - docs/appengine_admin_v1/firewall.rst | 1 - docs/appengine_admin_v1/instances.rst | 1 - docs/appengine_admin_v1/versions.rst | 1 - google/cloud/appengine_admin/__init__.py | 178 +++---- google/cloud/appengine_admin_v1/__init__.py | 35 +- .../appengine_admin_v1/gapic_metadata.json | 461 ++++++++++++++++++ .../appengine_admin_v1/services/__init__.py | 1 - .../services/applications/__init__.py | 2 - .../services/applications/async_client.py | 33 +- .../services/applications/client.py | 67 ++- .../applications/transports/__init__.py | 2 - .../services/applications/transports/base.py | 118 +++-- .../services/applications/transports/grpc.py | 36 +- .../applications/transports/grpc_asyncio.py | 37 +- .../authorized_certificates/__init__.py | 2 - .../authorized_certificates/async_client.py | 35 +- .../authorized_certificates/client.py | 69 ++- .../authorized_certificates/pagers.py | 4 +- .../transports/__init__.py | 2 - .../transports/base.py | 128 +++-- .../transports/grpc.py | 28 +- .../transports/grpc_asyncio.py | 29 +- .../services/authorized_domains/__init__.py | 2 - .../authorized_domains/async_client.py | 25 +- .../services/authorized_domains/client.py | 59 +-- .../services/authorized_domains/pagers.py | 4 +- .../authorized_domains/transports/__init__.py | 2 - .../authorized_domains/transports/base.py | 104 +++- .../authorized_domains/transports/grpc.py | 22 +- .../transports/grpc_asyncio.py | 23 +- .../services/domain_mappings/__init__.py | 2 - .../services/domain_mappings/async_client.py | 37 +- .../services/domain_mappings/client.py | 71 ++- .../services/domain_mappings/pagers.py | 4 +- .../domain_mappings/transports/__init__.py | 2 - .../domain_mappings/transports/base.py | 124 +++-- .../domain_mappings/transports/grpc.py | 36 +- .../transports/grpc_asyncio.py | 37 +- .../services/firewall/__init__.py | 2 - .../services/firewall/async_client.py | 35 +- .../services/firewall/client.py | 69 ++- .../services/firewall/pagers.py | 4 +- .../services/firewall/transports/__init__.py | 2 - .../services/firewall/transports/base.py | 128 +++-- .../services/firewall/transports/grpc.py | 28 +- .../firewall/transports/grpc_asyncio.py | 29 +- .../services/instances/__init__.py | 2 - .../services/instances/async_client.py | 38 +- .../services/instances/client.py | 75 ++- .../services/instances/pagers.py | 4 +- .../services/instances/transports/__init__.py | 2 - .../services/instances/transports/base.py | 119 +++-- .../services/instances/transports/grpc.py | 32 +- .../instances/transports/grpc_asyncio.py | 37 +- .../services/services/__init__.py | 2 - .../services/services/async_client.py | 35 +- .../services/services/client.py | 69 ++- .../services/services/pagers.py | 4 +- .../services/services/transports/__init__.py | 2 - .../services/services/transports/base.py | 119 +++-- .../services/services/transports/grpc.py | 32 +- .../services/transports/grpc_asyncio.py | 37 +- .../services/versions/__init__.py | 2 - .../services/versions/async_client.py | 41 +- .../services/versions/client.py | 75 ++- .../services/versions/pagers.py | 4 +- .../services/versions/transports/__init__.py | 2 - .../services/versions/transports/base.py | 123 +++-- .../services/versions/transports/grpc.py | 36 +- .../versions/transports/grpc_asyncio.py | 43 +- .../appengine_admin_v1/types/__init__.py | 2 - .../appengine_admin_v1/types/app_yaml.py | 127 ++--- .../appengine_admin_v1/types/appengine.py | 225 +++------ .../appengine_admin_v1/types/application.py | 61 +-- .../appengine_admin_v1/types/audit_data.py | 7 - .../appengine_admin_v1/types/certificate.py | 37 +- .../cloud/appengine_admin_v1/types/deploy.py | 29 +- .../types/deployed_files.py | 1 - .../cloud/appengine_admin_v1/types/domain.py | 7 +- .../types/domain_mapping.py | 24 +- .../appengine_admin_v1/types/firewall.py | 11 +- .../appengine_admin_v1/types/instance.py | 53 +- .../appengine_admin_v1/types/location.py | 10 +- .../types/network_settings.py | 2 - .../appengine_admin_v1/types/operation.py | 28 +- .../cloud/appengine_admin_v1/types/service.py | 13 +- .../cloud/appengine_admin_v1/types/version.py | 221 +++------ scripts/fixup_appengine_admin_v1_keywords.py | 73 ++- tests/__init__.py | 15 + tests/unit/__init__.py | 15 + tests/unit/gapic/__init__.py | 15 + .../unit/gapic/appengine_admin_v1/__init__.py | 1 - .../appengine_admin_v1/test_applications.py | 401 ++++++++++----- .../test_authorized_certificates.py | 459 +++++++++++------ .../test_authorized_domains.py | 338 ++++++++++--- .../test_domain_mappings.py | 431 +++++++++++----- .../gapic/appengine_admin_v1/test_firewall.py | 449 +++++++++++------ .../appengine_admin_v1/test_instances.py | 421 ++++++++++------ .../gapic/appengine_admin_v1/test_services.py | 392 +++++++++++---- .../gapic/appengine_admin_v1/test_versions.py | 449 +++++++++++------ 103 files changed, 4595 insertions(+), 2781 deletions(-) create mode 100644 google/cloud/appengine_admin_v1/gapic_metadata.json create mode 100644 tests/__init__.py create mode 100644 tests/unit/__init__.py create mode 100644 tests/unit/gapic/__init__.py diff --git a/docs/appengine_admin_v1/authorized_certificates.rst b/docs/appengine_admin_v1/authorized_certificates.rst index d47fbee..03ac310 100644 --- a/docs/appengine_admin_v1/authorized_certificates.rst +++ b/docs/appengine_admin_v1/authorized_certificates.rst @@ -5,7 +5,6 @@ AuthorizedCertificates :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 index c3f3e7c..d02102a 100644 --- a/docs/appengine_admin_v1/authorized_domains.rst +++ b/docs/appengine_admin_v1/authorized_domains.rst @@ -5,7 +5,6 @@ AuthorizedDomains :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 index 58dc8c2..89af15b 100644 --- a/docs/appengine_admin_v1/domain_mappings.rst +++ b/docs/appengine_admin_v1/domain_mappings.rst @@ -5,7 +5,6 @@ DomainMappings :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 index ccf12e6..ce343d1 100644 --- a/docs/appengine_admin_v1/firewall.rst +++ b/docs/appengine_admin_v1/firewall.rst @@ -5,7 +5,6 @@ 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 index 04bccfb..57f5079 100644 --- a/docs/appengine_admin_v1/instances.rst +++ b/docs/appengine_admin_v1/instances.rst @@ -5,7 +5,6 @@ Instances :members: :inherited-members: - .. automodule:: google.cloud.appengine_admin_v1.services.instances.pagers :members: :inherited-members: diff --git a/docs/appengine_admin_v1/versions.rst b/docs/appengine_admin_v1/versions.rst index c0e44d8..58a0f63 100644 --- a/docs/appengine_admin_v1/versions.rst +++ b/docs/appengine_admin_v1/versions.rst @@ -5,7 +5,6 @@ Versions :members: :inherited-members: - .. automodule:: google.cloud.appengine_admin_v1.services.versions.pagers :members: :inherited-members: diff --git a/google/cloud/appengine_admin/__init__.py b/google/cloud/appengine_admin/__init__.py index bc871b9..579693b 100644 --- a/google/cloud/appengine_admin/__init__.py +++ b/google/cloud/appengine_admin/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,60 +14,60 @@ # limitations under the License. # -from google.cloud.appengine_admin_v1.services.applications.async_client import ( - ApplicationsAsyncClient, -) 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.applications.async_client import ( + ApplicationsAsyncClient, ) 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.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.domain_mappings.async_client import ( - DomainMappingsAsyncClient, +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.domain_mappings.async_client import ( + DomainMappingsAsyncClient, +) +from google.cloud.appengine_admin_v1.services.firewall.client import FirewallClient from google.cloud.appengine_admin_v1.services.firewall.async_client import ( FirewallAsyncClient, ) -from google.cloud.appengine_admin_v1.services.firewall.client import FirewallClient +from google.cloud.appengine_admin_v1.services.instances.client import InstancesClient from google.cloud.appengine_admin_v1.services.instances.async_client import ( InstancesAsyncClient, ) -from google.cloud.appengine_admin_v1.services.instances.client import InstancesClient +from google.cloud.appengine_admin_v1.services.services.client import ServicesClient from google.cloud.appengine_admin_v1.services.services.async_client import ( ServicesAsyncClient, ) -from google.cloud.appengine_admin_v1.services.services.client import ServicesClient +from google.cloud.appengine_admin_v1.services.versions.client import VersionsClient from google.cloud.appengine_admin_v1.services.versions.async_client import ( VersionsAsyncClient, ) -from google.cloud.appengine_admin_v1.services.versions.client import VersionsClient + 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 AuthFailAction 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 LoginRequirement 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 SecurityLevel 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.appengine import AuthorizedCertificateView +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, ) @@ -91,7 +90,6 @@ 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 DomainOverrideStrategy from google.cloud.appengine_admin_v1.types.appengine import GetApplicationRequest from google.cloud.appengine_admin_v1.types.appengine import ( GetAuthorizedCertificateRequest, @@ -130,6 +128,8 @@ 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 @@ -163,47 +163,54 @@ 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 InboundServiceType 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 ServingStatus 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 __all__ = ( - "ApiConfigHandler", - "ApiEndpointHandler", - "Application", - "ApplicationsAsyncClient", "ApplicationsClient", - "AuditData", - "AuthFailAction", - "AuthorizedCertificate", - "AuthorizedCertificateView", - "AuthorizedCertificatesAsyncClient", + "ApplicationsAsyncClient", "AuthorizedCertificatesClient", - "AuthorizedDomain", - "AuthorizedDomainsAsyncClient", + "AuthorizedCertificatesAsyncClient", "AuthorizedDomainsClient", - "AutomaticScaling", - "BasicScaling", + "AuthorizedDomainsAsyncClient", + "DomainMappingsClient", + "DomainMappingsAsyncClient", + "FirewallClient", + "FirewallAsyncClient", + "InstancesClient", + "InstancesAsyncClient", + "ServicesClient", + "ServicesAsyncClient", + "VersionsClient", + "VersionsAsyncClient", + "ApiConfigHandler", + "ApiEndpointHandler", + "ErrorHandler", + "HealthCheck", + "Library", + "LivenessCheck", + "ReadinessCheck", + "ScriptHandler", + "StaticFilesHandler", + "UrlMap", + "AuthFailAction", + "LoginRequirement", + "SecurityLevel", "BatchUpdateIngressRulesRequest", "BatchUpdateIngressRulesResponse", - "CertificateRawData", - "CloudBuildOptions", - "ContainerInfo", - "CpuUtilization", "CreateApplicationRequest", "CreateAuthorizedCertificateRequest", "CreateDomainMappingRequest", "CreateIngressRuleRequest", - "CreateVersionMetadataV1", - "CreateVersionMethod", "CreateVersionRequest", "DebugInstanceRequest", "DeleteAuthorizedCertificateRequest", @@ -212,19 +219,6 @@ "DeleteInstanceRequest", "DeleteServiceRequest", "DeleteVersionRequest", - "Deployment", - "DiskUtilization", - "DomainMapping", - "DomainMappingsAsyncClient", - "DomainMappingsClient", - "DomainOverrideStrategy", - "EndpointsApiService", - "Entrypoint", - "ErrorHandler", - "FileInfo", - "FirewallAsyncClient", - "FirewallClient", - "FirewallRule", "GetApplicationRequest", "GetAuthorizedCertificateRequest", "GetDomainMappingRequest", @@ -232,12 +226,6 @@ "GetInstanceRequest", "GetServiceRequest", "GetVersionRequest", - "HealthCheck", - "InboundServiceType", - "Instance", - "InstancesAsyncClient", - "InstancesClient", - "Library", "ListAuthorizedCertificatesRequest", "ListAuthorizedCertificatesResponse", "ListAuthorizedDomainsRequest", @@ -252,45 +240,57 @@ "ListServicesResponse", "ListVersionsRequest", "ListVersionsResponse", - "LivenessCheck", - "LocationMetadata", - "LoginRequirement", - "ManagedCertificate", - "ManagementStatus", - "ManualScaling", - "Network", - "NetworkSettings", - "NetworkUtilization", - "OperationMetadataV1", - "ReadinessCheck", "RepairApplicationRequest", - "RequestUtilization", - "ResourceRecord", - "Resources", - "ScriptHandler", - "SecurityLevel", - "Service", - "ServicesAsyncClient", - "ServicesClient", - "ServingStatus", - "SslSettings", - "StandardSchedulerSettings", - "StaticFilesHandler", - "TrafficSplit", "UpdateApplicationRequest", "UpdateAuthorizedCertificateRequest", "UpdateDomainMappingRequest", "UpdateIngressRuleRequest", - "UpdateServiceMethod", "UpdateServiceRequest", "UpdateVersionRequest", + "AuthorizedCertificateView", + "DomainOverrideStrategy", + "VersionView", + "Application", "UrlDispatchRule", - "UrlMap", + "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", - "VersionView", - "VersionsAsyncClient", - "VersionsClient", "Volume", "VpcAccessConnector", - "ZipInfo", + "InboundServiceType", + "ServingStatus", ) diff --git a/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index a463e61..9bb498e 100644 --- a/google/cloud/appengine_admin_v1/__init__.py +++ b/google/cloud/appengine_admin_v1/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,27 +15,35 @@ # 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 + from .types.app_yaml import ApiConfigHandler from .types.app_yaml import ApiEndpointHandler -from .types.app_yaml import AuthFailAction 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 LoginRequirement from .types.app_yaml import ReadinessCheck from .types.app_yaml import ScriptHandler -from .types.app_yaml import SecurityLevel from .types.app_yaml import StaticFilesHandler from .types.app_yaml import UrlMap -from .types.appengine import AuthorizedCertificateView +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 @@ -51,7 +58,6 @@ from .types.appengine import DeleteInstanceRequest from .types.appengine import DeleteServiceRequest from .types.appengine import DeleteVersionRequest -from .types.appengine import DomainOverrideStrategy from .types.appengine import GetApplicationRequest from .types.appengine import GetAuthorizedCertificateRequest from .types.appengine import GetDomainMappingRequest @@ -80,6 +86,8 @@ 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 @@ -113,23 +121,31 @@ from .types.version import DiskUtilization from .types.version import EndpointsApiService from .types.version import Entrypoint -from .types.version import InboundServiceType 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 ServingStatus 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 __all__ = ( + "ApplicationsAsyncClient", + "AuthorizedCertificatesAsyncClient", + "AuthorizedDomainsAsyncClient", + "DomainMappingsAsyncClient", + "FirewallAsyncClient", + "InstancesAsyncClient", + "ServicesAsyncClient", + "VersionsAsyncClient", "ApiConfigHandler", "ApiEndpointHandler", "Application", + "ApplicationsClient", "AuditData", "AuthFailAction", "AuthorizedCertificate", @@ -235,5 +251,4 @@ "Volume", "VpcAccessConnector", "ZipInfo", - "ApplicationsClient", ) diff --git a/google/cloud/appengine_admin_v1/gapic_metadata.json b/google/cloud/appengine_admin_v1/gapic_metadata.json new file mode 100644 index 0000000..0bb6583 --- /dev/null +++ b/google/cloud/appengine_admin_v1/gapic_metadata.json @@ -0,0 +1,461 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.appengine_admin_v1", + "protoPackage": "google.appengine.v1", + "schema": "1.0", + "services": { + "Applications": { + "clients": { + "grpc": { + "libraryClient": "ApplicationsClient", + "rpcs": { + "CreateApplication": { + "methods": [ + "create_application" + ] + }, + "GetApplication": { + "methods": [ + "get_application" + ] + }, + "RepairApplication": { + "methods": [ + "repair_application" + ] + }, + "UpdateApplication": { + "methods": [ + "update_application" + ] + } + } + }, + "grpc-async": { + "libraryClient": "ApplicationsAsyncClient", + "rpcs": { + "CreateApplication": { + "methods": [ + "create_application" + ] + }, + "GetApplication": { + "methods": [ + "get_application" + ] + }, + "RepairApplication": { + "methods": [ + "repair_application" + ] + }, + "UpdateApplication": { + "methods": [ + "update_application" + ] + } + } + } + } + }, + "AuthorizedCertificates": { + "clients": { + "grpc": { + "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" + ] + } + } + }, + "grpc-async": { + "libraryClient": "AuthorizedCertificatesAsyncClient", + "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" + ] + } + } + } + } + }, + "AuthorizedDomains": { + "clients": { + "grpc": { + "libraryClient": "AuthorizedDomainsClient", + "rpcs": { + "ListAuthorizedDomains": { + "methods": [ + "list_authorized_domains" + ] + } + } + }, + "grpc-async": { + "libraryClient": "AuthorizedDomainsAsyncClient", + "rpcs": { + "ListAuthorizedDomains": { + "methods": [ + "list_authorized_domains" + ] + } + } + } + } + }, + "DomainMappings": { + "clients": { + "grpc": { + "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" + ] + } + } + }, + "grpc-async": { + "libraryClient": "DomainMappingsAsyncClient", + "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" + ] + } + } + } + } + }, + "Firewall": { + "clients": { + "grpc": { + "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" + ] + } + } + }, + "grpc-async": { + "libraryClient": "FirewallAsyncClient", + "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" + ] + } + } + } + } + }, + "Instances": { + "clients": { + "grpc": { + "libraryClient": "InstancesClient", + "rpcs": { + "DebugInstance": { + "methods": [ + "debug_instance" + ] + }, + "DeleteInstance": { + "methods": [ + "delete_instance" + ] + }, + "GetInstance": { + "methods": [ + "get_instance" + ] + }, + "ListInstances": { + "methods": [ + "list_instances" + ] + } + } + }, + "grpc-async": { + "libraryClient": "InstancesAsyncClient", + "rpcs": { + "DebugInstance": { + "methods": [ + "debug_instance" + ] + }, + "DeleteInstance": { + "methods": [ + "delete_instance" + ] + }, + "GetInstance": { + "methods": [ + "get_instance" + ] + }, + "ListInstances": { + "methods": [ + "list_instances" + ] + } + } + } + } + }, + "Services": { + "clients": { + "grpc": { + "libraryClient": "ServicesClient", + "rpcs": { + "DeleteService": { + "methods": [ + "delete_service" + ] + }, + "GetService": { + "methods": [ + "get_service" + ] + }, + "ListServices": { + "methods": [ + "list_services" + ] + }, + "UpdateService": { + "methods": [ + "update_service" + ] + } + } + }, + "grpc-async": { + "libraryClient": "ServicesAsyncClient", + "rpcs": { + "DeleteService": { + "methods": [ + "delete_service" + ] + }, + "GetService": { + "methods": [ + "get_service" + ] + }, + "ListServices": { + "methods": [ + "list_services" + ] + }, + "UpdateService": { + "methods": [ + "update_service" + ] + } + } + } + } + }, + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "CreateVersion": { + "methods": [ + "create_version" + ] + }, + "DeleteVersion": { + "methods": [ + "delete_version" + ] + }, + "GetVersion": { + "methods": [ + "get_version" + ] + }, + "ListVersions": { + "methods": [ + "list_versions" + ] + }, + "UpdateVersion": { + "methods": [ + "update_version" + ] + } + } + }, + "grpc-async": { + "libraryClient": "VersionsAsyncClient", + "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/__init__.py b/google/cloud/appengine_admin_v1/services/__init__.py index 42ffdf2..4de6597 100644 --- a/google/cloud/appengine_admin_v1/services/__init__.py +++ b/google/cloud/appengine_admin_v1/services/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (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 e512cac..77403bc 100644 --- a/google/cloud/appengine_admin_v1/services/applications/__init__.py +++ b/google/cloud/appengine_admin_v1/services/applications/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import ApplicationsClient from .async_client import ApplicationsAsyncClient 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 98474c7..29ffd86 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,10 +20,10 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.api_core import operation as gac_operation # type: ignore @@ -33,8 +31,7 @@ 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 as duration # type: ignore - +from google.protobuf import duration_pb2 # type: ignore from .transports.base import ApplicationsTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import ApplicationsGrpcAsyncIOTransport from .client import ApplicationsClient @@ -54,20 +51,16 @@ class ApplicationsAsyncClient: parse_common_billing_account_path = staticmethod( ApplicationsClient.parse_common_billing_account_path ) - common_folder_path = staticmethod(ApplicationsClient.common_folder_path) parse_common_folder_path = staticmethod(ApplicationsClient.parse_common_folder_path) - common_organization_path = staticmethod(ApplicationsClient.common_organization_path) parse_common_organization_path = staticmethod( ApplicationsClient.parse_common_organization_path ) - common_project_path = staticmethod(ApplicationsClient.common_project_path) parse_common_project_path = staticmethod( ApplicationsClient.parse_common_project_path ) - common_location_path = staticmethod(ApplicationsClient.common_location_path) parse_common_location_path = staticmethod( ApplicationsClient.parse_common_location_path @@ -75,7 +68,8 @@ class ApplicationsAsyncClient: @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -90,7 +84,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -107,7 +101,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> ApplicationsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: ApplicationsTransport: The transport used by the client instance. @@ -121,12 +115,12 @@ def transport(self) -> ApplicationsTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, ApplicationsTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the applications client. + """Instantiates the applications client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -158,7 +152,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = ApplicationsClient( credentials=credentials, transport=transport, @@ -180,7 +173,6 @@ async def get_application( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -195,7 +187,6 @@ async def get_application( """ # Create or coerce a protobuf request object. - request = appengine.GetApplicationRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -242,7 +233,6 @@ async def create_application( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -258,7 +248,6 @@ async def create_application( """ # Create or coerce a protobuf request object. - request = appengine.CreateApplicationRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -303,7 +292,6 @@ async def update_application( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -319,7 +307,6 @@ async def update_application( """ # Create or coerce a protobuf request object. - request = appengine.UpdateApplicationRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -374,7 +361,6 @@ async def repair_application( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -390,7 +376,6 @@ async def repair_application( """ # Create or coerce a protobuf request object. - request = appengine.RepairApplicationRequest(request) # Wrap the RPC method; this adds retry and timeout information, diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 36e7bbc..58a29ed 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -37,8 +35,7 @@ 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 as duration # type: ignore - +from google.protobuf import duration_pb2 # type: ignore from .transports.base import ApplicationsTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ApplicationsGrpcTransport from .transports.grpc_asyncio import ApplicationsGrpcAsyncIOTransport @@ -57,7 +54,7 @@ class ApplicationsClientMeta(type): _transport_registry["grpc_asyncio"] = ApplicationsGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[ApplicationsTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -80,7 +77,8 @@ class ApplicationsClient(metaclass=ApplicationsClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -114,7 +112,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -131,7 +130,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -150,16 +149,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> ApplicationsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - ApplicationsTransport: The transport used by the client instance. + ApplicationsTransport: The transport used by the client + instance. """ return self._transport @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -172,7 +172,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -183,7 +183,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -194,7 +194,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -205,7 +205,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -219,12 +219,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ApplicationsTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the applications client. + """Instantiates the applications client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -279,9 +279,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -293,12 +294,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -313,8 +316,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -343,7 +346,6 @@ def get_application( request (google.cloud.appengine_admin_v1.types.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. @@ -358,7 +360,6 @@ def get_application( """ # Create or coerce a protobuf request object. - # 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 @@ -406,7 +407,6 @@ def create_application( request (google.cloud.appengine_admin_v1.types.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. @@ -422,7 +422,6 @@ def create_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 @@ -468,7 +467,6 @@ def update_application( request (google.cloud.appengine_admin_v1.types.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. @@ -484,7 +482,6 @@ def update_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 @@ -540,7 +537,6 @@ def repair_application( request (google.cloud.appengine_admin_v1.types.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. @@ -556,7 +552,6 @@ def repair_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 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 946f6e4..0acb98c 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 e03081a..d3873c0 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -40,6 +39,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class ApplicationsTransport(abc.ABC): """Abstract transport class for Applications.""" @@ -50,21 +60,24 @@ class ApplicationsTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -73,7 +86,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -87,29 +100,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -135,38 +195,36 @@ def operations_client(self) -> operations_v1.OperationsClient: @property def get_application( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.GetApplicationRequest], - typing.Union[ - application.Application, typing.Awaitable[application.Application] - ], + Union[application.Application, Awaitable[application.Application]], ]: raise NotImplementedError() @property def create_application( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.CreateApplicationRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def update_application( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.UpdateApplicationRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def repair_application( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.RepairApplicationRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() 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 b18f7ed..779505d 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 google.cloud.appengine_admin_v1.types import application -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import ApplicationsTransport, DEFAULT_CLIENT_INFO @@ -53,7 +50,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -67,7 +64,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -178,7 +176,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -209,13 +207,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -268,7 +268,7 @@ def get_application( @property def create_application( self, - ) -> Callable[[appengine.CreateApplicationRequest], operations.Operation]: + ) -> 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 @@ -297,14 +297,14 @@ def create_application( self._stubs["create_application"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Applications/CreateApplication", request_serializer=appengine.CreateApplicationRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_application"] @property def update_application( self, - ) -> Callable[[appengine.UpdateApplicationRequest], operations.Operation]: + ) -> 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 @@ -329,14 +329,14 @@ def update_application( self._stubs["update_application"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Applications/UpdateApplication", request_serializer=appengine.UpdateApplicationRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_application"] @property def repair_application( self, - ) -> Callable[[appengine.RepairApplicationRequest], operations.Operation]: + ) -> 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 @@ -365,7 +365,7 @@ def repair_application( self._stubs["repair_application"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Applications/RepairApplication", request_serializer=appengine.RepairApplicationRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["repair_application"] 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 2922000..ac93ffb 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # 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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import ApplicationsTransport, DEFAULT_CLIENT_INFO from .grpc import ApplicationsGrpcTransport @@ -56,7 +53,7 @@ class ApplicationsGrpcAsyncIOTransport(ApplicationsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -83,13 +80,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -97,7 +96,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -111,7 +110,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -170,7 +170,6 @@ def __init__( # 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 @@ -277,7 +276,7 @@ def get_application( def create_application( self, ) -> Callable[ - [appengine.CreateApplicationRequest], Awaitable[operations.Operation] + [appengine.CreateApplicationRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the create application method over gRPC. @@ -307,7 +306,7 @@ def create_application( self._stubs["create_application"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Applications/CreateApplication", request_serializer=appengine.CreateApplicationRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_application"] @@ -315,7 +314,7 @@ def create_application( def update_application( self, ) -> Callable[ - [appengine.UpdateApplicationRequest], Awaitable[operations.Operation] + [appengine.UpdateApplicationRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the update application method over gRPC. @@ -341,7 +340,7 @@ def update_application( self._stubs["update_application"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Applications/UpdateApplication", request_serializer=appengine.UpdateApplicationRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_application"] @@ -349,7 +348,7 @@ def update_application( def repair_application( self, ) -> Callable[ - [appengine.RepairApplicationRequest], Awaitable[operations.Operation] + [appengine.RepairApplicationRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the repair application method over gRPC. @@ -379,7 +378,7 @@ def repair_application( self._stubs["repair_application"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Applications/RepairApplication", request_serializer=appengine.RepairApplicationRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["repair_application"] 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 0e8d665..2fc9832 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import AuthorizedCertificatesClient from .async_client import 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 index 7f16cd5..1110e38 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,17 +20,16 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # 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.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 as timestamp # type: ignore - +from google.protobuf import timestamp_pb2 # type: ignore from .transports.base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport from .client import AuthorizedCertificatesClient @@ -55,24 +52,20 @@ class AuthorizedCertificatesAsyncClient: 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 ) @@ -82,7 +75,8 @@ class AuthorizedCertificatesAsyncClient: @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -97,7 +91,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -114,7 +108,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> AuthorizedCertificatesTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: AuthorizedCertificatesTransport: The transport used by the client instance. @@ -129,12 +123,12 @@ def transport(self) -> AuthorizedCertificatesTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, AuthorizedCertificatesTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the authorized certificates client. + """Instantiates the authorized certificates client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -166,7 +160,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = AuthorizedCertificatesClient( credentials=credentials, transport=transport, @@ -189,7 +182,6 @@ async def list_authorized_certificates( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -206,7 +198,6 @@ async def list_authorized_certificates( """ # Create or coerce a protobuf request object. - request = appengine.ListAuthorizedCertificatesRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -249,7 +240,6 @@ async def get_authorized_certificate( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -266,7 +256,6 @@ async def get_authorized_certificate( """ # Create or coerce a protobuf request object. - request = appengine.GetAuthorizedCertificateRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -303,7 +292,6 @@ async def create_authorized_certificate( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -320,7 +308,6 @@ async def create_authorized_certificate( """ # Create or coerce a protobuf request object. - request = appengine.CreateAuthorizedCertificateRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -362,7 +349,6 @@ async def update_authorized_certificate( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -379,7 +365,6 @@ async def update_authorized_certificate( """ # Create or coerce a protobuf request object. - request = appengine.UpdateAuthorizedCertificateRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -416,7 +401,6 @@ async def delete_authorized_certificate( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -424,7 +408,6 @@ async def delete_authorized_certificate( 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, 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 dad6dab..79bdf59 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -35,8 +33,7 @@ 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 as timestamp # type: ignore - +from google.protobuf import timestamp_pb2 # type: ignore from .transports.base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO from .transports.grpc import AuthorizedCertificatesGrpcTransport from .transports.grpc_asyncio import AuthorizedCertificatesGrpcAsyncIOTransport @@ -59,7 +56,7 @@ class AuthorizedCertificatesClientMeta(type): def get_transport_class( cls, label: str = None, ) -> Type[AuthorizedCertificatesTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -85,7 +82,8 @@ class AuthorizedCertificatesClient(metaclass=AuthorizedCertificatesClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -119,7 +117,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -136,7 +135,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -155,16 +154,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> AuthorizedCertificatesTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - AuthorizedCertificatesTransport: The transport used by the client instance. + AuthorizedCertificatesTransport: The transport used by the client + instance. """ return self._transport @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -177,7 +177,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -188,7 +188,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -199,7 +199,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -210,7 +210,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -224,12 +224,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AuthorizedCertificatesTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the authorized certificates client. + """Instantiates the authorized certificates client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -284,9 +284,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -298,12 +299,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -318,8 +321,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -349,7 +352,6 @@ def list_authorized_certificates( request (google.cloud.appengine_admin_v1.types.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. @@ -366,7 +368,6 @@ def list_authorized_certificates( """ # 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 @@ -412,7 +413,6 @@ def get_authorized_certificate( request (google.cloud.appengine_admin_v1.types.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. @@ -429,7 +429,6 @@ def get_authorized_certificate( """ # 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 @@ -469,7 +468,6 @@ def create_authorized_certificate( request (google.cloud.appengine_admin_v1.types.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. @@ -486,7 +484,6 @@ def create_authorized_certificate( """ # 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 @@ -531,7 +528,6 @@ def update_authorized_certificate( request (google.cloud.appengine_admin_v1.types.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. @@ -548,7 +544,6 @@ def update_authorized_certificate( """ # 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 @@ -588,7 +583,6 @@ def delete_authorized_certificate( request (google.cloud.appengine_admin_v1.types.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. @@ -596,7 +590,6 @@ def delete_authorized_certificate( 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 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 24d9819..25f943d 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and 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 6ba068c..c273e23 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 1da6da0..0f5102f 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,21 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -39,6 +38,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class AuthorizedCertificatesTransport(abc.ABC): """Abstract transport class for AuthorizedCertificates.""" @@ -49,21 +59,24 @@ class AuthorizedCertificatesTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -72,7 +85,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -86,29 +99,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -142,11 +202,11 @@ def _prep_wrapped_messages(self, client_info): @property def list_authorized_certificates( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.ListAuthorizedCertificatesRequest], - typing.Union[ + Union[ appengine.ListAuthorizedCertificatesResponse, - typing.Awaitable[appengine.ListAuthorizedCertificatesResponse], + Awaitable[appengine.ListAuthorizedCertificatesResponse], ], ]: raise NotImplementedError() @@ -154,11 +214,11 @@ def list_authorized_certificates( @property def get_authorized_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.GetAuthorizedCertificateRequest], - typing.Union[ + Union[ certificate.AuthorizedCertificate, - typing.Awaitable[certificate.AuthorizedCertificate], + Awaitable[certificate.AuthorizedCertificate], ], ]: raise NotImplementedError() @@ -166,11 +226,11 @@ def get_authorized_certificate( @property def create_authorized_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.CreateAuthorizedCertificateRequest], - typing.Union[ + Union[ certificate.AuthorizedCertificate, - typing.Awaitable[certificate.AuthorizedCertificate], + Awaitable[certificate.AuthorizedCertificate], ], ]: raise NotImplementedError() @@ -178,11 +238,11 @@ def create_authorized_certificate( @property def update_authorized_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.UpdateAuthorizedCertificateRequest], - typing.Union[ + Union[ certificate.AuthorizedCertificate, - typing.Awaitable[certificate.AuthorizedCertificate], + Awaitable[certificate.AuthorizedCertificate], ], ]: raise NotImplementedError() @@ -190,9 +250,9 @@ def update_authorized_certificate( @property def delete_authorized_certificate( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.DeleteAuthorizedCertificateRequest], - typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], ]: raise NotImplementedError() 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 ae27315..4126964 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 google.cloud.appengine_admin_v1.types import certificate -from google.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO @@ -54,7 +51,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -68,7 +65,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -178,7 +176,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -209,13 +207,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -353,7 +353,7 @@ def update_authorized_certificate( @property def delete_authorized_certificate( self, - ) -> Callable[[appengine.DeleteAuthorizedCertificateRequest], empty.Empty]: + ) -> Callable[[appengine.DeleteAuthorizedCertificateRequest], empty_pb2.Empty]: r"""Return a callable for the delete authorized certificate method over gRPC. Deletes the specified SSL certificate. @@ -374,7 +374,7 @@ def delete_authorized_certificate( ] = self.grpc_channel.unary_unary( "/google.appengine.v1.AuthorizedCertificates/DeleteAuthorizedCertificate", request_serializer=appengine.DeleteAuthorizedCertificateRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["delete_authorized_certificate"] 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 1e6467b..2646f05 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # 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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import AuthorizedCertificatesTransport, DEFAULT_CLIENT_INFO from .grpc import AuthorizedCertificatesGrpcTransport @@ -57,7 +54,7 @@ class AuthorizedCertificatesGrpcAsyncIOTransport(AuthorizedCertificatesTransport def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -84,13 +81,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -98,7 +97,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -112,7 +111,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -170,7 +170,6 @@ def __init__( # 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 @@ -359,7 +358,7 @@ def update_authorized_certificate( def delete_authorized_certificate( self, ) -> Callable[ - [appengine.DeleteAuthorizedCertificateRequest], Awaitable[empty.Empty] + [appengine.DeleteAuthorizedCertificateRequest], Awaitable[empty_pb2.Empty] ]: r"""Return a callable for the delete authorized certificate method over gRPC. @@ -381,7 +380,7 @@ def delete_authorized_certificate( ] = self.grpc_channel.unary_unary( "/google.appengine.v1.AuthorizedCertificates/DeleteAuthorizedCertificate", request_serializer=appengine.DeleteAuthorizedCertificateRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["delete_authorized_certificate"] 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 61c9194..f8ce19e 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import AuthorizedDomainsClient from .async_client import 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 index 2d3a6a4..cba0655 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,16 +20,15 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # 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.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 .client import AuthorizedDomainsClient @@ -54,24 +51,20 @@ class AuthorizedDomainsAsyncClient: 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 @@ -79,7 +72,8 @@ class AuthorizedDomainsAsyncClient: @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -94,7 +88,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -111,7 +105,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> AuthorizedDomainsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: AuthorizedDomainsTransport: The transport used by the client instance. @@ -125,12 +119,12 @@ def transport(self) -> AuthorizedDomainsTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, AuthorizedDomainsTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the authorized domains client. + """Instantiates the authorized domains client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -162,7 +156,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = AuthorizedDomainsClient( credentials=credentials, transport=transport, @@ -185,7 +178,6 @@ async def list_authorized_domains( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -202,7 +194,6 @@ async def list_authorized_domains( """ # Create or coerce a protobuf request object. - request = appengine.ListAuthorizedDomainsRequest(request) # Wrap the RPC method; this adds retry and timeout information, 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 91b4e68..c427da1 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -35,7 +33,6 @@ 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 import AuthorizedDomainsGrpcTransport from .transports.grpc_asyncio import AuthorizedDomainsGrpcAsyncIOTransport @@ -58,7 +55,7 @@ class AuthorizedDomainsClientMeta(type): def get_transport_class( cls, label: str = None, ) -> Type[AuthorizedDomainsTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -84,7 +81,8 @@ class AuthorizedDomainsClient(metaclass=AuthorizedDomainsClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -118,7 +116,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -135,7 +134,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -154,16 +153,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> AuthorizedDomainsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - AuthorizedDomainsTransport: The transport used by the client instance. + AuthorizedDomainsTransport: The transport used by the client + instance. """ return self._transport @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -176,7 +176,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -187,7 +187,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -198,7 +198,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -209,7 +209,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -223,12 +223,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, AuthorizedDomainsTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the authorized domains client. + """Instantiates the authorized domains client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -283,9 +283,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -297,12 +298,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -317,8 +320,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -348,7 +351,6 @@ def list_authorized_domains( request (google.cloud.appengine_admin_v1.types.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. @@ -365,7 +367,6 @@ def list_authorized_domains( """ # 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 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 2d3a650..5d34d47 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and 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 fbd760d..e602ae6 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 d2555ac..7af2081 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,20 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.cloud.appengine_admin_v1.types import appengine - try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( @@ -37,6 +36,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class AuthorizedDomainsTransport(abc.ABC): """Abstract transport class for AuthorizedDomains.""" @@ -47,21 +57,24 @@ class AuthorizedDomainsTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -70,7 +83,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -84,29 +97,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -120,11 +180,11 @@ def _prep_wrapped_messages(self, client_info): @property def list_authorized_domains( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.ListAuthorizedDomainsRequest], - typing.Union[ + Union[ appengine.ListAuthorizedDomainsResponse, - typing.Awaitable[appengine.ListAuthorizedDomainsResponse], + Awaitable[appengine.ListAuthorizedDomainsResponse], ], ]: raise NotImplementedError() 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 9a29bae..e946757 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,20 +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 +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 @@ -52,7 +49,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -66,7 +63,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -176,7 +174,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -207,13 +205,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **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 cae7fc5..25da719 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 .grpc import AuthorizedDomainsGrpcTransport @@ -55,7 +52,7 @@ class AuthorizedDomainsGrpcAsyncIOTransport(AuthorizedDomainsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -82,13 +79,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -96,7 +95,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -110,7 +109,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -168,7 +168,6 @@ def __init__( # 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 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 2d1c709..a05b43b 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import DomainMappingsClient from .async_client import 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 index fc4c406..7bd11b6 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,10 +20,10 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.api_core import operation as gac_operation # type: ignore @@ -34,8 +32,7 @@ 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 operation as ga_operation -from google.protobuf import empty_pb2 as empty # type: ignore - +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 @@ -55,24 +52,20 @@ class DomainMappingsAsyncClient: 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 @@ -80,7 +73,8 @@ class DomainMappingsAsyncClient: @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -95,7 +89,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -112,7 +106,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> DomainMappingsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: DomainMappingsTransport: The transport used by the client instance. @@ -126,12 +120,12 @@ def transport(self) -> DomainMappingsTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, DomainMappingsTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the domain mappings client. + """Instantiates the domain mappings client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -163,7 +157,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = DomainMappingsClient( credentials=credentials, transport=transport, @@ -185,7 +178,6 @@ async def list_domain_mappings( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -201,7 +193,6 @@ async def list_domain_mappings( """ # Create or coerce a protobuf request object. - request = appengine.ListDomainMappingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -244,7 +235,6 @@ async def get_domain_mapping( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -258,7 +248,6 @@ async def get_domain_mapping( """ # Create or coerce a protobuf request object. - request = appengine.GetDomainMappingRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -298,7 +287,6 @@ async def create_domain_mapping( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -315,7 +303,6 @@ async def create_domain_mapping( """ # Create or coerce a protobuf request object. - request = appengine.CreateDomainMappingRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -364,7 +351,6 @@ async def update_domain_mapping( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -381,7 +367,6 @@ async def update_domain_mapping( """ # Create or coerce a protobuf request object. - request = appengine.UpdateDomainMappingRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -428,7 +413,6 @@ async def delete_domain_mapping( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -455,7 +439,6 @@ async def delete_domain_mapping( """ # Create or coerce a protobuf request object. - request = appengine.DeleteDomainMappingRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -479,7 +462,7 @@ async def delete_domain_mapping( response = operation_async.from_gapic( response, self._client._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) 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 569b272..01ca9eb 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -38,8 +36,7 @@ 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 operation as ga_operation -from google.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .transports.base import DomainMappingsTransport, DEFAULT_CLIENT_INFO from .transports.grpc import DomainMappingsGrpcTransport from .transports.grpc_asyncio import DomainMappingsGrpcAsyncIOTransport @@ -60,7 +57,7 @@ class DomainMappingsClientMeta(type): _transport_registry["grpc_asyncio"] = DomainMappingsGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[DomainMappingsTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -83,7 +80,8 @@ class DomainMappingsClient(metaclass=DomainMappingsClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -117,7 +115,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -134,7 +133,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -153,16 +152,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> DomainMappingsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - DomainMappingsTransport: The transport used by the client instance. + DomainMappingsTransport: The transport used by the client + instance. """ return self._transport @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -175,7 +175,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -186,7 +186,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -197,7 +197,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -208,7 +208,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -222,12 +222,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DomainMappingsTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the domain mappings client. + """Instantiates the domain mappings client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -282,9 +282,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -296,12 +297,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -316,8 +319,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -346,7 +349,6 @@ def list_domain_mappings( request (google.cloud.appengine_admin_v1.types.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. @@ -362,7 +364,6 @@ def list_domain_mappings( """ # 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 @@ -406,7 +407,6 @@ def get_domain_mapping( request (google.cloud.appengine_admin_v1.types.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. @@ -420,7 +420,6 @@ def get_domain_mapping( """ # 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 @@ -461,7 +460,6 @@ def create_domain_mapping( request (google.cloud.appengine_admin_v1.types.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. @@ -478,7 +476,6 @@ def create_domain_mapping( """ # 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 @@ -528,7 +525,6 @@ def update_domain_mapping( request (google.cloud.appengine_admin_v1.types.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. @@ -545,7 +541,6 @@ def update_domain_mapping( """ # 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 @@ -593,7 +588,6 @@ def delete_domain_mapping( request (google.cloud.appengine_admin_v1.types.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. @@ -620,7 +614,6 @@ def delete_domain_mapping( """ # 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 @@ -645,7 +638,7 @@ def delete_domain_mapping( response = gac_operation.from_gapic( response, self._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) 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 2ff7e22..478312d 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and 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 39be11c..aa6671d 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 a80a706..6e10987 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -40,6 +39,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class DomainMappingsTransport(abc.ABC): """Abstract transport class for DomainMappings.""" @@ -50,21 +60,24 @@ class DomainMappingsTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -73,7 +86,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -87,29 +100,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -146,11 +206,11 @@ def operations_client(self) -> operations_v1.OperationsClient: @property def list_domain_mappings( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.ListDomainMappingsRequest], - typing.Union[ + Union[ appengine.ListDomainMappingsResponse, - typing.Awaitable[appengine.ListDomainMappingsResponse], + Awaitable[appengine.ListDomainMappingsResponse], ], ]: raise NotImplementedError() @@ -158,38 +218,36 @@ def list_domain_mappings( @property def get_domain_mapping( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.GetDomainMappingRequest], - typing.Union[ - domain_mapping.DomainMapping, typing.Awaitable[domain_mapping.DomainMapping] - ], + Union[domain_mapping.DomainMapping, Awaitable[domain_mapping.DomainMapping]], ]: raise NotImplementedError() @property def create_domain_mapping( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.CreateDomainMappingRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def update_domain_mapping( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.UpdateDomainMappingRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def delete_domain_mapping( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.DeleteDomainMappingRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() 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 2ceae21..2bfa1a8 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 google.cloud.appengine_admin_v1.types import domain_mapping -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import DomainMappingsTransport, DEFAULT_CLIENT_INFO @@ -53,7 +50,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -67,7 +64,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -178,7 +176,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -209,13 +207,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -296,7 +296,7 @@ def get_domain_mapping( @property def create_domain_mapping( self, - ) -> Callable[[appengine.CreateDomainMappingRequest], operations.Operation]: + ) -> 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 @@ -318,14 +318,14 @@ def create_domain_mapping( self._stubs["create_domain_mapping"] = self.grpc_channel.unary_unary( "/google.appengine.v1.DomainMappings/CreateDomainMapping", request_serializer=appengine.CreateDomainMappingRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_domain_mapping"] @property def update_domain_mapping( self, - ) -> Callable[[appengine.UpdateDomainMappingRequest], operations.Operation]: + ) -> 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 @@ -348,14 +348,14 @@ def update_domain_mapping( self._stubs["update_domain_mapping"] = self.grpc_channel.unary_unary( "/google.appengine.v1.DomainMappings/UpdateDomainMapping", request_serializer=appengine.UpdateDomainMappingRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_domain_mapping"] @property def delete_domain_mapping( self, - ) -> Callable[[appengine.DeleteDomainMappingRequest], operations.Operation]: + ) -> 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 @@ -376,7 +376,7 @@ def delete_domain_mapping( self._stubs["delete_domain_mapping"] = self.grpc_channel.unary_unary( "/google.appengine.v1.DomainMappings/DeleteDomainMapping", request_serializer=appengine.DeleteDomainMappingRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_domain_mapping"] 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 15c769c..b4ed8d3 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # 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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import DomainMappingsTransport, DEFAULT_CLIENT_INFO from .grpc import DomainMappingsGrpcTransport @@ -56,7 +53,7 @@ class DomainMappingsGrpcAsyncIOTransport(DomainMappingsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -83,13 +80,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -97,7 +96,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -111,7 +110,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -170,7 +170,6 @@ def __init__( # 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 @@ -306,7 +305,7 @@ def get_domain_mapping( def create_domain_mapping( self, ) -> Callable[ - [appengine.CreateDomainMappingRequest], Awaitable[operations.Operation] + [appengine.CreateDomainMappingRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the create domain mapping method over gRPC. @@ -329,7 +328,7 @@ def create_domain_mapping( self._stubs["create_domain_mapping"] = self.grpc_channel.unary_unary( "/google.appengine.v1.DomainMappings/CreateDomainMapping", request_serializer=appengine.CreateDomainMappingRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_domain_mapping"] @@ -337,7 +336,7 @@ def create_domain_mapping( def update_domain_mapping( self, ) -> Callable[ - [appengine.UpdateDomainMappingRequest], Awaitable[operations.Operation] + [appengine.UpdateDomainMappingRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the update domain mapping method over gRPC. @@ -361,7 +360,7 @@ def update_domain_mapping( self._stubs["update_domain_mapping"] = self.grpc_channel.unary_unary( "/google.appengine.v1.DomainMappings/UpdateDomainMapping", request_serializer=appengine.UpdateDomainMappingRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_domain_mapping"] @@ -369,7 +368,7 @@ def update_domain_mapping( def delete_domain_mapping( self, ) -> Callable[ - [appengine.DeleteDomainMappingRequest], Awaitable[operations.Operation] + [appengine.DeleteDomainMappingRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the delete domain mapping method over gRPC. @@ -391,7 +390,7 @@ def delete_domain_mapping( self._stubs["delete_domain_mapping"] = self.grpc_channel.unary_unary( "/google.appengine.v1.DomainMappings/DeleteDomainMapping", request_serializer=appengine.DeleteDomainMappingRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_domain_mapping"] diff --git a/google/cloud/appengine_admin_v1/services/firewall/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/__init__.py index 25db5e3..a240af0 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/__init__.py +++ b/google/cloud/appengine_admin_v1/services/firewall/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import FirewallClient from .async_client import 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 index cc22d88..fe8786f 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,16 +20,15 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # 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.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 .client import FirewallClient @@ -62,24 +59,21 @@ class FirewallAsyncClient: 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. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -94,7 +88,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -111,7 +105,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> FirewallTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: FirewallTransport: The transport used by the client instance. @@ -125,12 +119,12 @@ def transport(self) -> FirewallTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, FirewallTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the firewall client. + """Instantiates the firewall client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -162,7 +156,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = FirewallClient( credentials=credentials, transport=transport, @@ -184,7 +177,6 @@ async def list_ingress_rules( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -200,7 +192,6 @@ async def list_ingress_rules( """ # Create or coerce a protobuf request object. - request = appengine.ListIngressRulesRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -249,7 +240,6 @@ async def batch_update_ingress_rules( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -261,7 +251,6 @@ async def batch_update_ingress_rules( 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, @@ -298,7 +287,6 @@ async def create_ingress_rule( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -314,7 +302,6 @@ async def create_ingress_rule( """ # Create or coerce a protobuf request object. - request = appengine.CreateIngressRuleRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -351,7 +338,6 @@ async def get_ingress_rule( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -367,7 +353,6 @@ async def get_ingress_rule( """ # Create or coerce a protobuf request object. - request = appengine.GetIngressRuleRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -404,7 +389,6 @@ async def update_ingress_rule( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -420,7 +404,6 @@ async def update_ingress_rule( """ # Create or coerce a protobuf request object. - request = appengine.UpdateIngressRuleRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -457,7 +440,6 @@ async def delete_ingress_rule( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -465,7 +447,6 @@ async def delete_ingress_rule( 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, diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index e170551..ba7b180 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -35,7 +33,6 @@ 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 import FirewallGrpcTransport from .transports.grpc_asyncio import FirewallGrpcAsyncIOTransport @@ -54,7 +51,7 @@ class FirewallClientMeta(type): _transport_registry["grpc_asyncio"] = FirewallGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[FirewallTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -88,7 +85,8 @@ class FirewallClient(metaclass=FirewallClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -122,7 +120,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -139,7 +138,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -158,16 +157,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> FirewallTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - FirewallTransport: The transport used by the client instance. + FirewallTransport: The transport used by the client + instance. """ return self._transport @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -180,7 +180,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -191,7 +191,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -202,7 +202,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -213,7 +213,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -227,12 +227,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, FirewallTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the firewall client. + """Instantiates the firewall client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -287,9 +287,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -301,12 +302,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -321,8 +324,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -351,7 +354,6 @@ def list_ingress_rules( request (google.cloud.appengine_admin_v1.types.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. @@ -367,7 +369,6 @@ def list_ingress_rules( """ # 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 @@ -417,7 +418,6 @@ def batch_update_ingress_rules( request (google.cloud.appengine_admin_v1.types.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. @@ -429,7 +429,6 @@ def batch_update_ingress_rules( 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 @@ -469,7 +468,6 @@ def create_ingress_rule( request (google.cloud.appengine_admin_v1.types.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. @@ -485,7 +483,6 @@ def create_ingress_rule( """ # 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 @@ -523,7 +520,6 @@ def get_ingress_rule( request (google.cloud.appengine_admin_v1.types.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. @@ -539,7 +535,6 @@ def get_ingress_rule( """ # 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 @@ -577,7 +572,6 @@ def update_ingress_rule( request (google.cloud.appengine_admin_v1.types.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. @@ -593,7 +587,6 @@ def update_ingress_rule( """ # 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 @@ -631,7 +624,6 @@ def delete_ingress_rule( request (google.cloud.appengine_admin_v1.types.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. @@ -639,7 +631,6 @@ def delete_ingress_rule( 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 diff --git a/google/cloud/appengine_admin_v1/services/firewall/pagers.py b/google/cloud/appengine_admin_v1/services/firewall/pagers.py index 27838be..81f2787 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/pagers.py +++ b/google/cloud/appengine_admin_v1/services/firewall/pagers.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and 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 a82dfe0..dc4aacd 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 a8ad7f8..c34954b 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,21 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -39,6 +38,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class FirewallTransport(abc.ABC): """Abstract transport class for Firewall.""" @@ -49,21 +59,24 @@ class FirewallTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -72,7 +85,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -86,29 +99,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -137,11 +197,11 @@ def _prep_wrapped_messages(self, client_info): @property def list_ingress_rules( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.ListIngressRulesRequest], - typing.Union[ + Union[ appengine.ListIngressRulesResponse, - typing.Awaitable[appengine.ListIngressRulesResponse], + Awaitable[appengine.ListIngressRulesResponse], ], ]: raise NotImplementedError() @@ -149,11 +209,11 @@ def list_ingress_rules( @property def batch_update_ingress_rules( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.BatchUpdateIngressRulesRequest], - typing.Union[ + Union[ appengine.BatchUpdateIngressRulesResponse, - typing.Awaitable[appengine.BatchUpdateIngressRulesResponse], + Awaitable[appengine.BatchUpdateIngressRulesResponse], ], ]: raise NotImplementedError() @@ -161,36 +221,36 @@ def batch_update_ingress_rules( @property def create_ingress_rule( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.CreateIngressRuleRequest], - typing.Union[firewall.FirewallRule, typing.Awaitable[firewall.FirewallRule]], + Union[firewall.FirewallRule, Awaitable[firewall.FirewallRule]], ]: raise NotImplementedError() @property def get_ingress_rule( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.GetIngressRuleRequest], - typing.Union[firewall.FirewallRule, typing.Awaitable[firewall.FirewallRule]], + Union[firewall.FirewallRule, Awaitable[firewall.FirewallRule]], ]: raise NotImplementedError() @property def update_ingress_rule( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.UpdateIngressRuleRequest], - typing.Union[firewall.FirewallRule, typing.Awaitable[firewall.FirewallRule]], + Union[firewall.FirewallRule, Awaitable[firewall.FirewallRule]], ]: raise NotImplementedError() @property def delete_ingress_rule( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.DeleteIngressRuleRequest], - typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], ]: raise NotImplementedError() 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 968c259..0800f20 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 google.cloud.appengine_admin_v1.types import firewall -from google.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import FirewallTransport, DEFAULT_CLIENT_INFO @@ -62,7 +59,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -76,7 +73,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -186,7 +184,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -217,13 +215,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -377,7 +377,7 @@ def update_ingress_rule( @property def delete_ingress_rule( self, - ) -> Callable[[appengine.DeleteIngressRuleRequest], empty.Empty]: + ) -> Callable[[appengine.DeleteIngressRuleRequest], empty_pb2.Empty]: r"""Return a callable for the delete ingress rule method over gRPC. Deletes the specified firewall rule. @@ -396,7 +396,7 @@ def delete_ingress_rule( self._stubs["delete_ingress_rule"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Firewall/DeleteIngressRule", request_serializer=appengine.DeleteIngressRuleRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["delete_ingress_rule"] 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 29c4f2f..854586a 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # 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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import FirewallTransport, DEFAULT_CLIENT_INFO from .grpc import FirewallGrpcTransport @@ -65,7 +62,7 @@ class FirewallGrpcAsyncIOTransport(FirewallTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -92,13 +89,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -106,7 +105,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -120,7 +119,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -178,7 +178,6 @@ def __init__( # 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 @@ -386,7 +385,7 @@ def update_ingress_rule( @property def delete_ingress_rule( self, - ) -> Callable[[appengine.DeleteIngressRuleRequest], Awaitable[empty.Empty]]: + ) -> Callable[[appengine.DeleteIngressRuleRequest], Awaitable[empty_pb2.Empty]]: r"""Return a callable for the delete ingress rule method over gRPC. Deletes the specified firewall rule. @@ -405,7 +404,7 @@ def delete_ingress_rule( self._stubs["delete_ingress_rule"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Firewall/DeleteIngressRule", request_serializer=appengine.DeleteIngressRuleRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["delete_ingress_rule"] diff --git a/google/cloud/appengine_admin_v1/services/instances/__init__.py b/google/cloud/appengine_admin_v1/services/instances/__init__.py index 5eeb8a0..9e55542 100644 --- a/google/cloud/appengine_admin_v1/services/instances/__init__.py +++ b/google/cloud/appengine_admin_v1/services/instances/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import InstancesClient from .async_client import 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 index f1fc7ef..9033e01 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,10 +20,10 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.api_core import operation as gac_operation # type: ignore @@ -34,9 +32,8 @@ 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 as empty # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore - +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 .client import InstancesClient @@ -52,25 +49,20 @@ class InstancesAsyncClient: 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 @@ -78,7 +70,8 @@ class InstancesAsyncClient: @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -93,7 +86,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -110,7 +103,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> InstancesTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: InstancesTransport: The transport used by the client instance. @@ -124,12 +117,12 @@ def transport(self) -> InstancesTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, InstancesTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the instances client. + """Instantiates the instances client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -161,7 +154,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = InstancesClient( credentials=credentials, transport=transport, @@ -187,7 +179,6 @@ async def list_instances( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -203,7 +194,6 @@ async def list_instances( """ # Create or coerce a protobuf request object. - request = appengine.ListInstancesRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -246,7 +236,6 @@ async def get_instance( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -261,7 +250,6 @@ async def get_instance( """ # Create or coerce a protobuf request object. - request = appengine.GetInstanceRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -312,7 +300,6 @@ async def delete_instance( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -339,7 +326,6 @@ async def delete_instance( """ # Create or coerce a protobuf request object. - request = appengine.DeleteInstanceRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -363,7 +349,7 @@ async def delete_instance( response = operation_async.from_gapic( response, self._client._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) @@ -393,7 +379,6 @@ async def debug_instance( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -409,7 +394,6 @@ async def debug_instance( """ # Create or coerce a protobuf request object. - request = appengine.DebugInstanceRequest(request) # Wrap the RPC method; this adds retry and timeout information, diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index e2d12f3..d834836 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -38,9 +36,8 @@ 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 as empty # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore - +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 import InstancesGrpcTransport from .transports.grpc_asyncio import InstancesGrpcAsyncIOTransport @@ -59,7 +56,7 @@ class InstancesClientMeta(type): _transport_registry["grpc_asyncio"] = InstancesGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[InstancesTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -82,7 +79,8 @@ class InstancesClient(metaclass=InstancesClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -116,7 +114,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -133,7 +132,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -152,23 +151,24 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> InstancesTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - InstancesTransport: The transport used by the client instance. + InstancesTransport: The transport used by the client + instance. """ return self._transport @staticmethod def instance_path(app: str, service: str, version: str, instance: str,) -> str: - """Return a fully-qualified instance string.""" + """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]: - """Parse a instance path into its component segments.""" + """Parses a instance path into its component segments.""" m = re.match( r"^apps/(?P.+?)/services/(?P.+?)/versions/(?P.+?)/instances/(?P.+?)$", path, @@ -177,7 +177,7 @@ def parse_instance_path(path: str) -> Dict[str, str]: @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -190,7 +190,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -201,7 +201,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -212,7 +212,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -223,7 +223,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -237,12 +237,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, InstancesTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the instances client. + """Instantiates the instances client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -297,9 +297,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -311,12 +312,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -331,8 +334,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -365,7 +368,6 @@ def list_instances( request (google.cloud.appengine_admin_v1.types.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. @@ -381,7 +383,6 @@ def list_instances( """ # 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 @@ -425,7 +426,6 @@ def get_instance( request (google.cloud.appengine_admin_v1.types.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. @@ -440,7 +440,6 @@ def get_instance( """ # 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 @@ -492,7 +491,6 @@ def delete_instance( request (google.cloud.appengine_admin_v1.types.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. @@ -519,7 +517,6 @@ def delete_instance( """ # 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 @@ -544,7 +541,7 @@ def delete_instance( response = gac_operation.from_gapic( response, self._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) @@ -574,7 +571,6 @@ def debug_instance( request (google.cloud.appengine_admin_v1.types.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. @@ -590,7 +586,6 @@ def debug_instance( """ # 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 diff --git a/google/cloud/appengine_admin_v1/services/instances/pagers.py b/google/cloud/appengine_admin_v1/services/instances/pagers.py index 56421e6..44090c2 100644 --- a/google/cloud/appengine_admin_v1/services/instances/pagers.py +++ b/google/cloud/appengine_admin_v1/services/instances/pagers.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and 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 0f3cd93..7ff9ef5 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 0d375bf..9fbb973 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -40,6 +39,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class InstancesTransport(abc.ABC): """Abstract transport class for Instances.""" @@ -50,21 +60,24 @@ class InstancesTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -73,7 +86,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -87,29 +100,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -135,11 +195,10 @@ def operations_client(self) -> operations_v1.OperationsClient: @property def list_instances( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.ListInstancesRequest], - typing.Union[ - appengine.ListInstancesResponse, - typing.Awaitable[appengine.ListInstancesResponse], + Union[ + appengine.ListInstancesResponse, Awaitable[appengine.ListInstancesResponse] ], ]: raise NotImplementedError() @@ -147,27 +206,27 @@ def list_instances( @property def get_instance( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.GetInstanceRequest], - typing.Union[instance.Instance, typing.Awaitable[instance.Instance]], + Union[instance.Instance, Awaitable[instance.Instance]], ]: raise NotImplementedError() @property def delete_instance( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.DeleteInstanceRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def debug_instance( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.DebugInstanceRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() 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 44c0c85..826c415 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 google.cloud.appengine_admin_v1.types import instance -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import InstancesTransport, DEFAULT_CLIENT_INFO @@ -53,7 +50,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -67,7 +64,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -178,7 +176,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -209,13 +207,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -298,7 +298,7 @@ def get_instance( @property def delete_instance( self, - ) -> Callable[[appengine.DeleteInstanceRequest], operations.Operation]: + ) -> Callable[[appengine.DeleteInstanceRequest], operations_pb2.Operation]: r"""Return a callable for the delete instance method over gRPC. Stops a running instance. @@ -331,14 +331,14 @@ def delete_instance( self._stubs["delete_instance"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Instances/DeleteInstance", request_serializer=appengine.DeleteInstanceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_instance"] @property def debug_instance( self, - ) -> Callable[[appengine.DebugInstanceRequest], operations.Operation]: + ) -> 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 @@ -366,7 +366,7 @@ def debug_instance( self._stubs["debug_instance"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Instances/DebugInstance", request_serializer=appengine.DebugInstanceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["debug_instance"] 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 bb55f69..5c50a41 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # 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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import InstancesTransport, DEFAULT_CLIENT_INFO from .grpc import InstancesGrpcTransport @@ -56,7 +53,7 @@ class InstancesGrpcAsyncIOTransport(InstancesTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -83,13 +80,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -97,7 +96,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -111,7 +110,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -170,7 +170,6 @@ def __init__( # 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 @@ -306,7 +305,9 @@ def get_instance( @property def delete_instance( self, - ) -> Callable[[appengine.DeleteInstanceRequest], Awaitable[operations.Operation]]: + ) -> Callable[ + [appengine.DeleteInstanceRequest], Awaitable[operations_pb2.Operation] + ]: r"""Return a callable for the delete instance method over gRPC. Stops a running instance. @@ -339,14 +340,16 @@ def delete_instance( self._stubs["delete_instance"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Instances/DeleteInstance", request_serializer=appengine.DeleteInstanceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_instance"] @property def debug_instance( self, - ) -> Callable[[appengine.DebugInstanceRequest], Awaitable[operations.Operation]]: + ) -> 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 @@ -374,7 +377,7 @@ def debug_instance( self._stubs["debug_instance"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Instances/DebugInstance", request_serializer=appengine.DebugInstanceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["debug_instance"] diff --git a/google/cloud/appengine_admin_v1/services/services/__init__.py b/google/cloud/appengine_admin_v1/services/services/__init__.py index 5b3c6b0..b902b99 100644 --- a/google/cloud/appengine_admin_v1/services/services/__init__.py +++ b/google/cloud/appengine_admin_v1/services/services/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import ServicesClient from .async_client import 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 index 2e804af..56ef3f9 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,10 +20,10 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.api_core import operation as gac_operation # type: ignore @@ -35,8 +33,7 @@ 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.protobuf import empty_pb2 as empty # type: ignore - +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 @@ -56,24 +53,21 @@ class ServicesAsyncClient: 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. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -88,7 +82,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -105,7 +99,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> ServicesTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: ServicesTransport: The transport used by the client instance. @@ -119,12 +113,12 @@ def transport(self) -> ServicesTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, ServicesTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the services client. + """Instantiates the services client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -156,7 +150,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = ServicesClient( credentials=credentials, transport=transport, @@ -178,7 +171,6 @@ async def list_services( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -194,7 +186,6 @@ async def list_services( """ # Create or coerce a protobuf request object. - request = appengine.ListServicesRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -238,7 +229,6 @@ async def get_service( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -262,7 +252,6 @@ async def get_service( """ # Create or coerce a protobuf request object. - request = appengine.GetServiceRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -299,7 +288,6 @@ async def update_service( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -322,7 +310,6 @@ async def update_service( """ # Create or coerce a protobuf request object. - request = appengine.UpdateServiceRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -368,7 +355,6 @@ async def delete_service( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -395,7 +381,6 @@ async def delete_service( """ # Create or coerce a protobuf request object. - request = appengine.DeleteServiceRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -419,7 +404,7 @@ async def delete_service( response = operation_async.from_gapic( response, self._client._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 5623ace..7f20d31 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -39,8 +37,7 @@ 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.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .transports.base import ServicesTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ServicesGrpcTransport from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport @@ -59,7 +56,7 @@ class ServicesClientMeta(type): _transport_registry["grpc_asyncio"] = ServicesGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[ServicesTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -82,7 +79,8 @@ class ServicesClient(metaclass=ServicesClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -116,7 +114,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -133,7 +132,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -152,16 +151,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> ServicesTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - ServicesTransport: The transport used by the client instance. + ServicesTransport: The transport used by the client + instance. """ return self._transport @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -174,7 +174,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -185,7 +185,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -196,7 +196,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -207,7 +207,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -221,12 +221,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ServicesTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the services client. + """Instantiates the services client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -281,9 +281,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -295,12 +296,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -315,8 +318,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -345,7 +348,6 @@ def list_services( request (google.cloud.appengine_admin_v1.types.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. @@ -361,7 +363,6 @@ def list_services( """ # 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 @@ -406,7 +407,6 @@ def get_service( request (google.cloud.appengine_admin_v1.types.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. @@ -430,7 +430,6 @@ def get_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 @@ -468,7 +467,6 @@ def update_service( request (google.cloud.appengine_admin_v1.types.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. @@ -491,7 +489,6 @@ def update_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 @@ -538,7 +535,6 @@ def delete_service( request (google.cloud.appengine_admin_v1.types.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. @@ -565,7 +561,6 @@ def delete_service( """ # 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 @@ -590,7 +585,7 @@ def delete_service( response = gac_operation.from_gapic( response, self._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) diff --git a/google/cloud/appengine_admin_v1/services/services/pagers.py b/google/cloud/appengine_admin_v1/services/services/pagers.py index 78e8351..8d17bef 100644 --- a/google/cloud/appengine_admin_v1/services/services/pagers.py +++ b/google/cloud/appengine_admin_v1/services/services/pagers.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and 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 2e08960..6e8aa5c 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 2b247bf..d38384c 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -40,6 +39,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class ServicesTransport(abc.ABC): """Abstract transport class for Services.""" @@ -50,21 +60,24 @@ class ServicesTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -73,7 +86,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -87,29 +100,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -135,11 +195,10 @@ def operations_client(self) -> operations_v1.OperationsClient: @property def list_services( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.ListServicesRequest], - typing.Union[ - appengine.ListServicesResponse, - typing.Awaitable[appengine.ListServicesResponse], + Union[ + appengine.ListServicesResponse, Awaitable[appengine.ListServicesResponse] ], ]: raise NotImplementedError() @@ -147,27 +206,27 @@ def list_services( @property def get_service( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.GetServiceRequest], - typing.Union[service.Service, typing.Awaitable[service.Service]], + Union[service.Service, Awaitable[service.Service]], ]: raise NotImplementedError() @property def update_service( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.UpdateServiceRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def delete_service( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.DeleteServiceRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() 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 4a8b139..d31349a 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 google.cloud.appengine_admin_v1.types import service -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import ServicesTransport, DEFAULT_CLIENT_INFO @@ -53,7 +50,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -67,7 +64,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -178,7 +176,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -209,13 +207,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -293,7 +293,7 @@ def get_service(self) -> Callable[[appengine.GetServiceRequest], service.Service @property def update_service( self, - ) -> Callable[[appengine.UpdateServiceRequest], operations.Operation]: + ) -> Callable[[appengine.UpdateServiceRequest], operations_pb2.Operation]: r"""Return a callable for the update service method over gRPC. Updates the configuration of the specified service. @@ -312,14 +312,14 @@ def update_service( self._stubs["update_service"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Services/UpdateService", request_serializer=appengine.UpdateServiceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_service"] @property def delete_service( self, - ) -> Callable[[appengine.DeleteServiceRequest], operations.Operation]: + ) -> Callable[[appengine.DeleteServiceRequest], operations_pb2.Operation]: r"""Return a callable for the delete service method over gRPC. Deletes the specified service and all enclosed @@ -339,7 +339,7 @@ def delete_service( self._stubs["delete_service"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Services/DeleteService", request_serializer=appengine.DeleteServiceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_service"] 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 143b085..2f107bb 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # 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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import ServicesTransport, DEFAULT_CLIENT_INFO from .grpc import ServicesGrpcTransport @@ -56,7 +53,7 @@ class ServicesGrpcAsyncIOTransport(ServicesTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -83,13 +80,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -97,7 +96,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -111,7 +110,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -170,7 +170,6 @@ def __init__( # 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 @@ -303,7 +302,9 @@ def get_service( @property def update_service( self, - ) -> Callable[[appengine.UpdateServiceRequest], Awaitable[operations.Operation]]: + ) -> 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. @@ -322,14 +323,16 @@ def update_service( self._stubs["update_service"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Services/UpdateService", request_serializer=appengine.UpdateServiceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_service"] @property def delete_service( self, - ) -> Callable[[appengine.DeleteServiceRequest], Awaitable[operations.Operation]]: + ) -> 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 @@ -349,7 +352,7 @@ def delete_service( self._stubs["delete_service"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Services/DeleteService", request_serializer=appengine.DeleteServiceRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_service"] diff --git a/google/cloud/appengine_admin_v1/services/versions/__init__.py b/google/cloud/appengine_admin_v1/services/versions/__init__.py index 93418ce..586be18 100644 --- a/google/cloud/appengine_admin_v1/services/versions/__init__.py +++ b/google/cloud/appengine_admin_v1/services/versions/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .client import VersionsClient from .async_client import 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 index dc68280..3d1a81e 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict import functools import re @@ -22,10 +20,10 @@ import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore from google.api_core import operation as gac_operation # type: ignore @@ -36,10 +34,9 @@ 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 as duration # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # 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 .transports.base import VersionsTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport from .client import VersionsClient @@ -59,24 +56,21 @@ class VersionsAsyncClient: 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. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -91,7 +85,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -108,7 +102,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> VersionsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: VersionsTransport: The transport used by the client instance. @@ -122,12 +116,12 @@ def transport(self) -> VersionsTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, VersionsTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the versions client. + """Instantiates the versions client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -159,7 +153,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = VersionsClient( credentials=credentials, transport=transport, @@ -181,7 +174,6 @@ async def list_versions( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -197,7 +189,6 @@ async def list_versions( """ # Create or coerce a protobuf request object. - request = appengine.ListVersionsRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -242,7 +233,6 @@ async def get_version( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -257,7 +247,6 @@ async def get_version( """ # Create or coerce a protobuf request object. - request = appengine.GetVersionRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -294,7 +283,6 @@ async def create_version( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -310,7 +298,6 @@ async def create_version( """ # Create or coerce a protobuf request object. - request = appengine.CreateVersionRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -390,7 +377,6 @@ async def update_version( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -406,7 +392,6 @@ async def update_version( """ # Create or coerce a protobuf request object. - request = appengine.UpdateVersionRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -451,7 +436,6 @@ async def delete_version( request (:class:`google.cloud.appengine_admin_v1.types.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. @@ -478,7 +462,6 @@ async def delete_version( """ # Create or coerce a protobuf request object. - request = appengine.DeleteVersionRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -502,7 +485,7 @@ async def delete_version( response = operation_async.from_gapic( response, self._client._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 51a4d06..ed1e086 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -23,10 +21,10 @@ import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 @@ -40,10 +38,9 @@ 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 as duration # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # 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 .transports.base import VersionsTransport, DEFAULT_CLIENT_INFO from .transports.grpc import VersionsGrpcTransport from .transports.grpc_asyncio import VersionsGrpcAsyncIOTransport @@ -62,7 +59,7 @@ class VersionsClientMeta(type): _transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[VersionsTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -85,7 +82,8 @@ class VersionsClient(metaclass=VersionsClientMeta): @staticmethod def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS 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: @@ -119,7 +117,8 @@ def _get_default_mtls_endpoint(api_endpoint): @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. + """Creates an instance of this client using the provided credentials + info. Args: info (dict): The service account private key info. @@ -136,7 +135,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials - file. + file. Args: filename (str): The path to the service account private key json @@ -155,16 +154,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> VersionsTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - VersionsTransport: The transport used by the client instance. + VersionsTransport: The transport used by the client + instance. """ return self._transport @staticmethod def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" + """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -177,7 +177,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: @staticmethod def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" + """Returns a fully-qualified folder string.""" return "folders/{folder}".format(folder=folder,) @staticmethod @@ -188,7 +188,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: @staticmethod def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" + """Returns a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,) @staticmethod @@ -199,7 +199,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: @staticmethod def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" + """Returns a fully-qualified project string.""" return "projects/{project}".format(project=project,) @staticmethod @@ -210,7 +210,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]: @staticmethod def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" + """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -224,12 +224,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, VersionsTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the versions client. + """Instantiates the versions client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -284,9 +284,10 @@ def __init__( client_cert_source_func = client_options.client_cert_source else: is_mtls = mtls.has_default_client_cert_source() - client_cert_source_func = ( - mtls.default_client_cert_source() if is_mtls else None - ) + if is_mtls: + client_cert_source_func = mtls.default_client_cert_source() + else: + client_cert_source_func = None # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -298,12 +299,14 @@ def __init__( elif use_mtls_env == "always": api_endpoint = self.DEFAULT_MTLS_ENDPOINT elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT - ) + if is_mtls: + api_endpoint = self.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = self.DEFAULT_ENDPOINT else: raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" + "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " + "values: never, auto, always" ) # Save or instantiate the transport. @@ -318,8 +321,8 @@ def __init__( ) if client_options.scopes: raise ValueError( - "When providing a transport instance, " - "provide its scopes directly." + "When providing a transport instance, provide its scopes " + "directly." ) self._transport = transport else: @@ -348,7 +351,6 @@ def list_versions( request (google.cloud.appengine_admin_v1.types.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. @@ -364,7 +366,6 @@ def list_versions( """ # 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 @@ -410,7 +411,6 @@ def get_version( request (google.cloud.appengine_admin_v1.types.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. @@ -425,7 +425,6 @@ def get_version( """ # 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 @@ -463,7 +462,6 @@ def create_version( request (google.cloud.appengine_admin_v1.types.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. @@ -479,7 +477,6 @@ def create_version( """ # 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 @@ -560,7 +557,6 @@ def update_version( request (google.cloud.appengine_admin_v1.types.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. @@ -576,7 +572,6 @@ def update_version( """ # 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 @@ -622,7 +617,6 @@ def delete_version( request (google.cloud.appengine_admin_v1.types.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. @@ -649,7 +643,6 @@ def delete_version( """ # 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 @@ -674,7 +667,7 @@ def delete_version( response = gac_operation.from_gapic( response, self._transport.operations_client, - empty.Empty, + empty_pb2.Empty, metadata_type=ga_operation.OperationMetadataV1, ) diff --git a/google/cloud/appengine_admin_v1/services/versions/pagers.py b/google/cloud/appengine_admin_v1/services/versions/pagers.py index e2be765..41cfb46 100644 --- a/google/cloud/appengine_admin_v1/services/versions/pagers.py +++ b/google/cloud/appengine_admin_v1/services/versions/pagers.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from typing import ( Any, AsyncIterable, @@ -118,7 +116,7 @@ def __init__( *, metadata: Sequence[Tuple[str, str]] = () ): - """Instantiate the pager. + """Instantiates the pager. Args: method (Callable): The method that was originally called, and 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 aa4c96b..c5a42a0 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type 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 2c3b32b..d1f014e 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc -import typing +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import packaging.version import pkg_resources -from google import auth # type: ignore -from google.api_core import exceptions # type: ignore +import google.auth # type: ignore +import google.api_core # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -40,6 +39,17 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +try: + # google.auth.__version__ was added in 1.26.0 + _GOOGLE_AUTH_VERSION = google.auth.__version__ +except AttributeError: + try: # try pkg_resources if it is available + _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version + except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GOOGLE_AUTH_VERSION = None + +_API_CORE_VERSION = google.api_core.__version__ + class VersionsTransport(abc.ABC): """Abstract transport class for Versions.""" @@ -50,21 +60,24 @@ class VersionsTransport(abc.ABC): "https://www.googleapis.com/auth/cloud-platform.read-only", ) + DEFAULT_HOST: str = "appengine.googleapis.com" + def __init__( self, *, - host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: typing.Optional[str] = None, - scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, - quota_project_id: typing.Optional[str] = None, + host: str = DEFAULT_HOST, + credentials: 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, **kwargs, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -73,7 +86,7 @@ def __init__( 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. - scope (Optional[Sequence[str]]): A list of scopes. + 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): @@ -87,29 +100,76 @@ def __init__( host += ":443" self._host = host + scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + # Save the scopes. self._scopes = scopes or self.AUTH_SCOPES # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise exceptions.DuplicateCredentialArgs( + raise core_exceptions.DuplicateCredentialArgs( "'credentials_file' and 'credentials' are mutually exclusive" ) if credentials_file is not None: - credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) elif credentials is None: - credentials, _ = auth.default( - scopes=self._scopes, quota_project_id=quota_project_id + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials + # TODO(busunkim): These two class methods are in the base transport + # to avoid duplicating code across the transport classes. These functions + # should be deleted once the minimum required versions of google-api-core + # and google-auth are increased. + + # TODO: Remove this function once google-auth >= 1.25.0 is required + @classmethod + def _get_scopes_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Optional[Sequence[str]]]: + """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" + + scopes_kwargs = {} + + if _GOOGLE_AUTH_VERSION and ( + packaging.version.parse(_GOOGLE_AUTH_VERSION) + >= packaging.version.parse("1.25.0") + ): + scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} + else: + scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} + + return scopes_kwargs + + # TODO: Remove this function once google-api-core >= 1.26.0 is required + @classmethod + def _get_self_signed_jwt_kwargs( + cls, host: str, scopes: Optional[Sequence[str]] + ) -> Dict[str, Union[Optional[Sequence[str]], str]]: + """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" + + self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} + + if _API_CORE_VERSION and ( + packaging.version.parse(_API_CORE_VERSION) + >= packaging.version.parse("1.26.0") + ): + self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES + self_signed_jwt_kwargs["scopes"] = scopes + self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST + else: + self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES + + return self_signed_jwt_kwargs + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -138,11 +198,10 @@ def operations_client(self) -> operations_v1.OperationsClient: @property def list_versions( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.ListVersionsRequest], - typing.Union[ - appengine.ListVersionsResponse, - typing.Awaitable[appengine.ListVersionsResponse], + Union[ + appengine.ListVersionsResponse, Awaitable[appengine.ListVersionsResponse] ], ]: raise NotImplementedError() @@ -150,36 +209,36 @@ def list_versions( @property def get_version( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.GetVersionRequest], - typing.Union[version.Version, typing.Awaitable[version.Version]], + Union[version.Version, Awaitable[version.Version]], ]: raise NotImplementedError() @property def create_version( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.CreateVersionRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def update_version( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.UpdateVersionRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() @property def delete_version( self, - ) -> typing.Callable[ + ) -> Callable[ [appengine.DeleteVersionRequest], - typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], ]: raise NotImplementedError() 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 f6a34ef..36bfeee 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple +from typing import Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +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 google.cloud.appengine_admin_v1.types import version -from google.longrunning import operations_pb2 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import VersionsTransport, DEFAULT_CLIENT_INFO @@ -53,7 +50,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -67,7 +64,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -178,7 +176,7 @@ def __init__( def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -209,13 +207,15 @@ def create_channel( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -294,7 +294,7 @@ def get_version(self) -> Callable[[appengine.GetVersionRequest], version.Version @property def create_version( self, - ) -> Callable[[appengine.CreateVersionRequest], operations.Operation]: + ) -> 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. @@ -313,14 +313,14 @@ def create_version( self._stubs["create_version"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Versions/CreateVersion", request_serializer=appengine.CreateVersionRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_version"] @property def update_version( self, - ) -> Callable[[appengine.UpdateVersionRequest], operations.Operation]: + ) -> 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 @@ -374,14 +374,14 @@ def update_version( self._stubs["update_version"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Versions/UpdateVersion", request_serializer=appengine.UpdateVersionRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_version"] @property def delete_version( self, - ) -> Callable[[appengine.DeleteVersionRequest], operations.Operation]: + ) -> Callable[[appengine.DeleteVersionRequest], operations_pb2.Operation]: r"""Return a callable for the delete version method over gRPC. Deletes an existing Version resource. @@ -400,7 +400,7 @@ def delete_version( self._stubs["delete_version"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Versions/DeleteVersion", request_serializer=appengine.DeleteVersionRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_version"] 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 2a23e5a..20c53e8 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # 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 +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +import packaging.version 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 as operations # type: ignore - +from google.longrunning import operations_pb2 # type: ignore from .base import VersionsTransport, DEFAULT_CLIENT_INFO from .grpc import VersionsGrpcTransport @@ -56,7 +53,7 @@ class VersionsGrpcAsyncIOTransport(VersionsTransport): def create_channel( cls, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -83,13 +80,15 @@ def create_channel( Returns: aio.Channel: A gRPC AsyncIO channel object. """ - scopes = scopes or cls.AUTH_SCOPES + + self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) + return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, - scopes=scopes, quota_project_id=quota_project_id, + **self_signed_jwt_kwargs, **kwargs, ) @@ -97,7 +96,7 @@ def __init__( self, *, host: str = "appengine.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, @@ -111,7 +110,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + 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 @@ -170,7 +170,6 @@ def __init__( # 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 @@ -304,7 +303,9 @@ def get_version( @property def create_version( self, - ) -> Callable[[appengine.CreateVersionRequest], Awaitable[operations.Operation]]: + ) -> 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. @@ -323,14 +324,16 @@ def create_version( self._stubs["create_version"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Versions/CreateVersion", request_serializer=appengine.CreateVersionRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_version"] @property def update_version( self, - ) -> Callable[[appengine.UpdateVersionRequest], Awaitable[operations.Operation]]: + ) -> 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 @@ -384,14 +387,16 @@ def update_version( self._stubs["update_version"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Versions/UpdateVersion", request_serializer=appengine.UpdateVersionRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_version"] @property def delete_version( self, - ) -> Callable[[appengine.DeleteVersionRequest], Awaitable[operations.Operation]]: + ) -> Callable[ + [appengine.DeleteVersionRequest], Awaitable[operations_pb2.Operation] + ]: r"""Return a callable for the delete version method over gRPC. Deletes an existing Version resource. @@ -410,7 +415,7 @@ def delete_version( self._stubs["delete_version"] = self.grpc_channel.unary_unary( "/google.appengine.v1.Versions/DeleteVersion", request_serializer=appengine.DeleteVersionRequest.serialize, - response_deserializer=operations.Operation.FromString, + response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_version"] diff --git a/google/cloud/appengine_admin_v1/types/__init__.py b/google/cloud/appengine_admin_v1/types/__init__.py index c0c28ec..dfe79d6 100644 --- a/google/cloud/appengine_admin_v1/types/__init__.py +++ b/google/cloud/appengine_admin_v1/types/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from .app_yaml import ( ApiConfigHandler, ApiEndpointHandler, diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index a9fc8d2..9c7f879 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import duration_pb2 # type: ignore __protobuf__ = proto.module( @@ -88,19 +85,14 @@ class ApiConfigHandler(proto.Message): """ auth_fail_action = proto.Field(proto.ENUM, number=1, enum="AuthFailAction",) - login = proto.Field(proto.ENUM, number=2, enum="LoginRequirement",) - - script = proto.Field(proto.STRING, number=3) - + script = proto.Field(proto.STRING, number=3,) security_level = proto.Field(proto.ENUM, number=4, enum="SecurityLevel",) - - url = proto.Field(proto.STRING, number=5) + url = 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. @@ -121,10 +113,8 @@ class ErrorCode(proto.Enum): ERROR_CODE_TIMEOUT = 3 error_code = proto.Field(proto.ENUM, number=1, enum=ErrorCode,) - - static_file = proto.Field(proto.STRING, number=2) - - mime_type = proto.Field(proto.STRING, number=3) + static_file = proto.Field(proto.STRING, number=2,) + mime_type = proto.Field(proto.STRING, number=3,) class UrlMap(proto.Message): @@ -173,26 +163,19 @@ class RedirectHttpResponseCode(proto.Enum): REDIRECT_HTTP_RESPONSE_CODE_303 = 3 REDIRECT_HTTP_RESPONSE_CODE_307 = 4 - url_regex = proto.Field(proto.STRING, number=1) - + url_regex = proto.Field(proto.STRING, number=1,) static_files = proto.Field( proto.MESSAGE, number=2, oneof="handler_type", message="StaticFilesHandler", ) - script = proto.Field( proto.MESSAGE, number=3, oneof="handler_type", message="ScriptHandler", ) - api_endpoint = proto.Field( proto.MESSAGE, number=4, oneof="handler_type", message="ApiEndpointHandler", ) - security_level = proto.Field(proto.ENUM, number=5, enum="SecurityLevel",) - login = proto.Field(proto.ENUM, number=6, enum="LoginRequirement",) - auth_fail_action = proto.Field(proto.ENUM, number=7, enum="AuthFailAction",) - redirect_http_response_code = proto.Field( proto.ENUM, number=8, enum=RedirectHttpResponseCode, ) @@ -239,19 +222,13 @@ class StaticFilesHandler(proto.Message): resource quotas. """ - path = proto.Field(proto.STRING, number=1) - - upload_path_regex = proto.Field(proto.STRING, number=2) - - http_headers = proto.MapField(proto.STRING, proto.STRING, number=3) - - mime_type = proto.Field(proto.STRING, number=4) - - expiration = proto.Field(proto.MESSAGE, number=5, message=duration.Duration,) - - require_matching_file = proto.Field(proto.BOOL, number=6) - - application_readable = proto.Field(proto.BOOL, number=7) + path = proto.Field(proto.STRING, number=1,) + upload_path_regex = proto.Field(proto.STRING, number=2,) + http_headers = proto.MapField(proto.STRING, proto.STRING, number=3,) + mime_type = proto.Field(proto.STRING, number=4,) + expiration = proto.Field(proto.MESSAGE, number=5, message=duration_pb2.Duration,) + require_matching_file = proto.Field(proto.BOOL, number=6,) + application_readable = proto.Field(proto.BOOL, number=7,) class ScriptHandler(proto.Message): @@ -264,19 +241,18 @@ class ScriptHandler(proto.Message): directory. """ - script_path = proto.Field(proto.STRING, number=1) + script_path = 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 = proto.Field(proto.STRING, number=1) + script_path = proto.Field(proto.STRING, number=1,) class HealthCheck(proto.Message): @@ -307,19 +283,15 @@ class HealthCheck(proto.Message): failed. """ - disable_health_check = proto.Field(proto.BOOL, number=1) - - host = proto.Field(proto.STRING, number=2) - - healthy_threshold = proto.Field(proto.UINT32, number=3) - - unhealthy_threshold = proto.Field(proto.UINT32, number=4) - - restart_threshold = proto.Field(proto.UINT32, number=5) - - check_interval = proto.Field(proto.MESSAGE, number=6, message=duration.Duration,) - - timeout = proto.Field(proto.MESSAGE, number=7, message=duration.Duration,) + disable_health_check = proto.Field(proto.BOOL, number=1,) + host = proto.Field(proto.STRING, number=2,) + healthy_threshold = proto.Field(proto.UINT32, number=3,) + unhealthy_threshold = proto.Field(proto.UINT32, number=4,) + restart_threshold = proto.Field(proto.UINT32, number=5,) + check_interval = proto.Field( + proto.MESSAGE, number=6, message=duration_pb2.Duration, + ) + timeout = proto.Field(proto.MESSAGE, number=7, message=duration_pb2.Duration,) class ReadinessCheck(proto.Message): @@ -349,19 +321,17 @@ class ReadinessCheck(proto.Message): healthcheck until it is ready to serve traffic. """ - path = proto.Field(proto.STRING, number=1) - - host = proto.Field(proto.STRING, number=2) - - failure_threshold = proto.Field(proto.UINT32, number=3) - - success_threshold = proto.Field(proto.UINT32, number=4) - - check_interval = proto.Field(proto.MESSAGE, number=5, message=duration.Duration,) - - timeout = proto.Field(proto.MESSAGE, number=6, message=duration.Duration,) - - app_start_timeout = proto.Field(proto.MESSAGE, number=7, message=duration.Duration,) + path = proto.Field(proto.STRING, number=1,) + host = proto.Field(proto.STRING, number=2,) + failure_threshold = proto.Field(proto.UINT32, number=3,) + success_threshold = proto.Field(proto.UINT32, number=4,) + check_interval = proto.Field( + proto.MESSAGE, number=5, message=duration_pb2.Duration, + ) + timeout = proto.Field(proto.MESSAGE, number=6, message=duration_pb2.Duration,) + app_start_timeout = proto.Field( + proto.MESSAGE, number=7, message=duration_pb2.Duration, + ) class LivenessCheck(proto.Message): @@ -389,19 +359,15 @@ class LivenessCheck(proto.Message): the checks. """ - path = proto.Field(proto.STRING, number=1) - - host = proto.Field(proto.STRING, number=2) - - failure_threshold = proto.Field(proto.UINT32, number=3) - - success_threshold = proto.Field(proto.UINT32, number=4) - - check_interval = proto.Field(proto.MESSAGE, number=5, message=duration.Duration,) - - timeout = proto.Field(proto.MESSAGE, number=6, message=duration.Duration,) - - initial_delay = proto.Field(proto.MESSAGE, number=7, message=duration.Duration,) + path = proto.Field(proto.STRING, number=1,) + host = proto.Field(proto.STRING, number=2,) + failure_threshold = proto.Field(proto.UINT32, number=3,) + success_threshold = proto.Field(proto.UINT32, number=4,) + check_interval = proto.Field( + proto.MESSAGE, number=5, message=duration_pb2.Duration, + ) + timeout = proto.Field(proto.MESSAGE, number=6, message=duration_pb2.Duration,) + initial_delay = proto.Field(proto.MESSAGE, number=7, message=duration_pb2.Duration,) class Library(proto.Message): @@ -416,9 +382,8 @@ class Library(proto.Message): "latest". """ - name = proto.Field(proto.STRING, number=1) - - version = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + version = 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 index 4f154e1..e50ef77 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,10 +13,8 @@ # 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 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 @@ -26,7 +23,7 @@ from google.cloud.appengine_admin_v1.types import 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 as field_mask # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore __protobuf__ = proto.module( @@ -106,19 +103,17 @@ class DomainOverrideStrategy(proto.Enum): class GetApplicationRequest(proto.Message): r"""Request message for ``Applications.GetApplication``. - Attributes: name (str): Name of the Application resource to get. Example: ``apps/myapp``. """ - name = proto.Field(proto.STRING, number=1) + name = 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. @@ -131,7 +126,6 @@ class CreateApplicationRequest(proto.Message): class UpdateApplicationRequest(proto.Message): r"""Request message for ``Applications.UpdateApplication``. - Attributes: name (str): Name of the Application resource to update. Example: @@ -144,29 +138,27 @@ class UpdateApplicationRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) application = proto.Field( proto.MESSAGE, number=2, message=ga_application.Application, ) - - update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + update_mask = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -178,16 +170,13 @@ class ListServicesRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1) - - page_size = proto.Field(proto.INT32, number=2) - - page_token = proto.Field(proto.STRING, number=3) + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) class ListServicesResponse(proto.Message): r"""Response message for ``Services.ListServices``. - Attributes: services (Sequence[google.cloud.appengine_admin_v1.types.Service]): The services belonging to the requested @@ -202,25 +191,22 @@ def raw_page(self): return self services = proto.RepeatedField(proto.MESSAGE, number=1, message=ga_service.Service,) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -249,30 +235,27 @@ class UpdateServiceRequest(proto.Message): Traffic `__. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) service = proto.Field(proto.MESSAGE, number=2, message=ga_service.Service,) - - update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) - - migrate_traffic = proto.Field(proto.BOOL, number=4) + update_mask = proto.Field( + proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + ) + migrate_traffic = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -287,18 +270,14 @@ class ListVersionsRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1) - + parent = proto.Field(proto.STRING, number=1,) view = proto.Field(proto.ENUM, number=2, enum="VersionView",) - - page_size = proto.Field(proto.INT32, number=3) - - page_token = proto.Field(proto.STRING, number=4) + page_size = proto.Field(proto.INT32, number=3,) + page_token = proto.Field(proto.STRING, number=4,) class ListVersionsResponse(proto.Message): r"""Response message for ``Versions.ListVersions``. - Attributes: versions (Sequence[google.cloud.appengine_admin_v1.types.Version]): The versions belonging to the requested @@ -313,13 +292,11 @@ def raw_page(self): return self versions = proto.RepeatedField(proto.MESSAGE, number=1, message=ga_version.Version,) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = 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: @@ -328,14 +305,12 @@ class GetVersionRequest(proto.Message): Controls the set of fields returned in the ``Get`` response. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) view = 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. @@ -344,14 +319,12 @@ class CreateVersionRequest(proto.Message): Application deployment configuration. """ - parent = proto.Field(proto.STRING, number=1) - + parent = proto.Field(proto.STRING, number=1,) 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: @@ -365,28 +338,26 @@ class UpdateVersionRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) version = proto.Field(proto.MESSAGE, number=2, message=ga_version.Version,) - - update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + update_mask = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -398,16 +369,13 @@ class ListInstancesRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1) - - page_size = proto.Field(proto.INT32, number=2) - - page_token = proto.Field(proto.STRING, number=3) + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) class ListInstancesResponse(proto.Message): r"""Response message for ``Instances.ListInstances``. - Attributes: instances (Sequence[google.cloud.appengine_admin_v1.types.Instance]): The instances belonging to the requested @@ -422,37 +390,33 @@ def raw_page(self): return self instances = proto.RepeatedField(proto.MESSAGE, number=1, message=instance.Instance,) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = 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 = proto.Field(proto.STRING, number=1) + name = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -467,14 +431,12 @@ class DebugInstanceRequest(proto.Message): Keys `__. """ - name = proto.Field(proto.STRING, number=1) - - ssh_key = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + ssh_key = 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: @@ -491,18 +453,14 @@ class ListIngressRulesRequest(proto.Message): on requests from this IP. """ - parent = proto.Field(proto.STRING, number=1) - - page_size = proto.Field(proto.INT32, number=2) - - page_token = proto.Field(proto.STRING, number=3) - - matching_address = proto.Field(proto.STRING, number=4) + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) + matching_address = proto.Field(proto.STRING, number=4,) class ListIngressRulesResponse(proto.Message): r"""Response message for ``Firewall.ListIngressRules``. - Attributes: ingress_rules (Sequence[google.cloud.appengine_admin_v1.types.FirewallRule]): The ingress FirewallRules for this @@ -519,13 +477,11 @@ def raw_page(self): ingress_rules = proto.RepeatedField( proto.MESSAGE, number=1, message=firewall.FirewallRule, ) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = 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: @@ -535,8 +491,7 @@ class BatchUpdateIngressRulesRequest(proto.Message): existing set. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) ingress_rules = proto.RepeatedField( proto.MESSAGE, number=2, message=firewall.FirewallRule, ) @@ -544,7 +499,6 @@ class BatchUpdateIngressRulesRequest(proto.Message): class BatchUpdateIngressRulesResponse(proto.Message): r"""Response message for ``Firewall.UpdateAllIngressRules``. - Attributes: ingress_rules (Sequence[google.cloud.appengine_admin_v1.types.FirewallRule]): The full list of ingress FirewallRules for @@ -558,7 +512,6 @@ class BatchUpdateIngressRulesResponse(proto.Message): class CreateIngressRuleRequest(proto.Message): r"""Request message for ``Firewall.CreateIngressRule``. - Attributes: parent (str): Name of the parent Firewall collection in which to create a @@ -578,26 +531,23 @@ class CreateIngressRuleRequest(proto.Message): or deny-all rule. """ - parent = proto.Field(proto.STRING, number=1) - + parent = proto.Field(proto.STRING, number=1,) rule = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -610,28 +560,26 @@ class UpdateIngressRuleRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) rule = proto.Field(proto.MESSAGE, number=2, message=firewall.FirewallRule,) - - update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + update_mask = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -643,16 +591,13 @@ class ListAuthorizedDomainsRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1) - - page_size = proto.Field(proto.INT32, number=2) - - page_token = proto.Field(proto.STRING, number=3) + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) class ListAuthorizedDomainsResponse(proto.Message): r"""Response message for ``AuthorizedDomains.ListAuthorizedDomains``. - Attributes: domains (Sequence[google.cloud.appengine_admin_v1.types.AuthorizedDomain]): The authorized domains belonging to the user. @@ -668,8 +613,7 @@ def raw_page(self): domains = proto.RepeatedField( proto.MESSAGE, number=1, message=domain.AuthorizedDomain, ) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = proto.Field(proto.STRING, number=2,) class ListAuthorizedCertificatesRequest(proto.Message): @@ -690,13 +634,10 @@ class ListAuthorizedCertificatesRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1) - + parent = proto.Field(proto.STRING, number=1,) view = proto.Field(proto.ENUM, number=4, enum="AuthorizedCertificateView",) - - page_size = proto.Field(proto.INT32, number=2) - - page_token = proto.Field(proto.STRING, number=3) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) class ListAuthorizedCertificatesResponse(proto.Message): @@ -719,8 +660,7 @@ def raw_page(self): certificates = proto.RepeatedField( proto.MESSAGE, number=1, message=ga_certificate.AuthorizedCertificate, ) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = proto.Field(proto.STRING, number=2,) class GetAuthorizedCertificateRequest(proto.Message): @@ -735,8 +675,7 @@ class GetAuthorizedCertificateRequest(proto.Message): Controls the set of fields returned in the ``GET`` response. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) view = proto.Field(proto.ENUM, number=2, enum="AuthorizedCertificateView",) @@ -752,8 +691,7 @@ class CreateAuthorizedCertificateRequest(proto.Message): SSL certificate data. """ - parent = proto.Field(proto.STRING, number=1) - + parent = proto.Field(proto.STRING, number=1,) certificate = proto.Field( proto.MESSAGE, number=2, message=ga_certificate.AuthorizedCertificate, ) @@ -776,13 +714,13 @@ class UpdateAuthorizedCertificateRequest(proto.Message): and ``display_name`` fields. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) certificate = proto.Field( proto.MESSAGE, number=2, message=ga_certificate.AuthorizedCertificate, ) - - update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + update_mask = proto.Field( + proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + ) class DeleteAuthorizedCertificateRequest(proto.Message): @@ -795,12 +733,11 @@ class DeleteAuthorizedCertificateRequest(proto.Message): ``apps/myapp/authorizedCertificates/12345``. """ - name = proto.Field(proto.STRING, number=1) + name = 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: @@ -812,16 +749,13 @@ class ListDomainMappingsRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1) - - page_size = proto.Field(proto.INT32, number=2) - - page_token = proto.Field(proto.STRING, number=3) + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) class ListDomainMappingsResponse(proto.Message): r"""Response message for ``DomainMappings.ListDomainMappings``. - Attributes: domain_mappings (Sequence[google.cloud.appengine_admin_v1.types.DomainMapping]): The domain mappings for the application. @@ -837,25 +771,22 @@ def raw_page(self): domain_mappings = proto.RepeatedField( proto.MESSAGE, number=1, message=ga_domain_mapping.DomainMapping, ) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = 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 = proto.Field(proto.STRING, number=1) + name = 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: @@ -868,12 +799,10 @@ class CreateDomainMappingRequest(proto.Message): default, overrides are rejected. """ - parent = proto.Field(proto.STRING, number=1) - + parent = proto.Field(proto.STRING, number=1,) domain_mapping = proto.Field( proto.MESSAGE, number=2, message=ga_domain_mapping.DomainMapping, ) - override_strategy = proto.Field( proto.ENUM, number=4, enum="DomainOverrideStrategy", ) @@ -881,7 +810,6 @@ class CreateDomainMappingRequest(proto.Message): class UpdateDomainMappingRequest(proto.Message): r"""Request message for ``DomainMappings.UpdateDomainMapping``. - Attributes: name (str): Name of the resource to update. Example: @@ -895,25 +823,24 @@ class UpdateDomainMappingRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1) - + name = proto.Field(proto.STRING, number=1,) domain_mapping = proto.Field( proto.MESSAGE, number=2, message=ga_domain_mapping.DomainMapping, ) - - update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + update_mask = 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 = proto.Field(proto.STRING, number=1) + name = 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 index 99939c2..89ee559 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import duration_pb2 # type: ignore __protobuf__ = proto.module( @@ -113,7 +110,6 @@ class DatabaseType(proto.Enum): class IdentityAwareProxy(proto.Message): r"""Identity-Aware Proxy - Attributes: enabled (bool): Whether the serving infrastructure will authenticate and @@ -138,13 +134,10 @@ class IdentityAwareProxy(proto.Message): @OutputOnly """ - enabled = proto.Field(proto.BOOL, number=1) - - oauth2_client_id = proto.Field(proto.STRING, number=2) - - oauth2_client_secret = proto.Field(proto.STRING, number=3) - - oauth2_client_secret_sha256 = proto.Field(proto.STRING, number=4) + enabled = proto.Field(proto.BOOL, number=1,) + oauth2_client_id = proto.Field(proto.STRING, number=2,) + oauth2_client_secret = proto.Field(proto.STRING, number=3,) + oauth2_client_secret_sha256 = proto.Field(proto.STRING, number=4,) class FeatureSettings(proto.Message): r"""The feature specific settings to be used in the application. @@ -164,40 +157,26 @@ class FeatureSettings(proto.Message): base image for VMs, rather than a base Debian image. """ - split_health_checks = proto.Field(proto.BOOL, number=1) - - use_container_optimized_os = proto.Field(proto.BOOL, number=2) - - name = proto.Field(proto.STRING, number=1) - - id = proto.Field(proto.STRING, number=2) + split_health_checks = proto.Field(proto.BOOL, number=1,) + use_container_optimized_os = proto.Field(proto.BOOL, number=2,) + name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.STRING, number=2,) dispatch_rules = proto.RepeatedField( proto.MESSAGE, number=3, message="UrlDispatchRule", ) - - auth_domain = proto.Field(proto.STRING, number=6) - - location_id = proto.Field(proto.STRING, number=7) - - code_bucket = proto.Field(proto.STRING, number=8) - + auth_domain = proto.Field(proto.STRING, number=6,) + location_id = proto.Field(proto.STRING, number=7,) + code_bucket = proto.Field(proto.STRING, number=8,) default_cookie_expiration = proto.Field( - proto.MESSAGE, number=9, message=duration.Duration, + proto.MESSAGE, number=9, message=duration_pb2.Duration, ) - serving_status = proto.Field(proto.ENUM, number=10, enum=ServingStatus,) - - default_hostname = proto.Field(proto.STRING, number=11) - - default_bucket = proto.Field(proto.STRING, number=12) - + default_hostname = proto.Field(proto.STRING, number=11,) + default_bucket = proto.Field(proto.STRING, number=12,) iap = proto.Field(proto.MESSAGE, number=14, message=IdentityAwareProxy,) - - gcr_domain = proto.Field(proto.STRING, number=16) - + gcr_domain = proto.Field(proto.STRING, number=16,) database_type = proto.Field(proto.ENUM, number=17, enum=DatabaseType,) - feature_settings = proto.Field(proto.MESSAGE, number=18, message=FeatureSettings,) @@ -223,11 +202,9 @@ class UrlDispatchRule(proto.Message): Example: ``default``. """ - domain = proto.Field(proto.STRING, number=1) - - path = proto.Field(proto.STRING, number=2) - - service = proto.Field(proto.STRING, number=3) + domain = proto.Field(proto.STRING, number=1,) + path = proto.Field(proto.STRING, number=2,) + service = 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 index ddc4261..c99e43a 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,10 +13,8 @@ # 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 appengine @@ -29,7 +26,6 @@ class AuditData(proto.Message): r"""App Engine admin service audit log. - Attributes: update_service (google.cloud.appengine_admin_v1.types.UpdateServiceMethod): Detailed information about UpdateService @@ -42,7 +38,6 @@ class AuditData(proto.Message): update_service = proto.Field( proto.MESSAGE, number=1, oneof="method", message="UpdateServiceMethod", ) - create_version = proto.Field( proto.MESSAGE, number=2, oneof="method", message="CreateVersionMethod", ) @@ -50,7 +45,6 @@ class AuditData(proto.Message): class UpdateServiceMethod(proto.Message): r"""Detailed information about UpdateService call. - Attributes: request (google.cloud.appengine_admin_v1.types.UpdateServiceRequest): Update service request. @@ -63,7 +57,6 @@ class UpdateServiceMethod(proto.Message): class CreateVersionMethod(proto.Message): r"""Detailed information about CreateVersion call. - Attributes: request (google.cloud.appengine_admin_v1.types.CreateVersionRequest): Create version request. diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index 0a9e070..4d28039 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore __protobuf__ = proto.module( @@ -117,32 +114,23 @@ class AuthorizedCertificate(proto.Message): @OutputOnly """ - name = proto.Field(proto.STRING, number=1) - - id = proto.Field(proto.STRING, number=2) - - display_name = proto.Field(proto.STRING, number=3) - - domain_names = proto.RepeatedField(proto.STRING, number=4) - - expire_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,) - + name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.STRING, number=2,) + display_name = proto.Field(proto.STRING, number=3,) + domain_names = proto.RepeatedField(proto.STRING, number=4,) + expire_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) certificate_raw_data = proto.Field( proto.MESSAGE, number=6, message="CertificateRawData", ) - managed_certificate = proto.Field( proto.MESSAGE, number=7, message="ManagedCertificate", ) - - visible_domain_mappings = proto.RepeatedField(proto.STRING, number=8) - - domain_mappings_count = proto.Field(proto.INT32, number=9) + visible_domain_mappings = proto.RepeatedField(proto.STRING, number=8,) + domain_mappings_count = 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 @@ -173,14 +161,12 @@ class CertificateRawData(proto.Message): @InputOnly """ - public_certificate = proto.Field(proto.STRING, number=1) - - private_key = proto.Field(proto.STRING, number=2) + public_certificate = proto.Field(proto.STRING, number=1,) + private_key = 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 @@ -197,9 +183,8 @@ class ManagedCertificate(proto.Message): """ last_renewal_time = proto.Field( - proto.MESSAGE, number=1, message=timestamp.Timestamp, + proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - status = 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 c368062..6345d8f 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import duration_pb2 # type: ignore __protobuf__ = proto.module( @@ -60,11 +57,8 @@ class Deployment(proto.Message): """ files = proto.MapField(proto.STRING, proto.MESSAGE, number=1, message="FileInfo",) - container = proto.Field(proto.MESSAGE, number=2, message="ContainerInfo",) - zip_ = proto.Field(proto.MESSAGE, number=3, message="ZipInfo",) - cloud_build_options = proto.Field( proto.MESSAGE, number=6, message="CloudBuildOptions", ) @@ -88,11 +82,9 @@ class FileInfo(proto.Message): Defaults to the value from Google Cloud Storage. """ - source_url = proto.Field(proto.STRING, number=1) - - sha1_sum = proto.Field(proto.STRING, number=2) - - mime_type = proto.Field(proto.STRING, number=3) + source_url = proto.Field(proto.STRING, number=1,) + sha1_sum = proto.Field(proto.STRING, number=2,) + mime_type = proto.Field(proto.STRING, number=3,) class ContainerInfo(proto.Message): @@ -109,7 +101,7 @@ class ContainerInfo(proto.Message): project/image@digest". """ - image = proto.Field(proto.STRING, number=1) + image = proto.Field(proto.STRING, number=1,) class CloudBuildOptions(proto.Message): @@ -132,16 +124,14 @@ class CloudBuildOptions(proto.Message): Defaults to 10 minutes. """ - app_yaml_path = proto.Field(proto.STRING, number=1) - + app_yaml_path = proto.Field(proto.STRING, number=1,) cloud_build_timeout = proto.Field( - proto.MESSAGE, number=2, message=duration.Duration, + 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 @@ -156,9 +146,8 @@ class ZipInfo(proto.Message): provided, deployment may be slow. """ - source_url = proto.Field(proto.STRING, number=3) - - files_count = proto.Field(proto.INT32, number=4) + source_url = proto.Field(proto.STRING, number=3,) + files_count = 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 index 1f17c4b..3b05140 100644 --- a/google/cloud/appengine_admin_v1/types/deployed_files.py +++ b/google/cloud/appengine_admin_v1/types/deployed_files.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py index 024bb6a..ea6c8f4 100644 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ b/google/cloud/appengine_admin_v1/types/domain.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore @@ -39,9 +37,8 @@ class AuthorizedDomain(proto.Message): use. Example: ``example.com``. """ - name = proto.Field(proto.STRING, number=1) - - id = proto.Field(proto.STRING, number=2) + name = proto.Field(proto.STRING, number=1,) + id = 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 index c08953b..bfa48da 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore @@ -26,7 +24,6 @@ class DomainMapping(proto.Message): r"""A domain serving an App Engine application. - Attributes: name (str): Full path to the ``DomainMapping`` resource in the API. @@ -48,12 +45,9 @@ class DomainMapping(proto.Message): @OutputOnly """ - name = proto.Field(proto.STRING, number=1) - - id = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.STRING, number=2,) ssl_settings = proto.Field(proto.MESSAGE, number=3, message="SslSettings",) - resource_records = proto.RepeatedField( proto.MESSAGE, number=4, message="ResourceRecord", ) @@ -61,7 +55,6 @@ class DomainMapping(proto.Message): class SslSettings(proto.Message): r"""SSL configuration for a ``DomainMapping`` resource. - Attributes: certificate_id (str): ID of the ``AuthorizedCertificate`` resource configuring SSL @@ -100,16 +93,13 @@ class SslManagementType(proto.Enum): AUTOMATIC = 1 MANUAL = 2 - certificate_id = proto.Field(proto.STRING, number=1) - + certificate_id = proto.Field(proto.STRING, number=1,) ssl_management_type = proto.Field(proto.ENUM, number=3, enum=SslManagementType,) - - pending_managed_certificate_id = proto.Field(proto.STRING, number=4) + pending_managed_certificate_id = 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 @@ -129,10 +119,8 @@ class RecordType(proto.Enum): AAAA = 2 CNAME = 3 - name = proto.Field(proto.STRING, number=1) - - rrdata = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + rrdata = proto.Field(proto.STRING, number=2,) type_ = 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 e3b179b..175346e 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore @@ -62,13 +60,10 @@ class Action(proto.Enum): ALLOW = 1 DENY = 2 - priority = proto.Field(proto.INT32, number=1) - + priority = proto.Field(proto.INT32, number=1,) action = proto.Field(proto.ENUM, number=2, enum=Action,) - - source_range = proto.Field(proto.STRING, number=3) - - description = proto.Field(proto.STRING, number=4) + source_range = proto.Field(proto.STRING, number=3,) + description = 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 index 72422cf..2311bb9 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore __protobuf__ = proto.module(package="google.appengine.v1", manifest={"Instance",},) @@ -96,7 +93,7 @@ class Availability(proto.Enum): DYNAMIC = 2 class Liveness(proto.Message): - r"""Wrapper for LivenessState enum.""" + r"""Wrapper for LivenessState enum. """ class LivenessState(proto.Enum): r"""Liveness health check status for Flex instances.""" @@ -107,38 +104,22 @@ class LivenessState(proto.Enum): DRAINING = 4 TIMEOUT = 5 - name = proto.Field(proto.STRING, number=1) - - id = proto.Field(proto.STRING, number=2) - - app_engine_release = proto.Field(proto.STRING, number=3) - + name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.STRING, number=2,) + app_engine_release = proto.Field(proto.STRING, number=3,) availability = proto.Field(proto.ENUM, number=4, enum=Availability,) - - vm_name = proto.Field(proto.STRING, number=5) - - vm_zone_name = proto.Field(proto.STRING, number=6) - - vm_id = proto.Field(proto.STRING, number=7) - - start_time = proto.Field(proto.MESSAGE, number=8, message=timestamp.Timestamp,) - - requests = proto.Field(proto.INT32, number=9) - - errors = proto.Field(proto.INT32, number=10) - - qps = proto.Field(proto.FLOAT, number=11) - - average_latency = proto.Field(proto.INT32, number=12) - - memory_usage = proto.Field(proto.INT64, number=13) - - vm_status = proto.Field(proto.STRING, number=14) - - vm_debug_enabled = proto.Field(proto.BOOL, number=15) - - vm_ip = proto.Field(proto.STRING, number=16) - + vm_name = proto.Field(proto.STRING, number=5,) + vm_zone_name = proto.Field(proto.STRING, number=6,) + vm_id = proto.Field(proto.STRING, number=7,) + start_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) + requests = proto.Field(proto.INT32, number=9,) + errors = proto.Field(proto.INT32, number=10,) + qps = proto.Field(proto.FLOAT, number=11,) + average_latency = proto.Field(proto.INT32, number=12,) + memory_usage = proto.Field(proto.INT64, number=13,) + vm_status = proto.Field(proto.STRING, number=14,) + vm_debug_enabled = proto.Field(proto.BOOL, number=15,) + vm_ip = proto.Field(proto.STRING, number=16,) vm_liveness = 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 a9a3e3e..28543e7 100644 --- a/google/cloud/appengine_admin_v1/types/location.py +++ b/google/cloud/appengine_admin_v1/types/location.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore @@ -42,11 +40,9 @@ class LocationMetadata(proto.Message): is available in the given location. """ - standard_environment_available = proto.Field(proto.BOOL, number=2) - - flexible_environment_available = proto.Field(proto.BOOL, number=4) - - search_api_available = proto.Field(proto.BOOL, number=6) + standard_environment_available = proto.Field(proto.BOOL, number=2,) + flexible_environment_available = proto.Field(proto.BOOL, number=4,) + search_api_available = 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 index 81e51dc..09f2289 100644 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ b/google/cloud/appengine_admin_v1/types/network_settings.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - 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 79619d4..4c0c35a 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore __protobuf__ = proto.module( @@ -61,20 +58,13 @@ class OperationMetadataV1(proto.Message): """ - method = proto.Field(proto.STRING, number=1) - - insert_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) - - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp.Timestamp,) - - user = proto.Field(proto.STRING, number=4) - - target = proto.Field(proto.STRING, number=5) - - ephemeral_message = proto.Field(proto.STRING, number=6) - - warning = proto.RepeatedField(proto.STRING, number=7) - + method = proto.Field(proto.STRING, number=1,) + insert_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + user = proto.Field(proto.STRING, number=4,) + target = proto.Field(proto.STRING, number=5,) + ephemeral_message = proto.Field(proto.STRING, number=6,) + warning = proto.RepeatedField(proto.STRING, number=7,) create_version_metadata = proto.Field( proto.MESSAGE, number=8, @@ -95,7 +85,7 @@ class CreateVersionMetadataV1(proto.Message): of the version create. @OutputOnly """ - cloud_build_id = proto.Field(proto.STRING, number=1) + cloud_build_id = 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 index c44eac5..318f195 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,10 +13,8 @@ # 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 ( network_settings as ga_network_settings, ) @@ -58,12 +55,9 @@ class Service(proto.Message): to all versions. """ - name = proto.Field(proto.STRING, number=1) - - id = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.STRING, number=2,) split = proto.Field(proto.MESSAGE, number=3, message="TrafficSplit",) - network_settings = proto.Field( proto.MESSAGE, number=6, message=ga_network_settings.NetworkSettings, ) @@ -100,8 +94,7 @@ class ShardBy(proto.Enum): RANDOM = 3 shard_by = proto.Field(proto.ENUM, number=1, enum=ShardBy,) - - allocations = proto.MapField(proto.STRING, proto.DOUBLE, number=2) + allocations = 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 index ac2bfac..c475063 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,14 +13,12 @@ # 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 as duration # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore __protobuf__ = proto.module( @@ -256,104 +253,68 @@ class Version(proto.Message): Enables VPC connectivity for standard apps. """ - name = proto.Field(proto.STRING, number=1) - - id = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.STRING, number=2,) automatic_scaling = proto.Field( proto.MESSAGE, number=3, oneof="scaling", message="AutomaticScaling", ) - basic_scaling = proto.Field( proto.MESSAGE, number=4, oneof="scaling", message="BasicScaling", ) - manual_scaling = proto.Field( proto.MESSAGE, number=5, oneof="scaling", message="ManualScaling", ) - inbound_services = proto.RepeatedField( proto.ENUM, number=6, enum="InboundServiceType", ) - - instance_class = proto.Field(proto.STRING, number=7) - + instance_class = proto.Field(proto.STRING, number=7,) network = proto.Field(proto.MESSAGE, number=8, message="Network",) - - zones = proto.RepeatedField(proto.STRING, number=118) - + zones = proto.RepeatedField(proto.STRING, number=118,) resources = proto.Field(proto.MESSAGE, number=9, message="Resources",) - - runtime = proto.Field(proto.STRING, number=10) - - runtime_channel = proto.Field(proto.STRING, number=117) - - threadsafe = proto.Field(proto.BOOL, number=11) - - vm = proto.Field(proto.BOOL, number=12) - - beta_settings = proto.MapField(proto.STRING, proto.STRING, number=13) - - env = proto.Field(proto.STRING, number=14) - + runtime = proto.Field(proto.STRING, number=10,) + runtime_channel = proto.Field(proto.STRING, number=117,) + threadsafe = proto.Field(proto.BOOL, number=11,) + vm = proto.Field(proto.BOOL, number=12,) + beta_settings = proto.MapField(proto.STRING, proto.STRING, number=13,) + env = proto.Field(proto.STRING, number=14,) serving_status = proto.Field(proto.ENUM, number=15, enum="ServingStatus",) - - created_by = proto.Field(proto.STRING, number=16) - - create_time = proto.Field(proto.MESSAGE, number=17, message=timestamp.Timestamp,) - - disk_usage_bytes = proto.Field(proto.INT64, number=18) - - runtime_api_version = proto.Field(proto.STRING, number=21) - - runtime_main_executable_path = proto.Field(proto.STRING, number=22) - - service_account = proto.Field(proto.STRING, number=127) - + created_by = proto.Field(proto.STRING, number=16,) + create_time = proto.Field( + proto.MESSAGE, number=17, message=timestamp_pb2.Timestamp, + ) + disk_usage_bytes = proto.Field(proto.INT64, number=18,) + runtime_api_version = proto.Field(proto.STRING, number=21,) + runtime_main_executable_path = proto.Field(proto.STRING, number=22,) + service_account = proto.Field(proto.STRING, number=127,) handlers = proto.RepeatedField(proto.MESSAGE, number=100, message=app_yaml.UrlMap,) - error_handlers = proto.RepeatedField( proto.MESSAGE, number=101, message=app_yaml.ErrorHandler, ) - libraries = proto.RepeatedField( proto.MESSAGE, number=102, message=app_yaml.Library, ) - api_config = proto.Field( proto.MESSAGE, number=103, message=app_yaml.ApiConfigHandler, ) - - env_variables = proto.MapField(proto.STRING, proto.STRING, number=104) - - build_env_variables = proto.MapField(proto.STRING, proto.STRING, number=125) - + env_variables = proto.MapField(proto.STRING, proto.STRING, number=104,) + build_env_variables = proto.MapField(proto.STRING, proto.STRING, number=125,) default_expiration = proto.Field( - proto.MESSAGE, number=105, message=duration.Duration, + proto.MESSAGE, number=105, message=duration_pb2.Duration, ) - health_check = proto.Field(proto.MESSAGE, number=106, message=app_yaml.HealthCheck,) - readiness_check = proto.Field( proto.MESSAGE, number=112, message=app_yaml.ReadinessCheck, ) - liveness_check = proto.Field( proto.MESSAGE, number=113, message=app_yaml.LivenessCheck, ) - - nobuild_files_regex = proto.Field(proto.STRING, number=107) - + nobuild_files_regex = proto.Field(proto.STRING, number=107,) deployment = proto.Field(proto.MESSAGE, number=108, message=deploy.Deployment,) - - version_url = proto.Field(proto.STRING, number=109) - + version_url = proto.Field(proto.STRING, number=109,) endpoints_api_service = proto.Field( proto.MESSAGE, number=110, message="EndpointsApiService", ) - entrypoint = proto.Field(proto.MESSAGE, number=122, message="Entrypoint",) - vpc_access_connector = proto.Field( proto.MESSAGE, number=121, message="VpcAccessConnector", ) @@ -405,13 +366,10 @@ class RolloutStrategy(proto.Enum): FIXED = 1 MANAGED = 2 - name = proto.Field(proto.STRING, number=1) - - config_id = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + config_id = proto.Field(proto.STRING, number=2,) rollout_strategy = proto.Field(proto.ENUM, number=3, enum=RolloutStrategy,) - - disable_trace_sampling = proto.Field(proto.BOOL, number=4) + disable_trace_sampling = proto.Field(proto.BOOL, number=4,) class AutomaticScaling(proto.Message): @@ -465,38 +423,28 @@ class AutomaticScaling(proto.Message): Scheduler settings for standard environment. """ - cool_down_period = proto.Field(proto.MESSAGE, number=1, message=duration.Duration,) - + cool_down_period = proto.Field( + proto.MESSAGE, number=1, message=duration_pb2.Duration, + ) cpu_utilization = proto.Field(proto.MESSAGE, number=2, message="CpuUtilization",) - - max_concurrent_requests = proto.Field(proto.INT32, number=3) - - max_idle_instances = proto.Field(proto.INT32, number=4) - - max_total_instances = proto.Field(proto.INT32, number=5) - + max_concurrent_requests = proto.Field(proto.INT32, number=3,) + max_idle_instances = proto.Field(proto.INT32, number=4,) + max_total_instances = proto.Field(proto.INT32, number=5,) max_pending_latency = proto.Field( - proto.MESSAGE, number=6, message=duration.Duration, + proto.MESSAGE, number=6, message=duration_pb2.Duration, ) - - min_idle_instances = proto.Field(proto.INT32, number=7) - - min_total_instances = proto.Field(proto.INT32, number=8) - + min_idle_instances = proto.Field(proto.INT32, number=7,) + min_total_instances = proto.Field(proto.INT32, number=8,) min_pending_latency = proto.Field( - proto.MESSAGE, number=9, message=duration.Duration, + proto.MESSAGE, number=9, message=duration_pb2.Duration, ) - request_utilization = proto.Field( proto.MESSAGE, number=10, message="RequestUtilization", ) - disk_utilization = proto.Field(proto.MESSAGE, number=11, message="DiskUtilization",) - network_utilization = proto.Field( proto.MESSAGE, number=12, message="NetworkUtilization", ) - standard_scheduler_settings = proto.Field( proto.MESSAGE, number=20, message="StandardSchedulerSettings", ) @@ -518,9 +466,8 @@ class BasicScaling(proto.Message): this version. """ - idle_timeout = proto.Field(proto.MESSAGE, number=1, message=duration.Duration,) - - max_instances = proto.Field(proto.INT32, number=2) + idle_timeout = proto.Field(proto.MESSAGE, number=1, message=duration_pb2.Duration,) + max_instances = proto.Field(proto.INT32, number=2,) class ManualScaling(proto.Message): @@ -536,12 +483,11 @@ class ManualScaling(proto.Message): ``set_num_instances()`` function. """ - instances = proto.Field(proto.INT32, number=1) + instances = 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 @@ -552,10 +498,9 @@ class CpuUtilization(proto.Message): """ aggregation_window_length = proto.Field( - proto.MESSAGE, number=1, message=duration.Duration, + proto.MESSAGE, number=1, message=duration_pb2.Duration, ) - - target_utilization = proto.Field(proto.DOUBLE, number=2) + target_utilization = proto.Field(proto.DOUBLE, number=2,) class RequestUtilization(proto.Message): @@ -569,9 +514,8 @@ class RequestUtilization(proto.Message): Target number of concurrent requests. """ - target_request_count_per_second = proto.Field(proto.INT32, number=1) - - target_concurrent_requests = proto.Field(proto.INT32, number=2) + target_request_count_per_second = proto.Field(proto.INT32, number=1,) + target_concurrent_requests = proto.Field(proto.INT32, number=2,) class DiskUtilization(proto.Message): @@ -589,13 +533,10 @@ class DiskUtilization(proto.Message): Target ops read per seconds. """ - target_write_bytes_per_second = proto.Field(proto.INT32, number=14) - - target_write_ops_per_second = proto.Field(proto.INT32, number=15) - - target_read_bytes_per_second = proto.Field(proto.INT32, number=16) - - target_read_ops_per_second = proto.Field(proto.INT32, number=17) + target_write_bytes_per_second = proto.Field(proto.INT32, number=14,) + target_write_ops_per_second = proto.Field(proto.INT32, number=15,) + target_read_bytes_per_second = proto.Field(proto.INT32, number=16,) + target_read_ops_per_second = proto.Field(proto.INT32, number=17,) class NetworkUtilization(proto.Message): @@ -613,18 +554,14 @@ class NetworkUtilization(proto.Message): Target packets received per second. """ - target_sent_bytes_per_second = proto.Field(proto.INT32, number=1) - - target_sent_packets_per_second = proto.Field(proto.INT32, number=11) - - target_received_bytes_per_second = proto.Field(proto.INT32, number=12) - - target_received_packets_per_second = proto.Field(proto.INT32, number=13) + target_sent_bytes_per_second = proto.Field(proto.INT32, number=1,) + target_sent_packets_per_second = proto.Field(proto.INT32, number=11,) + target_received_bytes_per_second = proto.Field(proto.INT32, number=12,) + target_received_packets_per_second = 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 @@ -640,13 +577,10 @@ class StandardSchedulerSettings(proto.Message): zero to disable ``max_instances`` configuration. """ - target_cpu_utilization = proto.Field(proto.DOUBLE, number=1) - - target_throughput_utilization = proto.Field(proto.DOUBLE, number=2) - - min_instances = proto.Field(proto.INT32, number=3) - - max_instances = proto.Field(proto.INT32, number=4) + target_cpu_utilization = proto.Field(proto.DOUBLE, number=1,) + target_throughput_utilization = proto.Field(proto.DOUBLE, number=2,) + min_instances = proto.Field(proto.INT32, number=3,) + max_instances = proto.Field(proto.INT32, number=4,) class Network(proto.Message): @@ -696,15 +630,11 @@ class Network(proto.Message): environment. """ - forwarded_ports = proto.RepeatedField(proto.STRING, number=1) - - instance_tag = proto.Field(proto.STRING, number=2) - - name = proto.Field(proto.STRING, number=3) - - subnetwork_name = proto.Field(proto.STRING, number=4) - - session_affinity = proto.Field(proto.BOOL, number=5) + forwarded_ports = proto.RepeatedField(proto.STRING, number=1,) + instance_tag = proto.Field(proto.STRING, number=2,) + name = proto.Field(proto.STRING, number=3,) + subnetwork_name = proto.Field(proto.STRING, number=4,) + session_affinity = proto.Field(proto.BOOL, number=5,) class Volume(proto.Message): @@ -720,16 +650,13 @@ class Volume(proto.Message): Volume size in gigabytes. """ - name = proto.Field(proto.STRING, number=1) - - volume_type = proto.Field(proto.STRING, number=2) - - size_gb = proto.Field(proto.DOUBLE, number=3) + name = proto.Field(proto.STRING, number=1,) + volume_type = proto.Field(proto.STRING, number=2,) + size_gb = proto.Field(proto.DOUBLE, number=3,) class Resources(proto.Message): r"""Machine resources for a version. - Attributes: cpu (float): Number of CPU cores needed. @@ -745,20 +672,15 @@ class Resources(proto.Message): Cloud Composer to encrypt the vm disk """ - cpu = proto.Field(proto.DOUBLE, number=1) - - disk_gb = proto.Field(proto.DOUBLE, number=2) - - memory_gb = proto.Field(proto.DOUBLE, number=3) - + cpu = proto.Field(proto.DOUBLE, number=1,) + disk_gb = proto.Field(proto.DOUBLE, number=2,) + memory_gb = proto.Field(proto.DOUBLE, number=3,) volumes = proto.RepeatedField(proto.MESSAGE, number=4, message="Volume",) - - kms_key_reference = proto.Field(proto.STRING, number=5) + kms_key_reference = proto.Field(proto.STRING, number=5,) class VpcAccessConnector(proto.Message): r"""VPC access connector specification. - Attributes: name (str): Full Serverless VPC Access Connector name @@ -766,19 +688,18 @@ class VpcAccessConnector(proto.Message): central1/connectors/c1. """ - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) class Entrypoint(proto.Message): r"""The entrypoint for the application. - Attributes: shell (str): The format should be a shell command that can be fed to ``bash -c``. """ - shell = proto.Field(proto.STRING, number=1, oneof="command") + shell = proto.Field(proto.STRING, number=1, oneof="command",) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/scripts/fixup_appengine_admin_v1_keywords.py b/scripts/fixup_appengine_admin_v1_keywords.py index 5c6224a..977426f 100644 --- a/scripts/fixup_appengine_admin_v1_keywords.py +++ b/scripts/fixup_appengine_admin_v1_keywords.py @@ -1,6 +1,5 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import argparse import os import libcst as cst @@ -41,41 +39,40 @@ def partition( 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', ), - + '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: @@ -106,7 +103,7 @@ def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: value=cst.Dict([ cst.DictElement( cst.SimpleString("'{}'".format(name)), - cst.Element(value=arg.value) +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 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..4de6597 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..4de6597 --- /dev/null +++ b/tests/unit/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..4de6597 --- /dev/null +++ b/tests/unit/gapic/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/appengine_admin_v1/__init__.py b/tests/unit/gapic/appengine_admin_v1/__init__.py index 42ffdf2..4de6597 100644 --- a/tests/unit/gapic/appengine_admin_v1/__init__.py +++ b/tests/unit/gapic/appengine_admin_v1/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (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 32be11e..c168ab6 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,29 +23,59 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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_async # type: ignore from google.api_core import operations_v1 -from google.auth import credentials +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.services.applications.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.applications.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 as duration # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -92,7 +121,7 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) def test_applications_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -107,7 +136,7 @@ def test_applications_client_from_service_account_info(client_class): @pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) def test_applications_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -158,7 +187,7 @@ def test_applications_client_client_options( ): # 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -442,7 +471,7 @@ def test_get_application( transport: str = "grpc", request_type=appengine.GetApplicationRequest ): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -464,37 +493,24 @@ def test_get_application( 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.gcr_domain == "gcr_domain_value" - assert ( response.database_type == application.Application.DatabaseType.CLOUD_DATASTORE ) @@ -508,7 +524,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -516,7 +532,6 @@ def test_get_application_empty_call(): client.get_application() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetApplicationRequest() @@ -525,7 +540,7 @@ async def test_get_application_async( transport: str = "grpc_asyncio", request_type=appengine.GetApplicationRequest ): client = ApplicationsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -549,36 +564,24 @@ async def test_get_application_async( 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.gcr_domain == "gcr_domain_value" - assert ( response.database_type == application.Application.DatabaseType.CLOUD_DATASTORE ) @@ -590,17 +593,17 @@ async def test_get_application_async_from_dict(): def test_get_application_field_headers(): - client = ApplicationsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -615,11 +618,12 @@ def test_get_application_field_headers(): @pytest.mark.asyncio async def test_get_application_field_headers_async(): - client = ApplicationsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -627,7 +631,6 @@ async def test_get_application_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( application.Application() ) - await client.get_application(request) # Establish that the underlying gRPC stub method was called. @@ -644,7 +647,7 @@ def test_create_application( transport: str = "grpc", request_type=appengine.CreateApplicationRequest ): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -657,13 +660,11 @@ def test_create_application( ) 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. @@ -678,7 +679,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -688,7 +689,6 @@ def test_create_application_empty_call(): client.create_application() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateApplicationRequest() @@ -697,7 +697,7 @@ async def test_create_application_async( transport: str = "grpc_asyncio", request_type=appengine.CreateApplicationRequest ): client = ApplicationsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -712,13 +712,11 @@ async def test_create_application_async( 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. @@ -734,7 +732,7 @@ def test_update_application( transport: str = "grpc", request_type=appengine.UpdateApplicationRequest ): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -747,13 +745,11 @@ def test_update_application( ) 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. @@ -768,7 +764,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -778,7 +774,6 @@ def test_update_application_empty_call(): client.update_application() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateApplicationRequest() @@ -787,7 +782,7 @@ async def test_update_application_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateApplicationRequest ): client = ApplicationsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -802,13 +797,11 @@ async def test_update_application_async( 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. @@ -821,11 +814,12 @@ async def test_update_application_async_from_dict(): def test_update_application_field_headers(): - client = ApplicationsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -833,7 +827,6 @@ def test_update_application_field_headers(): 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. @@ -848,11 +841,12 @@ def test_update_application_field_headers(): @pytest.mark.asyncio async def test_update_application_field_headers_async(): - client = ApplicationsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -862,7 +856,6 @@ async def test_update_application_field_headers_async(): 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. @@ -879,7 +872,7 @@ def test_repair_application( transport: str = "grpc", request_type=appengine.RepairApplicationRequest ): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -892,13 +885,11 @@ def test_repair_application( ) 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. @@ -913,7 +904,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -923,7 +914,6 @@ def test_repair_application_empty_call(): client.repair_application() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.RepairApplicationRequest() @@ -932,7 +922,7 @@ async def test_repair_application_async( transport: str = "grpc_asyncio", request_type=appengine.RepairApplicationRequest ): client = ApplicationsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -947,13 +937,11 @@ async def test_repair_application_async( 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. @@ -966,11 +954,12 @@ async def test_repair_application_async_from_dict(): def test_repair_application_field_headers(): - client = ApplicationsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -978,7 +967,6 @@ def test_repair_application_field_headers(): 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. @@ -993,11 +981,12 @@ def test_repair_application_field_headers(): @pytest.mark.asyncio async def test_repair_application_field_headers_async(): - client = ApplicationsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1007,7 +996,6 @@ async def test_repair_application_field_headers_async(): 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. @@ -1023,16 +1011,16 @@ async def test_repair_application_field_headers_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ApplicationsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ApplicationsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ApplicationsClient( @@ -1042,7 +1030,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.ApplicationsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ApplicationsClient( @@ -1053,7 +1041,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ApplicationsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ApplicationsClient(transport=transport) assert client.transport is transport @@ -1062,13 +1050,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ApplicationsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ApplicationsGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1083,23 +1071,23 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ApplicationsClient(credentials=credentials.AnonymousCredentials(),) + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ApplicationsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1111,7 +1099,7 @@ def test_applications_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ApplicationsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1132,15 +1120,41 @@ def test_applications_base_transport(): transport.operations_client +@requires_google_auth_gte_1_25_0 def test_applications_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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 = (credentials.AnonymousCredentials(), 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_applications_base_transport_with_credentials_file_old_google_auth(): + # 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", ) @@ -1157,19 +1171,37 @@ def test_applications_base_transport_with_credentials_file(): def test_applications_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ApplicationsTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_applications_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_applications_auth_adc_old_google_auth(): + # 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=( @@ -1181,14 +1213,45 @@ def test_applications_auth_adc(): ) -def test_applications_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.ApplicationsGrpcTransport, + transports.ApplicationsGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.ApplicationsGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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, + ], +) +@requires_google_auth_lt_1_25_0 +def test_applications_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -1199,12 +1262,129 @@ def test_applications_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ApplicationsGrpcTransport, grpc_helpers), + (transports.ApplicationsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.ApplicationsGrpcTransport, grpc_helpers), + (transports.ApplicationsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_applications_transport_create_channel_old_api_core( + 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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ApplicationsGrpcTransport, grpc_helpers), + (transports.ApplicationsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_applications_transport_create_channel_user_scopes( + 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", + scopes=["1", "2"], + 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 = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1247,7 +1427,7 @@ def test_applications_grpc_transport_client_cert_source_for_mtls(transport_class def test_applications_host_no_port(): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -1257,7 +1437,7 @@ def test_applications_host_no_port(): def test_applications_host_with_port(): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1308,9 +1488,9 @@ def test_applications_transport_channel_mtls_with_client_cert_source(transport_c mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1391,7 +1571,7 @@ def test_applications_transport_channel_mtls_with_adc(transport_class): def test_applications_grpc_lro_client(): client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -1404,7 +1584,7 @@ def test_applications_grpc_lro_client(): def test_applications_grpc_lro_async_client(): client = ApplicationsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -1417,7 +1597,6 @@ def test_applications_grpc_lro_async_client(): def test_common_billing_account_path(): billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1438,7 +1617,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = ApplicationsClient.common_folder_path(folder) assert expected == actual @@ -1457,7 +1635,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = ApplicationsClient.common_organization_path(organization) assert expected == actual @@ -1476,7 +1653,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = ApplicationsClient.common_project_path(project) assert expected == actual @@ -1496,7 +1672,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "winkle" location = "nautilus" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1523,7 +1698,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.ApplicationsTransport, "_prep_wrapped_messages" ) as prep: client = ApplicationsClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1532,6 +1707,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = ApplicationsClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) 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 f93792b..590e406 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,13 +23,13 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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.auth import credentials +from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.authorized_certificates import ( AuthorizedCertificatesAsyncClient, @@ -40,11 +39,41 @@ ) 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.services.authorized_certificates.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.authorized_certificates.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -96,7 +125,7 @@ def test__get_default_mtls_endpoint(): "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] ) def test_authorized_certificates_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -113,7 +142,7 @@ def test_authorized_certificates_client_from_service_account_info(client_class): "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] ) def test_authorized_certificates_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -170,7 +199,7 @@ def test_authorized_certificates_client_client_options( ): # 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -476,7 +505,7 @@ def test_list_authorized_certificates( transport: str = "grpc", request_type=appengine.ListAuthorizedCertificatesRequest ): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -491,19 +520,15 @@ def test_list_authorized_certificates( 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" @@ -515,7 +540,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -525,7 +550,6 @@ def test_list_authorized_certificates_empty_call(): client.list_authorized_certificates() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedCertificatesRequest() @@ -535,7 +559,7 @@ async def test_list_authorized_certificates_async( request_type=appengine.ListAuthorizedCertificatesRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -552,18 +576,15 @@ async def test_list_authorized_certificates_async( 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" @@ -574,12 +595,13 @@ async def test_list_authorized_certificates_async_from_dict(): def test_list_authorized_certificates_field_headers(): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -587,7 +609,6 @@ def test_list_authorized_certificates_field_headers(): 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. @@ -603,12 +624,13 @@ def test_list_authorized_certificates_field_headers(): @pytest.mark.asyncio async def test_list_authorized_certificates_field_headers_async(): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -618,7 +640,6 @@ async def test_list_authorized_certificates_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( appengine.ListAuthorizedCertificatesResponse() ) - await client.list_authorized_certificates(request) # Establish that the underlying gRPC stub method was called. @@ -632,7 +653,9 @@ async def test_list_authorized_certificates_field_headers_async(): def test_list_authorized_certificates_pager(): - client = AuthorizedCertificatesClient(credentials=credentials.AnonymousCredentials,) + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -678,7 +701,9 @@ def test_list_authorized_certificates_pager(): def test_list_authorized_certificates_pages(): - client = AuthorizedCertificatesClient(credentials=credentials.AnonymousCredentials,) + client = AuthorizedCertificatesClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -717,7 +742,7 @@ def test_list_authorized_certificates_pages(): @pytest.mark.asyncio async def test_list_authorized_certificates_async_pager(): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -764,7 +789,7 @@ async def test_list_authorized_certificates_async_pager(): @pytest.mark.asyncio async def test_list_authorized_certificates_async_pages(): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -811,7 +836,7 @@ def test_get_authorized_certificate( transport: str = "grpc", request_type=appengine.GetAuthorizedCertificateRequest ): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -831,29 +856,20 @@ def test_get_authorized_certificate( 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 @@ -865,7 +881,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -875,7 +891,6 @@ def test_get_authorized_certificate_empty_call(): client.get_authorized_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetAuthorizedCertificateRequest() @@ -885,7 +900,7 @@ async def test_get_authorized_certificate_async( request_type=appengine.GetAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -907,28 +922,20 @@ async def test_get_authorized_certificate_async( 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 @@ -939,12 +946,13 @@ async def test_get_authorized_certificate_async_from_dict(): def test_get_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -952,7 +960,6 @@ def test_get_authorized_certificate_field_headers(): 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. @@ -968,12 +975,13 @@ def test_get_authorized_certificate_field_headers(): @pytest.mark.asyncio async def test_get_authorized_certificate_field_headers_async(): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -983,7 +991,6 @@ async def test_get_authorized_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( certificate.AuthorizedCertificate() ) - await client.get_authorized_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1000,7 +1007,7 @@ def test_create_authorized_certificate( transport: str = "grpc", request_type=appengine.CreateAuthorizedCertificateRequest ): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1020,29 +1027,20 @@ def test_create_authorized_certificate( 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 @@ -1054,7 +1052,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1064,7 +1062,6 @@ def test_create_authorized_certificate_empty_call(): client.create_authorized_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateAuthorizedCertificateRequest() @@ -1074,7 +1071,7 @@ async def test_create_authorized_certificate_async( request_type=appengine.CreateAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1096,28 +1093,20 @@ async def test_create_authorized_certificate_async( 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 @@ -1128,12 +1117,13 @@ async def test_create_authorized_certificate_async_from_dict(): def test_create_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -1141,7 +1131,6 @@ def test_create_authorized_certificate_field_headers(): 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. @@ -1157,12 +1146,13 @@ def test_create_authorized_certificate_field_headers(): @pytest.mark.asyncio async def test_create_authorized_certificate_field_headers_async(): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -1172,7 +1162,6 @@ async def test_create_authorized_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( certificate.AuthorizedCertificate() ) - await client.create_authorized_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1189,7 +1178,7 @@ def test_update_authorized_certificate( transport: str = "grpc", request_type=appengine.UpdateAuthorizedCertificateRequest ): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1209,29 +1198,20 @@ def test_update_authorized_certificate( 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 @@ -1243,7 +1223,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1253,7 +1233,6 @@ def test_update_authorized_certificate_empty_call(): client.update_authorized_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateAuthorizedCertificateRequest() @@ -1263,7 +1242,7 @@ async def test_update_authorized_certificate_async( request_type=appengine.UpdateAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1285,28 +1264,20 @@ async def test_update_authorized_certificate_async( 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 @@ -1317,12 +1288,13 @@ async def test_update_authorized_certificate_async_from_dict(): def test_update_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -1330,7 +1302,6 @@ def test_update_authorized_certificate_field_headers(): 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. @@ -1346,12 +1317,13 @@ def test_update_authorized_certificate_field_headers(): @pytest.mark.asyncio async def test_update_authorized_certificate_field_headers_async(): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -1361,7 +1333,6 @@ async def test_update_authorized_certificate_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( certificate.AuthorizedCertificate() ) - await client.update_authorized_certificate(request) # Establish that the underlying gRPC stub method was called. @@ -1378,7 +1349,7 @@ def test_delete_authorized_certificate( transport: str = "grpc", request_type=appengine.DeleteAuthorizedCertificateRequest ): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1391,13 +1362,11 @@ def test_delete_authorized_certificate( ) 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. @@ -1412,7 +1381,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1422,7 +1391,6 @@ def test_delete_authorized_certificate_empty_call(): client.delete_authorized_certificate() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteAuthorizedCertificateRequest() @@ -1432,7 +1400,7 @@ async def test_delete_authorized_certificate_async( request_type=appengine.DeleteAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1445,13 +1413,11 @@ async def test_delete_authorized_certificate_async( ) 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. @@ -1465,12 +1431,13 @@ async def test_delete_authorized_certificate_async_from_dict(): def test_delete_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -1478,7 +1445,6 @@ def test_delete_authorized_certificate_field_headers(): 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. @@ -1494,12 +1460,13 @@ def test_delete_authorized_certificate_field_headers(): @pytest.mark.asyncio async def test_delete_authorized_certificate_field_headers_async(): client = AuthorizedCertificatesAsyncClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -1507,7 +1474,6 @@ async def test_delete_authorized_certificate_field_headers_async(): 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. @@ -1523,16 +1489,16 @@ async def test_delete_authorized_certificate_field_headers_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AuthorizedCertificatesClient( @@ -1542,7 +1508,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AuthorizedCertificatesClient( @@ -1553,7 +1519,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = AuthorizedCertificatesClient(transport=transport) assert client.transport is transport @@ -1562,13 +1528,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.AuthorizedCertificatesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.AuthorizedCertificatesGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1583,8 +1549,8 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1592,16 +1558,16 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.AuthorizedCertificatesTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1613,7 +1579,7 @@ def test_authorized_certificates_base_transport(): ) as Transport: Transport.return_value = None transport = transports.AuthorizedCertificatesTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1630,15 +1596,41 @@ def test_authorized_certificates_base_transport(): getattr(transport, method)(request=object()) +@requires_google_auth_gte_1_25_0 def test_authorized_certificates_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_authorized_certificates_base_transport_with_credentials_file_old_google_auth(): + # 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 = (credentials.AnonymousCredentials(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AuthorizedCertificatesTransport( credentials_file="credentials.json", quota_project_id="octopus", ) @@ -1655,19 +1647,37 @@ def test_authorized_certificates_base_transport_with_credentials_file(): 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(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AuthorizedCertificatesTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_authorized_certificates_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_authorized_certificates_auth_adc_old_google_auth(): + # 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=( @@ -1679,14 +1689,45 @@ def test_authorized_certificates_auth_adc(): ) -def test_authorized_certificates_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.AuthorizedCertificatesGrpcTransport, + transports.AuthorizedCertificatesGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.AuthorizedCertificatesGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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, + ], +) +@requires_google_auth_lt_1_25_0 +def test_authorized_certificates_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -1697,6 +1738,125 @@ def test_authorized_certificates_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.AuthorizedCertificatesGrpcTransport, grpc_helpers), + (transports.AuthorizedCertificatesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.AuthorizedCertificatesGrpcTransport, grpc_helpers), + (transports.AuthorizedCertificatesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_authorized_certificates_transport_create_channel_old_api_core( + 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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.AuthorizedCertificatesGrpcTransport, grpc_helpers), + (transports.AuthorizedCertificatesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_authorized_certificates_transport_create_channel_user_scopes( + 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", + scopes=["1", "2"], + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "transport_class", [ @@ -1707,7 +1867,7 @@ def test_authorized_certificates_transport_auth_adc(): def test_authorized_certificates_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1750,7 +1910,7 @@ def test_authorized_certificates_grpc_transport_client_cert_source_for_mtls( def test_authorized_certificates_host_no_port(): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -1760,7 +1920,7 @@ def test_authorized_certificates_host_no_port(): def test_authorized_certificates_host_with_port(): client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1816,9 +1976,9 @@ def test_authorized_certificates_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1902,7 +2062,6 @@ def test_authorized_certificates_transport_channel_mtls_with_adc(transport_class def test_common_billing_account_path(): billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1923,7 +2082,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = AuthorizedCertificatesClient.common_folder_path(folder) assert expected == actual @@ -1942,7 +2100,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = AuthorizedCertificatesClient.common_organization_path(organization) assert expected == actual @@ -1961,7 +2118,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = AuthorizedCertificatesClient.common_project_path(project) assert expected == actual @@ -1981,7 +2137,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "winkle" location = "nautilus" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -2008,7 +2163,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.AuthorizedCertificatesTransport, "_prep_wrapped_messages" ) as prep: client = AuthorizedCertificatesClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2017,6 +2172,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = AuthorizedCertificatesClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) 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 b40fd88..65e843f 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,13 +23,13 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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.auth import credentials +from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.authorized_domains import ( AuthorizedDomainsAsyncClient, @@ -40,9 +39,39 @@ ) 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.services.authorized_domains.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.authorized_domains.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -94,7 +123,7 @@ def test__get_default_mtls_endpoint(): "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] ) def test_authorized_domains_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -111,7 +140,7 @@ def test_authorized_domains_client_from_service_account_info(client_class): "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] ) def test_authorized_domains_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -164,7 +193,7 @@ def test_authorized_domains_client_client_options( ): # 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -462,7 +491,7 @@ def test_list_authorized_domains( transport: str = "grpc", request_type=appengine.ListAuthorizedDomainsRequest ): client = AuthorizedDomainsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -477,19 +506,15 @@ def test_list_authorized_domains( 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" @@ -501,7 +526,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -511,7 +536,6 @@ def test_list_authorized_domains_empty_call(): client.list_authorized_domains() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedDomainsRequest() @@ -520,7 +544,7 @@ async def test_list_authorized_domains_async( transport: str = "grpc_asyncio", request_type=appengine.ListAuthorizedDomainsRequest ): client = AuthorizedDomainsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -537,18 +561,15 @@ async def test_list_authorized_domains_async( 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" @@ -558,11 +579,12 @@ async def test_list_authorized_domains_async_from_dict(): def test_list_authorized_domains_field_headers(): - client = AuthorizedDomainsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -570,7 +592,6 @@ def test_list_authorized_domains_field_headers(): 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. @@ -586,12 +607,13 @@ def test_list_authorized_domains_field_headers(): @pytest.mark.asyncio async def test_list_authorized_domains_field_headers_async(): client = AuthorizedDomainsAsyncClient( - credentials=credentials.AnonymousCredentials(), + 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. @@ -601,7 +623,6 @@ async def test_list_authorized_domains_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( appengine.ListAuthorizedDomainsResponse() ) - await client.list_authorized_domains(request) # Establish that the underlying gRPC stub method was called. @@ -615,7 +636,7 @@ async def test_list_authorized_domains_field_headers_async(): def test_list_authorized_domains_pager(): - client = AuthorizedDomainsClient(credentials=credentials.AnonymousCredentials,) + client = AuthorizedDomainsClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -655,7 +676,7 @@ def test_list_authorized_domains_pager(): def test_list_authorized_domains_pages(): - client = AuthorizedDomainsClient(credentials=credentials.AnonymousCredentials,) + client = AuthorizedDomainsClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -687,7 +708,9 @@ def test_list_authorized_domains_pages(): @pytest.mark.asyncio async def test_list_authorized_domains_async_pager(): - client = AuthorizedDomainsAsyncClient(credentials=credentials.AnonymousCredentials,) + client = AuthorizedDomainsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -726,7 +749,9 @@ async def test_list_authorized_domains_async_pager(): @pytest.mark.asyncio async def test_list_authorized_domains_async_pages(): - client = AuthorizedDomainsAsyncClient(credentials=credentials.AnonymousCredentials,) + client = AuthorizedDomainsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -763,16 +788,16 @@ async def test_list_authorized_domains_async_pages(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AuthorizedDomainsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AuthorizedDomainsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.AuthorizedDomainsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AuthorizedDomainsClient( @@ -782,7 +807,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.AuthorizedDomainsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AuthorizedDomainsClient( @@ -793,7 +818,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.AuthorizedDomainsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = AuthorizedDomainsClient(transport=transport) assert client.transport is transport @@ -802,13 +827,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.AuthorizedDomainsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.AuthorizedDomainsGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -823,23 +848,23 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AuthorizedDomainsClient(credentials=credentials.AnonymousCredentials(),) + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.AuthorizedDomainsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -851,7 +876,7 @@ def test_authorized_domains_base_transport(): ) as Transport: Transport.return_value = None transport = transports.AuthorizedDomainsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -862,15 +887,41 @@ def test_authorized_domains_base_transport(): getattr(transport, method)(request=object()) +@requires_google_auth_gte_1_25_0 def test_authorized_domains_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_authorized_domains_base_transport_with_credentials_file_old_google_auth(): + # 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 = (credentials.AnonymousCredentials(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AuthorizedDomainsTransport( credentials_file="credentials.json", quota_project_id="octopus", ) @@ -887,19 +938,37 @@ def test_authorized_domains_base_transport_with_credentials_file(): 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(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AuthorizedDomainsTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_authorized_domains_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_authorized_domains_auth_adc_old_google_auth(): + # 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=( @@ -911,14 +980,45 @@ def test_authorized_domains_auth_adc(): ) -def test_authorized_domains_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.AuthorizedDomainsGrpcTransport, + transports.AuthorizedDomainsGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.AuthorizedDomainsGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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, + ], +) +@requires_google_auth_lt_1_25_0 +def test_authorized_domains_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -929,6 +1029,123 @@ def test_authorized_domains_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.AuthorizedDomainsGrpcTransport, grpc_helpers), + (transports.AuthorizedDomainsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.AuthorizedDomainsGrpcTransport, grpc_helpers), + (transports.AuthorizedDomainsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_authorized_domains_transport_create_channel_old_api_core( + 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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.AuthorizedDomainsGrpcTransport, grpc_helpers), + (transports.AuthorizedDomainsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_authorized_domains_transport_create_channel_user_scopes( + 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", + scopes=["1", "2"], + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "transport_class", [ @@ -937,7 +1154,7 @@ def test_authorized_domains_transport_auth_adc(): ], ) def test_authorized_domains_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -980,7 +1197,7 @@ def test_authorized_domains_grpc_transport_client_cert_source_for_mtls(transport def test_authorized_domains_host_no_port(): client = AuthorizedDomainsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -990,7 +1207,7 @@ def test_authorized_domains_host_no_port(): def test_authorized_domains_host_with_port(): client = AuthorizedDomainsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1046,9 +1263,9 @@ def test_authorized_domains_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1132,7 +1349,6 @@ def test_authorized_domains_transport_channel_mtls_with_adc(transport_class): def test_common_billing_account_path(): billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1153,7 +1369,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = AuthorizedDomainsClient.common_folder_path(folder) assert expected == actual @@ -1172,7 +1387,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = AuthorizedDomainsClient.common_organization_path(organization) assert expected == actual @@ -1191,7 +1405,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = AuthorizedDomainsClient.common_project_path(project) assert expected == actual @@ -1211,7 +1424,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "winkle" location = "nautilus" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1238,7 +1450,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.AuthorizedDomainsTransport, "_prep_wrapped_messages" ) as prep: client = AuthorizedDomainsClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1247,6 +1459,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = AuthorizedDomainsClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) 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 1a995d8..05d9d6b 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,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,16 +23,16 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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_async # type: ignore from google.api_core import operations_v1 -from google.auth import credentials +from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.domain_mappings import ( DomainMappingsAsyncClient, @@ -43,12 +42,42 @@ ) 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.services.domain_mappings.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.domain_mappings.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 operation as ga_operation from google.longrunning import operations_pb2 from google.oauth2 import service_account -from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -99,7 +128,7 @@ def test__get_default_mtls_endpoint(): "client_class", [DomainMappingsClient, DomainMappingsAsyncClient,] ) def test_domain_mappings_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -116,7 +145,7 @@ def test_domain_mappings_client_from_service_account_info(client_class): "client_class", [DomainMappingsClient, DomainMappingsAsyncClient,] ) def test_domain_mappings_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -169,7 +198,7 @@ def test_domain_mappings_client_client_options( ): # 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -457,7 +486,7 @@ def test_list_domain_mappings( transport: str = "grpc", request_type=appengine.ListDomainMappingsRequest ): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -472,19 +501,15 @@ def test_list_domain_mappings( 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" @@ -496,7 +521,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -506,7 +531,6 @@ def test_list_domain_mappings_empty_call(): client.list_domain_mappings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListDomainMappingsRequest() @@ -515,7 +539,7 @@ async def test_list_domain_mappings_async( transport: str = "grpc_asyncio", request_type=appengine.ListDomainMappingsRequest ): client = DomainMappingsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -532,18 +556,15 @@ async def test_list_domain_mappings_async( 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" @@ -553,11 +574,12 @@ async def test_list_domain_mappings_async_from_dict(): def test_list_domain_mappings_field_headers(): - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -565,7 +587,6 @@ def test_list_domain_mappings_field_headers(): 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. @@ -580,11 +601,14 @@ def test_list_domain_mappings_field_headers(): @pytest.mark.asyncio async def test_list_domain_mappings_field_headers_async(): - client = DomainMappingsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -594,7 +618,6 @@ async def test_list_domain_mappings_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( appengine.ListDomainMappingsResponse() ) - await client.list_domain_mappings(request) # Establish that the underlying gRPC stub method was called. @@ -608,7 +631,7 @@ async def test_list_domain_mappings_field_headers_async(): def test_list_domain_mappings_pager(): - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials,) + client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -654,7 +677,7 @@ def test_list_domain_mappings_pager(): def test_list_domain_mappings_pages(): - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials,) + client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -692,7 +715,7 @@ def test_list_domain_mappings_pages(): @pytest.mark.asyncio async def test_list_domain_mappings_async_pager(): - client = DomainMappingsAsyncClient(credentials=credentials.AnonymousCredentials,) + client = DomainMappingsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -737,7 +760,7 @@ async def test_list_domain_mappings_async_pager(): @pytest.mark.asyncio async def test_list_domain_mappings_async_pages(): - client = DomainMappingsAsyncClient(credentials=credentials.AnonymousCredentials,) + client = DomainMappingsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -781,7 +804,7 @@ def test_get_domain_mapping( transport: str = "grpc", request_type=appengine.GetDomainMappingRequest ): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -796,21 +819,16 @@ def test_get_domain_mapping( 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" @@ -822,7 +840,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -832,7 +850,6 @@ def test_get_domain_mapping_empty_call(): client.get_domain_mapping() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetDomainMappingRequest() @@ -841,7 +858,7 @@ async def test_get_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.GetDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -856,20 +873,16 @@ async def test_get_domain_mapping_async( 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" @@ -879,11 +892,12 @@ async def test_get_domain_mapping_async_from_dict(): def test_get_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -891,7 +905,6 @@ def test_get_domain_mapping_field_headers(): 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. @@ -906,11 +919,14 @@ def test_get_domain_mapping_field_headers(): @pytest.mark.asyncio async def test_get_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -920,7 +936,6 @@ async def test_get_domain_mapping_field_headers_async(): 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. @@ -937,7 +952,7 @@ def test_create_domain_mapping( transport: str = "grpc", request_type=appengine.CreateDomainMappingRequest ): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -950,13 +965,11 @@ def test_create_domain_mapping( ) 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. @@ -971,7 +984,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -981,7 +994,6 @@ def test_create_domain_mapping_empty_call(): client.create_domain_mapping() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateDomainMappingRequest() @@ -990,7 +1002,7 @@ async def test_create_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.CreateDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1005,13 +1017,11 @@ async def test_create_domain_mapping_async( 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. @@ -1024,11 +1034,12 @@ async def test_create_domain_mapping_async_from_dict(): def test_create_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1036,7 +1047,6 @@ def test_create_domain_mapping_field_headers(): 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. @@ -1051,11 +1061,14 @@ def test_create_domain_mapping_field_headers(): @pytest.mark.asyncio async def test_create_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1065,7 +1078,6 @@ async def test_create_domain_mapping_field_headers_async(): 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. @@ -1082,7 +1094,7 @@ def test_update_domain_mapping( transport: str = "grpc", request_type=appengine.UpdateDomainMappingRequest ): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1095,13 +1107,11 @@ def test_update_domain_mapping( ) 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. @@ -1116,7 +1126,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1126,7 +1136,6 @@ def test_update_domain_mapping_empty_call(): client.update_domain_mapping() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateDomainMappingRequest() @@ -1135,7 +1144,7 @@ async def test_update_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1150,13 +1159,11 @@ async def test_update_domain_mapping_async( 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. @@ -1169,11 +1176,12 @@ async def test_update_domain_mapping_async_from_dict(): def test_update_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1181,7 +1189,6 @@ def test_update_domain_mapping_field_headers(): 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. @@ -1196,11 +1203,14 @@ def test_update_domain_mapping_field_headers(): @pytest.mark.asyncio async def test_update_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1210,7 +1220,6 @@ async def test_update_domain_mapping_field_headers_async(): 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. @@ -1227,7 +1236,7 @@ def test_delete_domain_mapping( transport: str = "grpc", request_type=appengine.DeleteDomainMappingRequest ): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1240,13 +1249,11 @@ def test_delete_domain_mapping( ) 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. @@ -1261,7 +1268,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1271,7 +1278,6 @@ def test_delete_domain_mapping_empty_call(): client.delete_domain_mapping() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteDomainMappingRequest() @@ -1280,7 +1286,7 @@ async def test_delete_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1295,13 +1301,11 @@ async def test_delete_domain_mapping_async( 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. @@ -1314,11 +1318,12 @@ async def test_delete_domain_mapping_async_from_dict(): def test_delete_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1326,7 +1331,6 @@ def test_delete_domain_mapping_field_headers(): 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. @@ -1341,11 +1345,14 @@ def test_delete_domain_mapping_field_headers(): @pytest.mark.asyncio async def test_delete_domain_mapping_field_headers_async(): - client = DomainMappingsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1355,7 +1362,6 @@ async def test_delete_domain_mapping_field_headers_async(): 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. @@ -1371,16 +1377,16 @@ async def test_delete_domain_mapping_field_headers_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.DomainMappingsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.DomainMappingsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = DomainMappingsClient( @@ -1390,7 +1396,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.DomainMappingsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = DomainMappingsClient( @@ -1401,7 +1407,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.DomainMappingsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = DomainMappingsClient(transport=transport) assert client.transport is transport @@ -1410,13 +1416,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.DomainMappingsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.DomainMappingsGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1431,23 +1437,23 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = DomainMappingsClient(credentials=credentials.AnonymousCredentials(),) + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.DomainMappingsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1459,7 +1465,7 @@ def test_domain_mappings_base_transport(): ) as Transport: Transport.return_value = None transport = transports.DomainMappingsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1481,15 +1487,41 @@ def test_domain_mappings_base_transport(): transport.operations_client +@requires_google_auth_gte_1_25_0 def test_domain_mappings_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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 = (credentials.AnonymousCredentials(), 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_domain_mappings_base_transport_with_credentials_file_old_google_auth(): + # 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", ) @@ -1506,19 +1538,37 @@ def test_domain_mappings_base_transport_with_credentials_file(): 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(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DomainMappingsTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_domain_mappings_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_domain_mappings_auth_adc_old_google_auth(): + # 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=( @@ -1530,14 +1580,45 @@ def test_domain_mappings_auth_adc(): ) -def test_domain_mappings_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.DomainMappingsGrpcTransport, + transports.DomainMappingsGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.DomainMappingsGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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, + ], +) +@requires_google_auth_lt_1_25_0 +def test_domain_mappings_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -1548,6 +1629,123 @@ def test_domain_mappings_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.DomainMappingsGrpcTransport, grpc_helpers), + (transports.DomainMappingsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.DomainMappingsGrpcTransport, grpc_helpers), + (transports.DomainMappingsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_domain_mappings_transport_create_channel_old_api_core( + 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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.DomainMappingsGrpcTransport, grpc_helpers), + (transports.DomainMappingsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_domain_mappings_transport_create_channel_user_scopes( + 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", + scopes=["1", "2"], + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "transport_class", [ @@ -1556,7 +1754,7 @@ def test_domain_mappings_transport_auth_adc(): ], ) def test_domain_mappings_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1599,7 +1797,7 @@ def test_domain_mappings_grpc_transport_client_cert_source_for_mtls(transport_cl def test_domain_mappings_host_no_port(): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -1609,7 +1807,7 @@ def test_domain_mappings_host_no_port(): def test_domain_mappings_host_with_port(): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1665,9 +1863,9 @@ def test_domain_mappings_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1751,7 +1949,7 @@ def test_domain_mappings_transport_channel_mtls_with_adc(transport_class): def test_domain_mappings_grpc_lro_client(): client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -1764,7 +1962,7 @@ def test_domain_mappings_grpc_lro_client(): def test_domain_mappings_grpc_lro_async_client(): client = DomainMappingsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -1777,7 +1975,6 @@ def test_domain_mappings_grpc_lro_async_client(): def test_common_billing_account_path(): billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1798,7 +1995,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = DomainMappingsClient.common_folder_path(folder) assert expected == actual @@ -1817,7 +2013,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = DomainMappingsClient.common_organization_path(organization) assert expected == actual @@ -1836,7 +2031,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = DomainMappingsClient.common_project_path(project) assert expected == actual @@ -1856,7 +2050,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "winkle" location = "nautilus" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1883,7 +2076,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.DomainMappingsTransport, "_prep_wrapped_messages" ) as prep: client = DomainMappingsClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1892,6 +2085,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = DomainMappingsClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 945a7c3..303a69a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,22 +23,52 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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.auth import credentials +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.services.firewall.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.firewall.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 as field_mask # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -83,7 +112,7 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) def test_firewall_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -98,7 +127,7 @@ def test_firewall_client_from_service_account_info(client_class): @pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) def test_firewall_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -143,7 +172,7 @@ def test_firewall_client_get_transport_class(): 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -419,7 +448,7 @@ def test_list_ingress_rules( transport: str = "grpc", request_type=appengine.ListIngressRulesRequest ): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -434,19 +463,15 @@ def test_list_ingress_rules( 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" @@ -458,7 +483,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -468,7 +493,6 @@ def test_list_ingress_rules_empty_call(): client.list_ingress_rules() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListIngressRulesRequest() @@ -477,7 +501,7 @@ async def test_list_ingress_rules_async( transport: str = "grpc_asyncio", request_type=appengine.ListIngressRulesRequest ): client = FirewallAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -492,18 +516,15 @@ async def test_list_ingress_rules_async( 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" @@ -513,11 +534,12 @@ async def test_list_ingress_rules_async_from_dict(): def test_list_ingress_rules_field_headers(): - client = FirewallClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -525,7 +547,6 @@ def test_list_ingress_rules_field_headers(): 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. @@ -540,11 +561,12 @@ def test_list_ingress_rules_field_headers(): @pytest.mark.asyncio async def test_list_ingress_rules_field_headers_async(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -554,7 +576,6 @@ async def test_list_ingress_rules_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( appengine.ListIngressRulesResponse() ) - await client.list_ingress_rules(request) # Establish that the underlying gRPC stub method was called. @@ -568,7 +589,7 @@ async def test_list_ingress_rules_field_headers_async(): def test_list_ingress_rules_pager(): - client = FirewallClient(credentials=credentials.AnonymousCredentials,) + client = FirewallClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -610,7 +631,7 @@ def test_list_ingress_rules_pager(): def test_list_ingress_rules_pages(): - client = FirewallClient(credentials=credentials.AnonymousCredentials,) + client = FirewallClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -644,7 +665,7 @@ def test_list_ingress_rules_pages(): @pytest.mark.asyncio async def test_list_ingress_rules_async_pager(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials,) + client = FirewallAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -685,7 +706,7 @@ async def test_list_ingress_rules_async_pager(): @pytest.mark.asyncio async def test_list_ingress_rules_async_pages(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials,) + client = FirewallAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -725,7 +746,7 @@ def test_batch_update_ingress_rules( transport: str = "grpc", request_type=appengine.BatchUpdateIngressRulesRequest ): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -738,17 +759,14 @@ def test_batch_update_ingress_rules( ) 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) @@ -760,7 +778,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -770,7 +788,6 @@ def test_batch_update_ingress_rules_empty_call(): client.batch_update_ingress_rules() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.BatchUpdateIngressRulesRequest() @@ -780,7 +797,7 @@ async def test_batch_update_ingress_rules_async( request_type=appengine.BatchUpdateIngressRulesRequest, ): client = FirewallAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -795,13 +812,11 @@ async def test_batch_update_ingress_rules_async( 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. @@ -814,11 +829,12 @@ async def test_batch_update_ingress_rules_async_from_dict(): def test_batch_update_ingress_rules_field_headers(): - client = FirewallClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -826,7 +842,6 @@ def test_batch_update_ingress_rules_field_headers(): 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. @@ -841,11 +856,12 @@ def test_batch_update_ingress_rules_field_headers(): @pytest.mark.asyncio async def test_batch_update_ingress_rules_field_headers_async(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -855,7 +871,6 @@ async def test_batch_update_ingress_rules_field_headers_async(): 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. @@ -872,7 +887,7 @@ def test_create_ingress_rule( transport: str = "grpc", request_type=appengine.CreateIngressRuleRequest ): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -890,25 +905,18 @@ def test_create_ingress_rule( 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" @@ -920,7 +928,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -930,7 +938,6 @@ def test_create_ingress_rule_empty_call(): client.create_ingress_rule() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateIngressRuleRequest() @@ -939,7 +946,7 @@ async def test_create_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.CreateIngressRuleRequest ): client = FirewallAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -959,24 +966,18 @@ async def test_create_ingress_rule_async( 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" @@ -986,11 +987,12 @@ async def test_create_ingress_rule_async_from_dict(): def test_create_ingress_rule_field_headers(): - client = FirewallClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -998,7 +1000,6 @@ def test_create_ingress_rule_field_headers(): 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. @@ -1013,11 +1014,12 @@ def test_create_ingress_rule_field_headers(): @pytest.mark.asyncio async def test_create_ingress_rule_field_headers_async(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1027,7 +1029,6 @@ async def test_create_ingress_rule_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( firewall.FirewallRule() ) - await client.create_ingress_rule(request) # Establish that the underlying gRPC stub method was called. @@ -1044,7 +1045,7 @@ def test_get_ingress_rule( transport: str = "grpc", request_type=appengine.GetIngressRuleRequest ): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1060,25 +1061,18 @@ def test_get_ingress_rule( 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" @@ -1090,7 +1084,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1098,7 +1092,6 @@ def test_get_ingress_rule_empty_call(): client.get_ingress_rule() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetIngressRuleRequest() @@ -1107,7 +1100,7 @@ async def test_get_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.GetIngressRuleRequest ): client = FirewallAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1125,24 +1118,18 @@ async def test_get_ingress_rule_async( 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" @@ -1152,17 +1139,17 @@ async def test_get_ingress_rule_async_from_dict(): def test_get_ingress_rule_field_headers(): - client = FirewallClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1177,11 +1164,12 @@ def test_get_ingress_rule_field_headers(): @pytest.mark.asyncio async def test_get_ingress_rule_field_headers_async(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1189,7 +1177,6 @@ async def test_get_ingress_rule_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( firewall.FirewallRule() ) - await client.get_ingress_rule(request) # Establish that the underlying gRPC stub method was called. @@ -1206,7 +1193,7 @@ def test_update_ingress_rule( transport: str = "grpc", request_type=appengine.UpdateIngressRuleRequest ): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1224,25 +1211,18 @@ def test_update_ingress_rule( 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" @@ -1254,7 +1234,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1264,7 +1244,6 @@ def test_update_ingress_rule_empty_call(): client.update_ingress_rule() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateIngressRuleRequest() @@ -1273,7 +1252,7 @@ async def test_update_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateIngressRuleRequest ): client = FirewallAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1293,24 +1272,18 @@ async def test_update_ingress_rule_async( 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" @@ -1320,11 +1293,12 @@ async def test_update_ingress_rule_async_from_dict(): def test_update_ingress_rule_field_headers(): - client = FirewallClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1332,7 +1306,6 @@ def test_update_ingress_rule_field_headers(): 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. @@ -1347,11 +1320,12 @@ def test_update_ingress_rule_field_headers(): @pytest.mark.asyncio async def test_update_ingress_rule_field_headers_async(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1361,7 +1335,6 @@ async def test_update_ingress_rule_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( firewall.FirewallRule() ) - await client.update_ingress_rule(request) # Establish that the underlying gRPC stub method was called. @@ -1378,7 +1351,7 @@ def test_delete_ingress_rule( transport: str = "grpc", request_type=appengine.DeleteIngressRuleRequest ): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1391,13 +1364,11 @@ def test_delete_ingress_rule( ) 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. @@ -1412,7 +1383,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1422,7 +1393,6 @@ def test_delete_ingress_rule_empty_call(): client.delete_ingress_rule() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteIngressRuleRequest() @@ -1431,7 +1401,7 @@ async def test_delete_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteIngressRuleRequest ): client = FirewallAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1444,13 +1414,11 @@ async def test_delete_ingress_rule_async( ) 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. @@ -1463,11 +1431,12 @@ async def test_delete_ingress_rule_async_from_dict(): def test_delete_ingress_rule_field_headers(): - client = FirewallClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1475,7 +1444,6 @@ def test_delete_ingress_rule_field_headers(): 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. @@ -1490,11 +1458,12 @@ def test_delete_ingress_rule_field_headers(): @pytest.mark.asyncio async def test_delete_ingress_rule_field_headers_async(): - client = FirewallAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1502,7 +1471,6 @@ async def test_delete_ingress_rule_field_headers_async(): 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. @@ -1518,16 +1486,16 @@ async def test_delete_ingress_rule_field_headers_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.FirewallGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.FirewallGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = FirewallClient( @@ -1537,7 +1505,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.FirewallGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = FirewallClient( @@ -1548,7 +1516,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.FirewallGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = FirewallClient(transport=transport) assert client.transport is transport @@ -1557,13 +1525,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.FirewallGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.FirewallGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1575,23 +1543,23 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = FirewallClient(credentials=credentials.AnonymousCredentials(),) + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.FirewallTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1603,7 +1571,7 @@ def test_firewall_base_transport(): ) as Transport: Transport.return_value = None transport = transports.FirewallTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1621,15 +1589,41 @@ def test_firewall_base_transport(): getattr(transport, method)(request=object()) +@requires_google_auth_gte_1_25_0 def test_firewall_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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 = (credentials.AnonymousCredentials(), 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_firewall_base_transport_with_credentials_file_old_google_auth(): + # 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", ) @@ -1646,19 +1640,37 @@ def test_firewall_base_transport_with_credentials_file(): def test_firewall_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FirewallTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_firewall_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_firewall_auth_adc_old_google_auth(): + # 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=( @@ -1670,14 +1682,39 @@ def test_firewall_auth_adc(): ) -def test_firewall_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [transports.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport,], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.FirewallGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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,], +) +@requires_google_auth_lt_1_25_0 +def test_firewall_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -1688,12 +1725,125 @@ def test_firewall_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.FirewallGrpcTransport, grpc_helpers), + (transports.FirewallGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.FirewallGrpcTransport, grpc_helpers), + (transports.FirewallGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_firewall_transport_create_channel_old_api_core(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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.FirewallGrpcTransport, grpc_helpers), + (transports.FirewallGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_firewall_transport_create_channel_user_scopes(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", + scopes=["1", "2"], + 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 = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1736,7 +1886,7 @@ def test_firewall_grpc_transport_client_cert_source_for_mtls(transport_class): def test_firewall_host_no_port(): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -1746,7 +1896,7 @@ def test_firewall_host_no_port(): def test_firewall_host_with_port(): client = FirewallClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1797,9 +1947,9 @@ def test_firewall_transport_channel_mtls_with_client_cert_source(transport_class mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1880,7 +2030,6 @@ def test_firewall_transport_channel_mtls_with_adc(transport_class): def test_common_billing_account_path(): billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1901,7 +2050,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = FirewallClient.common_folder_path(folder) assert expected == actual @@ -1920,7 +2068,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = FirewallClient.common_organization_path(organization) assert expected == actual @@ -1939,7 +2086,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = FirewallClient.common_project_path(project) assert expected == actual @@ -1959,7 +2105,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "winkle" location = "nautilus" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1986,7 +2131,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.FirewallTransport, "_prep_wrapped_messages" ) as prep: client = FirewallClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1995,6 +2140,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = FirewallClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 9b18ecc..3d5d5a9 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,27 +23,57 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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_async # type: ignore from google.api_core import operations_v1 -from google.auth import credentials +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.services.instances.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.instances.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 timestamp_pb2 as timestamp # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -88,7 +117,7 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) def test_instances_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -103,7 +132,7 @@ def test_instances_client_from_service_account_info(client_class): @pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) def test_instances_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -152,7 +181,7 @@ def test_instances_client_get_transport_class(): 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -436,7 +465,7 @@ def test_list_instances( transport: str = "grpc", request_type=appengine.ListInstancesRequest ): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -449,19 +478,15 @@ def test_list_instances( 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" @@ -473,7 +498,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -481,7 +506,6 @@ def test_list_instances_empty_call(): client.list_instances() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListInstancesRequest() @@ -490,7 +514,7 @@ async def test_list_instances_async( transport: str = "grpc_asyncio", request_type=appengine.ListInstancesRequest ): client = InstancesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -503,18 +527,15 @@ async def test_list_instances_async( 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" @@ -524,17 +545,17 @@ async def test_list_instances_async_from_dict(): def test_list_instances_field_headers(): - client = InstancesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -549,11 +570,12 @@ def test_list_instances_field_headers(): @pytest.mark.asyncio async def test_list_instances_field_headers_async(): - client = InstancesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -561,7 +583,6 @@ async def test_list_instances_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( appengine.ListInstancesResponse() ) - await client.list_instances(request) # Establish that the underlying gRPC stub method was called. @@ -575,7 +596,7 @@ async def test_list_instances_field_headers_async(): def test_list_instances_pager(): - client = InstancesClient(credentials=credentials.AnonymousCredentials,) + client = InstancesClient(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__") as call: @@ -613,7 +634,7 @@ def test_list_instances_pager(): def test_list_instances_pages(): - client = InstancesClient(credentials=credentials.AnonymousCredentials,) + client = InstancesClient(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__") as call: @@ -643,7 +664,7 @@ def test_list_instances_pages(): @pytest.mark.asyncio async def test_list_instances_async_pager(): - client = InstancesAsyncClient(credentials=credentials.AnonymousCredentials,) + client = InstancesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -680,7 +701,7 @@ async def test_list_instances_async_pager(): @pytest.mark.asyncio async def test_list_instances_async_pages(): - client = InstancesAsyncClient(credentials=credentials.AnonymousCredentials,) + client = InstancesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -716,7 +737,7 @@ def test_get_instance( transport: str = "grpc", request_type=appengine.GetInstanceRequest ): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -744,49 +765,30 @@ def test_get_instance( 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.340, 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 @@ -798,7 +800,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -806,7 +808,6 @@ def test_get_instance_empty_call(): client.get_instance() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetInstanceRequest() @@ -815,7 +816,7 @@ async def test_get_instance_async( transport: str = "grpc_asyncio", request_type=appengine.GetInstanceRequest ): client = InstancesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -845,48 +846,30 @@ async def test_get_instance_async( 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.340, 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 @@ -896,17 +879,17 @@ async def test_get_instance_async_from_dict(): def test_get_instance_field_headers(): - client = InstancesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -921,17 +904,17 @@ def test_get_instance_field_headers(): @pytest.mark.asyncio async def test_get_instance_field_headers_async(): - client = InstancesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -948,7 +931,7 @@ def test_delete_instance( transport: str = "grpc", request_type=appengine.DeleteInstanceRequest ): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -959,13 +942,11 @@ def test_delete_instance( 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. @@ -980,7 +961,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -988,7 +969,6 @@ def test_delete_instance_empty_call(): client.delete_instance() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteInstanceRequest() @@ -997,7 +977,7 @@ async def test_delete_instance_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteInstanceRequest ): client = InstancesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1010,13 +990,11 @@ async def test_delete_instance_async( 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. @@ -1029,17 +1007,17 @@ async def test_delete_instance_async_from_dict(): def test_delete_instance_field_headers(): - client = InstancesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1054,11 +1032,12 @@ def test_delete_instance_field_headers(): @pytest.mark.asyncio async def test_delete_instance_field_headers_async(): - client = InstancesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1066,7 +1045,6 @@ async def test_delete_instance_field_headers_async(): 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. @@ -1083,7 +1061,7 @@ def test_debug_instance( transport: str = "grpc", request_type=appengine.DebugInstanceRequest ): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1094,13 +1072,11 @@ def test_debug_instance( 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. @@ -1115,7 +1091,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1123,7 +1099,6 @@ def test_debug_instance_empty_call(): client.debug_instance() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DebugInstanceRequest() @@ -1132,7 +1107,7 @@ async def test_debug_instance_async( transport: str = "grpc_asyncio", request_type=appengine.DebugInstanceRequest ): client = InstancesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1145,13 +1120,11 @@ async def test_debug_instance_async( 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. @@ -1164,17 +1137,17 @@ async def test_debug_instance_async_from_dict(): def test_debug_instance_field_headers(): - client = InstancesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1189,11 +1162,12 @@ def test_debug_instance_field_headers(): @pytest.mark.asyncio async def test_debug_instance_field_headers_async(): - client = InstancesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1201,7 +1175,6 @@ async def test_debug_instance_field_headers_async(): 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. @@ -1217,16 +1190,16 @@ async def test_debug_instance_field_headers_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.InstancesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.InstancesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = InstancesClient( @@ -1236,7 +1209,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.InstancesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = InstancesClient( @@ -1247,7 +1220,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.InstancesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = InstancesClient(transport=transport) assert client.transport is transport @@ -1256,13 +1229,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.InstancesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.InstancesGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1274,23 +1247,23 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = InstancesClient(credentials=credentials.AnonymousCredentials(),) + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.InstancesTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1302,7 +1275,7 @@ def test_instances_base_transport(): ) as Transport: Transport.return_value = None transport = transports.InstancesTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1323,15 +1296,41 @@ def test_instances_base_transport(): transport.operations_client +@requires_google_auth_gte_1_25_0 def test_instances_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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 = (credentials.AnonymousCredentials(), 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_instances_base_transport_with_credentials_file_old_google_auth(): + # 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", ) @@ -1348,19 +1347,37 @@ def test_instances_base_transport_with_credentials_file(): def test_instances_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InstancesTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_instances_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_instances_auth_adc_old_google_auth(): + # 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=( @@ -1372,14 +1389,39 @@ def test_instances_auth_adc(): ) -def test_instances_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [transports.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport,], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.InstancesGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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,], +) +@requires_google_auth_lt_1_25_0 +def test_instances_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -1390,12 +1432,125 @@ def test_instances_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.InstancesGrpcTransport, grpc_helpers), + (transports.InstancesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.InstancesGrpcTransport, grpc_helpers), + (transports.InstancesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_instances_transport_create_channel_old_api_core(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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.InstancesGrpcTransport, grpc_helpers), + (transports.InstancesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_instances_transport_create_channel_user_scopes(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", + scopes=["1", "2"], + 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 = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1438,7 +1593,7 @@ def test_instances_grpc_transport_client_cert_source_for_mtls(transport_class): def test_instances_host_no_port(): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -1448,7 +1603,7 @@ def test_instances_host_no_port(): def test_instances_host_with_port(): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1499,9 +1654,9 @@ def test_instances_transport_channel_mtls_with_client_cert_source(transport_clas mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1582,7 +1737,7 @@ def test_instances_transport_channel_mtls_with_adc(transport_class): def test_instances_grpc_lro_client(): client = InstancesClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -1595,7 +1750,7 @@ def test_instances_grpc_lro_client(): def test_instances_grpc_lro_async_client(): client = InstancesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -1611,7 +1766,6 @@ def test_instance_path(): service = "clam" version = "whelk" instance = "octopus" - expected = "apps/{app}/services/{service}/versions/{version}/instances/{instance}".format( app=app, service=service, version=version, instance=instance, ) @@ -1635,7 +1789,6 @@ def test_parse_instance_path(): def test_common_billing_account_path(): billing_account = "winkle" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1656,7 +1809,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) actual = InstancesClient.common_folder_path(folder) assert expected == actual @@ -1675,7 +1827,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) actual = InstancesClient.common_organization_path(organization) assert expected == actual @@ -1694,7 +1845,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) actual = InstancesClient.common_project_path(project) assert expected == actual @@ -1714,7 +1864,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "oyster" location = "nudibranch" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1741,7 +1890,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.InstancesTransport, "_prep_wrapped_messages" ) as prep: client = InstancesClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1750,6 +1899,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = InstancesClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 69f3818..88ad621 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,28 +23,58 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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_async # type: ignore from google.api_core import operations_v1 -from google.auth import credentials +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.services.services.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.services.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 field_mask_pb2 as field_mask # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -89,7 +118,7 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) def test_services_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -104,7 +133,7 @@ def test_services_client_from_service_account_info(client_class): @pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) def test_services_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -149,7 +178,7 @@ def test_services_client_get_transport_class(): 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -425,7 +454,7 @@ def test_list_services( transport: str = "grpc", request_type=appengine.ListServicesRequest ): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -438,19 +467,15 @@ def test_list_services( 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" @@ -462,7 +487,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -470,7 +495,6 @@ def test_list_services_empty_call(): client.list_services() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListServicesRequest() @@ -479,7 +503,7 @@ async def test_list_services_async( transport: str = "grpc_asyncio", request_type=appengine.ListServicesRequest ): client = ServicesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -492,18 +516,15 @@ async def test_list_services_async( 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" @@ -513,17 +534,17 @@ async def test_list_services_async_from_dict(): def test_list_services_field_headers(): - client = ServicesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -538,11 +559,12 @@ def test_list_services_field_headers(): @pytest.mark.asyncio async def test_list_services_field_headers_async(): - client = ServicesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -550,7 +572,6 @@ async def test_list_services_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( appengine.ListServicesResponse() ) - await client.list_services(request) # Establish that the underlying gRPC stub method was called. @@ -564,7 +585,7 @@ async def test_list_services_field_headers_async(): def test_list_services_pager(): - client = ServicesClient(credentials=credentials.AnonymousCredentials,) + client = ServicesClient(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__") as call: @@ -598,7 +619,7 @@ def test_list_services_pager(): def test_list_services_pages(): - client = ServicesClient(credentials=credentials.AnonymousCredentials,) + client = ServicesClient(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__") as call: @@ -624,7 +645,7 @@ def test_list_services_pages(): @pytest.mark.asyncio async def test_list_services_async_pager(): - client = ServicesAsyncClient(credentials=credentials.AnonymousCredentials,) + client = ServicesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -657,7 +678,7 @@ async def test_list_services_async_pager(): @pytest.mark.asyncio async def test_list_services_async_pages(): - client = ServicesAsyncClient(credentials=credentials.AnonymousCredentials,) + client = ServicesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -687,7 +708,7 @@ async def test_list_services_async_pages(): def test_get_service(transport: str = "grpc", request_type=appengine.GetServiceRequest): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -698,21 +719,16 @@ def test_get_service(transport: str = "grpc", request_type=appengine.GetServiceR 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" @@ -724,7 +740,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -732,7 +748,6 @@ def test_get_service_empty_call(): client.get_service() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetServiceRequest() @@ -741,7 +756,7 @@ async def test_get_service_async( transport: str = "grpc_asyncio", request_type=appengine.GetServiceRequest ): client = ServicesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -754,20 +769,16 @@ async def test_get_service_async( 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" @@ -777,17 +788,17 @@ async def test_get_service_async_from_dict(): def test_get_service_field_headers(): - client = ServicesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -802,17 +813,17 @@ def test_get_service_field_headers(): @pytest.mark.asyncio async def test_get_service_field_headers_async(): - client = ServicesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -829,7 +840,7 @@ def test_update_service( transport: str = "grpc", request_type=appengine.UpdateServiceRequest ): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -840,13 +851,11 @@ def test_update_service( 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. @@ -861,7 +870,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -869,7 +878,6 @@ def test_update_service_empty_call(): client.update_service() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateServiceRequest() @@ -878,7 +886,7 @@ async def test_update_service_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateServiceRequest ): client = ServicesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -891,13 +899,11 @@ async def test_update_service_async( 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. @@ -910,17 +916,17 @@ async def test_update_service_async_from_dict(): def test_update_service_field_headers(): - client = ServicesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -935,11 +941,12 @@ def test_update_service_field_headers(): @pytest.mark.asyncio async def test_update_service_field_headers_async(): - client = ServicesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -947,7 +954,6 @@ async def test_update_service_field_headers_async(): 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. @@ -964,7 +970,7 @@ def test_delete_service( transport: str = "grpc", request_type=appengine.DeleteServiceRequest ): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -975,13 +981,11 @@ def test_delete_service( 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. @@ -996,7 +1000,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1004,7 +1008,6 @@ def test_delete_service_empty_call(): client.delete_service() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteServiceRequest() @@ -1013,7 +1016,7 @@ async def test_delete_service_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteServiceRequest ): client = ServicesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1026,13 +1029,11 @@ async def test_delete_service_async( 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. @@ -1045,17 +1046,17 @@ async def test_delete_service_async_from_dict(): def test_delete_service_field_headers(): - client = ServicesClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1070,11 +1071,12 @@ def test_delete_service_field_headers(): @pytest.mark.asyncio async def test_delete_service_field_headers_async(): - client = ServicesAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1082,7 +1084,6 @@ async def test_delete_service_field_headers_async(): 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. @@ -1098,16 +1099,16 @@ async def test_delete_service_field_headers_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServicesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServicesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServicesClient( @@ -1117,7 +1118,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.ServicesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServicesClient( @@ -1128,7 +1129,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServicesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServicesClient(transport=transport) assert client.transport is transport @@ -1137,13 +1138,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServicesGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServicesGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1155,23 +1156,23 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ServicesClient(credentials=credentials.AnonymousCredentials(),) + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServicesTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1183,7 +1184,7 @@ def test_services_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServicesTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1204,15 +1205,41 @@ def test_services_base_transport(): transport.operations_client +@requires_google_auth_gte_1_25_0 def test_services_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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 = (credentials.AnonymousCredentials(), 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_services_base_transport_with_credentials_file_old_google_auth(): + # 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", ) @@ -1229,19 +1256,37 @@ def test_services_base_transport_with_credentials_file(): def test_services_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServicesTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_services_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_services_auth_adc_old_google_auth(): + # 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=( @@ -1253,14 +1298,39 @@ def test_services_auth_adc(): ) -def test_services_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport,], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.ServicesGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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,], +) +@requires_google_auth_lt_1_25_0 +def test_services_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -1271,12 +1341,125 @@ def test_services_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ServicesGrpcTransport, grpc_helpers), + (transports.ServicesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.ServicesGrpcTransport, grpc_helpers), + (transports.ServicesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_services_transport_create_channel_old_api_core(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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ServicesGrpcTransport, grpc_helpers), + (transports.ServicesGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_services_transport_create_channel_user_scopes(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", + scopes=["1", "2"], + 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 = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1319,7 +1502,7 @@ def test_services_grpc_transport_client_cert_source_for_mtls(transport_class): def test_services_host_no_port(): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -1329,7 +1512,7 @@ def test_services_host_no_port(): def test_services_host_with_port(): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1380,9 +1563,9 @@ def test_services_transport_channel_mtls_with_client_cert_source(transport_class mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1463,7 +1646,7 @@ def test_services_transport_channel_mtls_with_adc(transport_class): def test_services_grpc_lro_client(): client = ServicesClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -1476,7 +1659,7 @@ def test_services_grpc_lro_client(): def test_services_grpc_lro_async_client(): client = ServicesAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -1489,7 +1672,6 @@ def test_services_grpc_lro_async_client(): def test_common_billing_account_path(): billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1510,7 +1692,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = ServicesClient.common_folder_path(folder) assert expected == actual @@ -1529,7 +1710,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = ServicesClient.common_organization_path(organization) assert expected == actual @@ -1548,7 +1728,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = ServicesClient.common_project_path(project) assert expected == actual @@ -1568,7 +1747,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "winkle" location = "nautilus" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1595,7 +1773,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.ServicesTransport, "_prep_wrapped_messages" ) as prep: client = ServicesClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1604,6 +1782,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = ServicesClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index ef68c8f..6110074 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import os import mock +import packaging.version import grpc from grpc.experimental import aio @@ -24,21 +23,27 @@ import pytest from proto.marshal.rules.dates import DurationRule, TimestampRule -from google import auth + from google.api_core import client_options -from google.api_core import exceptions +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_async # type: ignore from google.api_core import operations_v1 -from google.auth import credentials +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.services.versions.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.appengine_admin_v1.services.versions.transports.base import ( + _GOOGLE_AUTH_VERSION, +) 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 @@ -46,9 +51,33 @@ 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 as duration # type: ignore -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import google.auth + + +# TODO(busunkim): Once google-api-core >= 1.26.0 is required: +# - Delete all the api-core and auth "less than" test cases +# - Delete these pytest markers (Make the "greater than or equal to" tests the default). +requires_google_auth_lt_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), + reason="This test requires google-auth < 1.25.0", +) +requires_google_auth_gte_1_25_0 = pytest.mark.skipif( + packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), + reason="This test requires google-auth >= 1.25.0", +) + +requires_api_core_lt_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), + reason="This test requires google-api-core < 1.26.0", +) + +requires_api_core_gte_1_26_0 = pytest.mark.skipif( + packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), + reason="This test requires google-api-core >= 1.26.0", +) def client_cert_source_callback(): @@ -92,7 +121,7 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) def test_versions_client_from_service_account_info(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -107,7 +136,7 @@ def test_versions_client_from_service_account_info(client_class): @pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) def test_versions_client_from_service_account_file(client_class): - creds = credentials.AnonymousCredentials() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -152,7 +181,7 @@ def test_versions_client_get_transport_class(): 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=credentials.AnonymousCredentials()) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -428,7 +457,7 @@ def test_list_versions( transport: str = "grpc", request_type=appengine.ListVersionsRequest ): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -441,19 +470,15 @@ def test_list_versions( 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" @@ -465,7 +490,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -473,7 +498,6 @@ def test_list_versions_empty_call(): client.list_versions() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListVersionsRequest() @@ -482,7 +506,7 @@ async def test_list_versions_async( transport: str = "grpc_asyncio", request_type=appengine.ListVersionsRequest ): client = VersionsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -495,18 +519,15 @@ async def test_list_versions_async( 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" @@ -516,17 +537,17 @@ async def test_list_versions_async_from_dict(): def test_list_versions_field_headers(): - client = VersionsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -541,11 +562,12 @@ def test_list_versions_field_headers(): @pytest.mark.asyncio async def test_list_versions_field_headers_async(): - client = VersionsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -553,7 +575,6 @@ async def test_list_versions_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( appengine.ListVersionsResponse() ) - await client.list_versions(request) # Establish that the underlying gRPC stub method was called. @@ -567,7 +588,7 @@ async def test_list_versions_field_headers_async(): def test_list_versions_pager(): - client = VersionsClient(credentials=credentials.AnonymousCredentials,) + client = VersionsClient(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__") as call: @@ -601,7 +622,7 @@ def test_list_versions_pager(): def test_list_versions_pages(): - client = VersionsClient(credentials=credentials.AnonymousCredentials,) + client = VersionsClient(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__") as call: @@ -627,7 +648,7 @@ def test_list_versions_pages(): @pytest.mark.asyncio async def test_list_versions_async_pager(): - client = VersionsAsyncClient(credentials=credentials.AnonymousCredentials,) + client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -660,7 +681,7 @@ async def test_list_versions_async_pager(): @pytest.mark.asyncio async def test_list_versions_async_pages(): - client = VersionsAsyncClient(credentials=credentials.AnonymousCredentials,) + client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -690,7 +711,7 @@ async def test_list_versions_async_pages(): def test_get_version(transport: str = "grpc", request_type=appengine.GetVersionRequest): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -720,58 +741,37 @@ def test_get_version(transport: str = "grpc", request_type=appengine.GetVersionR nobuild_files_regex="nobuild_files_regex_value", version_url="version_url_value", automatic_scaling=version.AutomaticScaling( - cool_down_period=duration.Duration(seconds=751) + cool_down_period=duration_pb2.Duration(seconds=751) ), ) - 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.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" @@ -783,7 +783,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -791,7 +791,6 @@ def test_get_version_empty_call(): client.get_version() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetVersionRequest() @@ -800,7 +799,7 @@ async def test_get_version_async( transport: str = "grpc_asyncio", request_type=appengine.GetVersionRequest ): client = VersionsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -832,54 +831,34 @@ async def test_get_version_async( 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.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" @@ -889,17 +868,17 @@ async def test_get_version_async_from_dict(): def test_get_version_field_headers(): - client = VersionsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -914,17 +893,17 @@ def test_get_version_field_headers(): @pytest.mark.asyncio async def test_get_version_field_headers_async(): - client = VersionsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -941,7 +920,7 @@ def test_create_version( transport: str = "grpc", request_type=appengine.CreateVersionRequest ): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -952,13 +931,11 @@ def test_create_version( 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. @@ -973,7 +950,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -981,7 +958,6 @@ def test_create_version_empty_call(): client.create_version() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateVersionRequest() @@ -990,7 +966,7 @@ async def test_create_version_async( transport: str = "grpc_asyncio", request_type=appengine.CreateVersionRequest ): client = VersionsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1003,13 +979,11 @@ async def test_create_version_async( 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. @@ -1022,17 +996,17 @@ async def test_create_version_async_from_dict(): def test_create_version_field_headers(): - client = VersionsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1047,11 +1021,12 @@ def test_create_version_field_headers(): @pytest.mark.asyncio async def test_create_version_field_headers_async(): - client = VersionsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1059,7 +1034,6 @@ async def test_create_version_field_headers_async(): 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. @@ -1076,7 +1050,7 @@ def test_update_version( transport: str = "grpc", request_type=appengine.UpdateVersionRequest ): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1087,13 +1061,11 @@ def test_update_version( 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. @@ -1108,7 +1080,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1116,7 +1088,6 @@ def test_update_version_empty_call(): client.update_version() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateVersionRequest() @@ -1125,7 +1096,7 @@ async def test_update_version_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateVersionRequest ): client = VersionsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1138,13 +1109,11 @@ async def test_update_version_async( 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. @@ -1157,17 +1126,17 @@ async def test_update_version_async_from_dict(): def test_update_version_field_headers(): - client = VersionsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1182,11 +1151,12 @@ def test_update_version_field_headers(): @pytest.mark.asyncio async def test_update_version_field_headers_async(): - client = VersionsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1194,7 +1164,6 @@ async def test_update_version_field_headers_async(): 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. @@ -1211,7 +1180,7 @@ def test_delete_version( transport: str = "grpc", request_type=appengine.DeleteVersionRequest ): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1222,13 +1191,11 @@ def test_delete_version( 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. @@ -1243,7 +1210,7 @@ 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=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1251,7 +1218,6 @@ def test_delete_version_empty_call(): client.delete_version() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteVersionRequest() @@ -1260,7 +1226,7 @@ async def test_delete_version_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteVersionRequest ): client = VersionsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1273,13 +1239,11 @@ async def test_delete_version_async( 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. @@ -1292,17 +1256,17 @@ async def test_delete_version_async_from_dict(): def test_delete_version_field_headers(): - client = VersionsClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1317,11 +1281,12 @@ def test_delete_version_field_headers(): @pytest.mark.asyncio async def test_delete_version_field_headers_async(): - client = VersionsAsyncClient(credentials=credentials.AnonymousCredentials(),) + 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. @@ -1329,7 +1294,6 @@ async def test_delete_version_field_headers_async(): 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. @@ -1345,16 +1309,16 @@ async def test_delete_version_field_headers_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.VersionsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.VersionsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = VersionsClient( @@ -1364,7 +1328,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.VersionsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = VersionsClient( @@ -1375,7 +1339,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.VersionsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = VersionsClient(transport=transport) assert client.transport is transport @@ -1384,13 +1348,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.VersionsGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.VersionsGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1402,23 +1366,23 @@ def test_transport_get_channel(): ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + with mock.patch.object(google.auth, "default") as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = VersionsClient(credentials=credentials.AnonymousCredentials(),) + 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(exceptions.DuplicateCredentialArgs): + with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.VersionsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1430,7 +1394,7 @@ def test_versions_base_transport(): ) as Transport: Transport.return_value = None transport = transports.VersionsTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1452,15 +1416,41 @@ def test_versions_base_transport(): transport.operations_client +@requires_google_auth_gte_1_25_0 def test_versions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( - auth, "load_credentials_from_file" + 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 = (credentials.AnonymousCredentials(), 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", + ) + + +@requires_google_auth_lt_1_25_0 +def test_versions_base_transport_with_credentials_file_old_google_auth(): + # 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", ) @@ -1477,19 +1467,37 @@ def test_versions_base_transport_with_credentials_file(): def test_versions_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(auth, "default") as adc, mock.patch( + 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 = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.VersionsTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_versions_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) + 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, + ) + + +@requires_google_auth_lt_1_25_0 +def test_versions_auth_adc_old_google_auth(): + # 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=( @@ -1501,14 +1509,39 @@ def test_versions_auth_adc(): ) -def test_versions_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], +) +@requires_google_auth_gte_1_25_0 +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(auth, "default") as adc: - adc.return_value = (credentials.AnonymousCredentials(), None) - transports.VersionsGrpcTransport( - host="squid.clam.whelk", quota_project_id="octopus" + 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,], +) +@requires_google_auth_lt_1_25_0 +def test_versions_transport_auth_adc_old_google_auth(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") adc.assert_called_once_with( scopes=( "https://www.googleapis.com/auth/appengine.admin", @@ -1519,12 +1552,125 @@ def test_versions_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.VersionsGrpcTransport, grpc_helpers), + (transports.VersionsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +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,grpc_helpers", + [ + (transports.VersionsGrpcTransport, grpc_helpers), + (transports.VersionsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_versions_transport_create_channel_old_api_core(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") + + create_channel.assert_called_with( + "appengine.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=( + "https://www.googleapis.com/auth/appengine.admin", + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.VersionsGrpcTransport, grpc_helpers), + (transports.VersionsGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_versions_transport_create_channel_user_scopes(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", + scopes=["1", "2"], + 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 = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1567,7 +1713,7 @@ def test_versions_grpc_transport_client_cert_source_for_mtls(transport_class): def test_versions_host_no_port(): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com" ), @@ -1577,7 +1723,7 @@ def test_versions_host_no_port(): def test_versions_host_with_port(): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="appengine.googleapis.com:8000" ), @@ -1628,9 +1774,9 @@ def test_versions_transport_channel_mtls_with_client_cert_source(transport_class mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = credentials.AnonymousCredentials() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(auth, "default") as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1711,7 +1857,7 @@ def test_versions_transport_channel_mtls_with_adc(transport_class): def test_versions_grpc_lro_client(): client = VersionsClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -1724,7 +1870,7 @@ def test_versions_grpc_lro_client(): def test_versions_grpc_lro_async_client(): client = VersionsAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -1737,7 +1883,6 @@ def test_versions_grpc_lro_async_client(): def test_common_billing_account_path(): billing_account = "squid" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1758,7 +1903,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = VersionsClient.common_folder_path(folder) assert expected == actual @@ -1777,7 +1921,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = VersionsClient.common_organization_path(organization) assert expected == actual @@ -1796,7 +1939,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = VersionsClient.common_project_path(project) assert expected == actual @@ -1816,7 +1958,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "winkle" location = "nautilus" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1843,7 +1984,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.VersionsTransport, "_prep_wrapped_messages" ) as prep: client = VersionsClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1852,6 +1993,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = VersionsClient.get_transport_class() transport = transport_class( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) From 8384205f74c0c05de5b21f1711d94d36e938f147 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 16 May 2021 11:10:02 +0000 Subject: [PATCH 010/185] chore: new owl bot post processor docker image (#21) gcr.io/repo-automation-bots/owlbot-python:latest@sha256:4c981a6b6f2b8914a448d7b3a01688365be03e3ed26dfee399a6aa77fb112eaa --- .github/.OwlBot.lock.yaml | 5 ++--- .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d49860b..864c176 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,4 +1,3 @@ docker: - digest: sha256:457583330eec64daa02aeb7a72a04d33e7be2428f646671ce4045dcbc0191b1e - image: gcr.io/repo-automation-bots/owlbot-python:latest - + image: gcr.io/repo-automation-bots/owlbot-python:latest + digest: sha256:4c981a6b6f2b8914a448d7b3a01688365be03e3ed26dfee399a6aa77fb112eaa diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1bbd787..4f00c7c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.1 + rev: 3.9.2 hooks: - id: flake8 From f352b811c13dd4b5b9fecf719dad05ce292e61fa Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Mon, 17 May 2021 18:52:04 -0600 Subject: [PATCH 011/185] fix(deps): add packaging requirement (#20) Add packaging requirement. packaging.version is used for a version comparison in transports/base.py and is needed after the upgrade to gapic-generator-python 0.46.3 --- setup.py | 2 +- testing/constraints-3.6.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 283fa3d..88de90c 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ dependencies = [ "google-api-core[grpc] >= 1.22.2, < 2.0.0dev", "proto-plus >= 1.18.1", - "grpc-google-iam-v1", + "packaging >= 14.3" "grpc-google-iam-v1", "six", ] diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index dd25d17..e5c3a86 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -9,3 +9,4 @@ google-api-core==1.22.2 proto-plus==1.18.1 grpc-google-iam-v1==0.12.3 six==1.13.0 +packaging==14.3 From 365e46d483c14388262d5fd73d8161bff9aa2f82 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 22 May 2021 09:20:22 +0000 Subject: [PATCH 012/185] chore: new owl bot post processor docker image (#24) gcr.io/repo-automation-bots/owlbot-python:latest@sha256:3c3a445b3ddc99ccd5d31edc4b4519729635d20693900db32c4f587ed51f7479 --- .github/.OwlBot.lock.yaml | 2 +- noxfile.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 864c176..46e3f02 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:4c981a6b6f2b8914a448d7b3a01688365be03e3ed26dfee399a6aa77fb112eaa + digest: sha256:3c3a445b3ddc99ccd5d31edc4b4519729635d20693900db32c4f587ed51f7479 diff --git a/noxfile.py b/noxfile.py index 1d45cad..94ee6a8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -179,7 +179,7 @@ def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx", "alabaster", "recommonmark") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( @@ -201,7 +201,9 @@ def docfx(session): """Build the docfx yaml files for this library.""" session.install("-e", ".") - session.install("sphinx", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml") + session.install( + "sphinx==4.0.1", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml" + ) shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( From 4a739c635262291d8935bdb50f3f813d8a5313de Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 28 May 2021 15:52:07 +0000 Subject: [PATCH 013/185] chore: new owl bot post processor docker image (#25) gcr.io/repo-automation-bots/owlbot-python:latest@sha256:0856ca711da1fd5ec9d6d7da6c50aa0bbf550fb94acb47b55159a640791987bf --- .github/.OwlBot.lock.yaml | 2 +- docs/multiprocessing.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 46e3f02..127c2cd 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:3c3a445b3ddc99ccd5d31edc4b4519729635d20693900db32c4f587ed51f7479 + digest: sha256:0856ca711da1fd5ec9d6d7da6c50aa0bbf550fb94acb47b55159a640791987bf diff --git a/docs/multiprocessing.rst b/docs/multiprocessing.rst index 1cb29d4..536d17b 100644 --- a/docs/multiprocessing.rst +++ b/docs/multiprocessing.rst @@ -1,7 +1,7 @@ .. note:: - Because this client uses :mod:`grpcio` library, it is safe to + 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` or + :func:`os.fork` by :class:`multiprocessing.pool.Pool` or :class:`multiprocessing.Process`. From cc99d80d0586da5d2b4e830aa2c88cf54e25dbaf Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 28 May 2021 16:04:03 +0000 Subject: [PATCH 014/185] chore: new owl bot post processor docker image (#26) Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:c66ba3c8d7bc8566f47df841f98cd0097b28fff0b1864c86f5817f4c8c3e8600 --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 127c2cd..da616c9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:0856ca711da1fd5ec9d6d7da6c50aa0bbf550fb94acb47b55159a640791987bf + digest: sha256:c66ba3c8d7bc8566f47df841f98cd0097b28fff0b1864c86f5817f4c8c3e8600 diff --git a/docs/conf.py b/docs/conf.py index 5ac1c11..9b1d9d1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -363,6 +363,7 @@ "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), } From 98e7600baf389a063cff5296cc85080104a9fa12 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 20:58:13 +0000 Subject: [PATCH 015/185] chore: release 0.2.0 (#19) :robot: I have created a release \*beep\* \*boop\* --- ## [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 13 +++++++++++++ setup.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 758a10a..8e399c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [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) diff --git a/setup.py b/setup.py index 88de90c..e1db85b 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "0.1.0" +version = "0.2.0" description = "App Engine Admin API client library" release_status = "Development Status :: 4 - Beta" url = "https://github.com/googleapis/python-appengine-admin" From 4cb167891b8d926389dd9561de8ea7b5314906c4 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 2 Jun 2021 06:08:02 -0400 Subject: [PATCH 016/185] feat: bump release level to production/stable (#23) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #22 🦕 --- .repo-metadata.json | 2 +- README.rst | 6 +++--- setup.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index ce8c9f0..5453494 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/appengine/docs/admin-api/", "client_documentation": "https://googleapis.dev/python/appengine/latest", "issue_tracker": "", - "release_level": "beta", + "release_level": "ga", "language": "python", "library_type": "GAPIC_AUTO", "repo": "googleapis/python-appengine-admin", diff --git a/README.rst b/README.rst index b2f5998..72ab199 100644 --- a/README.rst +++ b/README.rst @@ -1,15 +1,15 @@ Python Client for App Engine Admin ================================== -|beta| |pypi| |versions| +|GA| |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/master/README.rst#beta-support +.. |GA| image:: https://img.shields.io/badge/support-ga-gold.svg + :target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#general-availability .. |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 diff --git a/setup.py b/setup.py index e1db85b..656ca90 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-appengine-admin" version = "0.2.0" description = "App Engine Admin API client library" -release_status = "Development Status :: 4 - Beta" +release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" dependencies = [ "google-api-core[grpc] >= 1.22.2, < 2.0.0dev", From de071b09a7ec19637452856e1bbdb522e5f1d050 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 2 Jun 2021 14:50:03 -0400 Subject: [PATCH 017/185] chore: release as 1.0.0 (#28) Release-As: 1.0.0 From 0e933728d9b3a47d41c4264e9b9c608dac8ede23 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Jun 2021 18:56:04 +0000 Subject: [PATCH 018/185] chore: release 1.0.0 (#29) :robot: I have created a release \*beep\* \*boop\* --- ## [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e399c4..9a3e91d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [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) diff --git a/setup.py b/setup.py index 656ca90..95bf78d 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "0.2.0" +version = "1.0.0" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 16ad4acea57a44126d0d954962a15a455dfbdbf0 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 15 Jun 2021 18:52:22 -0600 Subject: [PATCH 019/185] fix: exclude docs and tests from package (#30) Only include packages that start with google in the published artifact --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 95bf78d..9c4e984 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,11 @@ author_email="googleapis-packages@google.com", license="Apache 2.0", url=url, - packages=setuptools.PEP420PackageFinder.find(), + 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, From b91826d7e488910cd9a7f79c1c03350263004670 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 16 Jun 2021 01:52:06 +0000 Subject: [PATCH 020/185] chore: release 1.0.1 (#31) :robot: I have created a release \*beep\* \*boop\* --- ### [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a3e91d..f7aef2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 9c4e984..9828c6e 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.0.0" +version = "1.0.1" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 1a749effe4873c759a1630c0d836bafa193856c6 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 16 Jun 2021 11:04:02 -0400 Subject: [PATCH 021/185] fix: fix typo in setup.py (#32) --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9828c6e..3981017 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,8 @@ dependencies = [ "google-api-core[grpc] >= 1.22.2, < 2.0.0dev", "proto-plus >= 1.18.1", - "packaging >= 14.3" "grpc-google-iam-v1", + "packaging >= 14.3", + "grpc-google-iam-v1", "six", ] From 9c61f652684656cef59a4c6b2db096fdae145381 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 16 Jun 2021 15:14:02 +0000 Subject: [PATCH 022/185] chore: release 1.0.2 (#33) :robot: I have created a release \*beep\* \*boop\* --- ### [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7aef2f..8cc98be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 3981017..4e7e8c0 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.0.1" +version = "1.0.2" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From dd868c09e34476c83d3ed53813295e3d197e12cc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 17 Jun 2021 10:54:06 +0000 Subject: [PATCH 023/185] chore: new owl bot post processor docker image (#34) Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:58c7342b0bccf85028100adaa3d856cb4a871c22ca9c01960d996e66c40548ce --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index da616c9..ea06d39 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:c66ba3c8d7bc8566f47df841f98cd0097b28fff0b1864c86f5817f4c8c3e8600 + digest: sha256:58c7342b0bccf85028100adaa3d856cb4a871c22ca9c01960d996e66c40548ce diff --git a/docs/conf.py b/docs/conf.py index 9b1d9d1..1f47be1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -80,9 +80,9 @@ master_doc = "index" # General information about the project. -project = u"google-cloud-appengine-admin" -copyright = u"2019, Google" -author = u"Google APIs" +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 @@ -281,7 +281,7 @@ ( master_doc, "google-cloud-appengine-admin.tex", - u"google-cloud-appengine-admin Documentation", + "google-cloud-appengine-admin Documentation", author, "manual", ) @@ -316,7 +316,7 @@ ( master_doc, "google-cloud-appengine-admin", - u"google-cloud-appengine-admin Documentation", + "google-cloud-appengine-admin Documentation", [author], 1, ) @@ -335,7 +335,7 @@ ( master_doc, "google-cloud-appengine-admin", - u"google-cloud-appengine-admin Documentation", + "google-cloud-appengine-admin Documentation", author, "google-cloud-appengine-admin", "google-cloud-appengine-admin Library", From 34b578c920e8fba4cca1eb0532d357552056d12f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 19 Jun 2021 01:38:26 +0000 Subject: [PATCH 024/185] docs: omit mention of Python 2.7 in 'CONTRIBUTING.rst' (#1127) (#35) Closes #1126 Source-Link: https://github.com/googleapis/synthtool/commit/b91f129527853d5b756146a0b5044481fb4e09a8 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:b6169fc6a5207b11800a7c002d0c5c2bc6d82697185ca12e666f44031468cfcd --- .github/.OwlBot.lock.yaml | 2 +- CONTRIBUTING.rst | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ea06d39..cc49c6a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:58c7342b0bccf85028100adaa3d856cb4a871c22ca9c01960d996e66c40548ce + digest: sha256:b6169fc6a5207b11800a7c002d0c5c2bc6d82697185ca12e666f44031468cfcd diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 9aec34d..beb725f 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -69,7 +69,6 @@ We use `nox `__ to instrument our tests. - To test your changes, run unit tests with ``nox``:: - $ nox -s unit-2.7 $ nox -s unit-3.8 $ ... @@ -144,7 +143,6 @@ Running System Tests # Run all system tests $ nox -s system-3.8 - $ nox -s system-2.7 # Run a single system test $ nox -s system-3.8 -- -k @@ -152,9 +150,8 @@ Running System Tests .. note:: - System tests are only configured to run under Python 2.7 and - Python 3.8. For expediency, we do not run them in older versions - of Python 3. + 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 From e745f57f097aa8830cce063b10cf87af0d060ef7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 20 Jun 2021 01:06:19 +0000 Subject: [PATCH 025/185] chore: update precommit hook pre-commit/pre-commit-hooks to v4 (#1083) (#37) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [pre-commit/pre-commit-hooks](https://togithub.com/pre-commit/pre-commit-hooks) | repository | major | `v3.4.0` -> `v4.0.1` | --- ### Release Notes
pre-commit/pre-commit-hooks ### [`v4.0.1`](https://togithub.com/pre-commit/pre-commit-hooks/releases/v4.0.1) [Compare Source](https://togithub.com/pre-commit/pre-commit-hooks/compare/v4.0.0...v4.0.1) ##### Fixes - `check-shebang-scripts-are-executable` fix entry point. - [#​602](https://togithub.com/pre-commit/pre-commit-hooks/issues/602) issue by [@​Person-93](https://togithub.com/Person-93). - [#​603](https://togithub.com/pre-commit/pre-commit-hooks/issues/603) PR by [@​scop](https://togithub.com/scop). ### [`v4.0.0`](https://togithub.com/pre-commit/pre-commit-hooks/releases/v4.0.0) [Compare Source](https://togithub.com/pre-commit/pre-commit-hooks/compare/v3.4.0...v4.0.0) ##### Features - `check-json`: report duplicate keys. - [#​558](https://togithub.com/pre-commit/pre-commit-hooks/issues/558) PR by [@​AdityaKhursale](https://togithub.com/AdityaKhursale). - [#​554](https://togithub.com/pre-commit/pre-commit-hooks/issues/554) issue by [@​adamchainz](https://togithub.com/adamchainz). - `no-commit-to-branch`: add `main` to default blocked branches. - [#​565](https://togithub.com/pre-commit/pre-commit-hooks/issues/565) PR by [@​ndevenish](https://togithub.com/ndevenish). - `check-case-conflict`: check conflicts in directory names as well. - [#​575](https://togithub.com/pre-commit/pre-commit-hooks/issues/575) PR by [@​slsyy](https://togithub.com/slsyy). - [#​70](https://togithub.com/pre-commit/pre-commit-hooks/issues/70) issue by [@​andyjack](https://togithub.com/andyjack). - `check-vcs-permalinks`: forbid other branch names. - [#​582](https://togithub.com/pre-commit/pre-commit-hooks/issues/582) PR by [@​jack1142](https://togithub.com/jack1142). - [#​581](https://togithub.com/pre-commit/pre-commit-hooks/issues/581) issue by [@​jack1142](https://togithub.com/jack1142). - `check-shebang-scripts-are-executable`: new hook which ensures shebang'd scripts are executable. - [#​545](https://togithub.com/pre-commit/pre-commit-hooks/issues/545) PR by [@​scop](https://togithub.com/scop). ##### Fixes - `check-executables-have-shebangs`: Short circuit shebang lookup on windows. - [#​544](https://togithub.com/pre-commit/pre-commit-hooks/issues/544) PR by [@​scop](https://togithub.com/scop). - `requirements-txt-fixer`: Fix comments which have indentation - [#​549](https://togithub.com/pre-commit/pre-commit-hooks/issues/549) PR by [@​greshilov](https://togithub.com/greshilov). - [#​548](https://togithub.com/pre-commit/pre-commit-hooks/issues/548) issue by [@​greshilov](https://togithub.com/greshilov). - `pretty-format-json`: write to stdout using UTF-8 encoding. - [#​571](https://togithub.com/pre-commit/pre-commit-hooks/issues/571) PR by [@​jack1142](https://togithub.com/jack1142). - [#​570](https://togithub.com/pre-commit/pre-commit-hooks/issues/570) issue by [@​jack1142](https://togithub.com/jack1142). - Use more inclusive language. - [#​599](https://togithub.com/pre-commit/pre-commit-hooks/issues/599) PR by [@​asottile](https://togithub.com/asottile). ##### Breaking changes - Remove deprecated hooks: `flake8`, `pyflakes`, `autopep8-wrapper`. - [#​597](https://togithub.com/pre-commit/pre-commit-hooks/issues/597) PR by [@​asottile](https://togithub.com/asottile).
--- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/synthtool). Source-Link: https://github.com/googleapis/synthtool/commit/333fd90856f1454380514bc59fc0936cdaf1c202 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:b8c131c558606d3cea6e18f8e87befbd448c1482319b0db3c5d5388fa6ea72e3 --- .github/.OwlBot.lock.yaml | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index cc49c6a..9602d54 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:b6169fc6a5207b11800a7c002d0c5c2bc6d82697185ca12e666f44031468cfcd + digest: sha256:b8c131c558606d3cea6e18f8e87befbd448c1482319b0db3c5d5388fa6ea72e3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f00c7c..62eb5a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.0.1 hooks: - id: trailing-whitespace - id: end-of-file-fixer From 099604e792fdabe175dbc9b3b33cb987d510b173 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 22 Jun 2021 18:30:42 +0000 Subject: [PATCH 026/185] chore: add kokoro 3.9 config templates (#1128) (#39) Source-Link: https://github.com/googleapis/synthtool/commit/b0eb8a8b30b46a3c98d23c23107acb748c6601a1 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:df50e8d462f86d6bcb42f27ecad55bb12c404f1c65de9c6fe4c4d25120080bd6 --- .github/.OwlBot.lock.yaml | 2 +- .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 ++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .kokoro/samples/python3.9/common.cfg create mode 100644 .kokoro/samples/python3.9/continuous.cfg create mode 100644 .kokoro/samples/python3.9/periodic-head.cfg create mode 100644 .kokoro/samples/python3.9/periodic.cfg create mode 100644 .kokoro/samples/python3.9/presubmit.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9602d54..0954585 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:b8c131c558606d3cea6e18f8e87befbd448c1482319b0db3c5d5388fa6ea72e3 + digest: sha256:df50e8d462f86d6bcb42f27ecad55bb12c404f1c65de9c6fe4c4d25120080bd6 diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg new file mode 100644 index 0000000..7ab162a --- /dev/null +++ b/.kokoro/samples/python3.9/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.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.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.9/continuous.cfg b/.kokoro/samples/python3.9/continuous.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.9/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.9/periodic-head.cfg b/.kokoro/samples/python3.9/periodic-head.cfg new file mode 100644 index 0000000..f9cfcd3 --- /dev/null +++ b/.kokoro/samples/python3.9/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg new file mode 100644 index 0000000..50fec96 --- /dev/null +++ b/.kokoro/samples/python3.9/periodic.cfg @@ -0,0 +1,6 @@ +# 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/python3.9/presubmit.cfg b/.kokoro/samples/python3.9/presubmit.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.9/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 From f260f90985b5f05f11258b86af1b1ead652a882d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 23 Jun 2021 20:50:33 +0000 Subject: [PATCH 027/185] feat: add always_use_jwt_access (#40) ... chore: update gapic-generator-ruby to the latest commit chore: release gapic-generator-typescript 1.5.0 Committer: @miraleung PiperOrigin-RevId: 380641501 Source-Link: https://github.com/googleapis/googleapis/commit/076f7e9f0b258bdb54338895d7251b202e8f0de3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/27e4c88b4048e5f56508d4e1aa417d60a3380892 --- .coveragerc | 1 - .../services/applications/transports/base.py | 40 +++---- .../services/applications/transports/grpc.py | 7 +- .../applications/transports/grpc_asyncio.py | 7 +- .../transports/base.py | 40 +++---- .../transports/grpc.py | 7 +- .../transports/grpc_asyncio.py | 7 +- .../authorized_domains/transports/base.py | 40 +++---- .../authorized_domains/transports/grpc.py | 7 +- .../transports/grpc_asyncio.py | 7 +- .../domain_mappings/transports/base.py | 40 +++---- .../domain_mappings/transports/grpc.py | 7 +- .../transports/grpc_asyncio.py | 7 +- .../services/firewall/transports/base.py | 40 +++---- .../services/firewall/transports/grpc.py | 7 +- .../firewall/transports/grpc_asyncio.py | 7 +- .../services/instances/transports/base.py | 40 +++---- .../services/instances/transports/grpc.py | 7 +- .../instances/transports/grpc_asyncio.py | 7 +- .../services/services/transports/base.py | 40 +++---- .../services/services/transports/grpc.py | 7 +- .../services/transports/grpc_asyncio.py | 7 +- .../services/versions/transports/base.py | 40 +++---- .../services/versions/transports/grpc.py | 7 +- .../versions/transports/grpc_asyncio.py | 7 +- setup.py | 2 +- testing/constraints-3.6.txt | 2 +- .../appengine_admin_v1/test_applications.py | 106 +++-------------- .../test_authorized_certificates.py | 108 +++--------------- .../test_authorized_domains.py | 108 +++--------------- .../test_domain_mappings.py | 108 +++--------------- .../gapic/appengine_admin_v1/test_firewall.py | 102 +++-------------- .../appengine_admin_v1/test_instances.py | 102 +++-------------- .../gapic/appengine_admin_v1/test_services.py | 102 +++-------------- .../gapic/appengine_admin_v1/test_versions.py | 102 +++-------------- 35 files changed, 288 insertions(+), 987 deletions(-) diff --git a/.coveragerc b/.coveragerc index 31bb6cb..44c6382 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,7 +2,6 @@ branch = True [report] -fail_under = 100 show_missing = True omit = google/cloud/appengine_admin/__init__.py 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 d3873c0..6222917 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -25,6 +25,7 @@ from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # 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 application @@ -48,8 +49,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class ApplicationsTransport(abc.ABC): """Abstract transport class for Applications.""" @@ -71,6 +70,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -94,6 +94,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -122,13 +124,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -149,27 +158,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 779505d..5b3b1a7 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -153,6 +153,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -208,14 +209,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 ac93ffb..895b4c6 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 @@ -81,14 +81,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -199,6 +199,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: 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 0f5102f..4b9b44e 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,6 +24,7 @@ from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # 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 @@ -47,8 +48,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class AuthorizedCertificatesTransport(abc.ABC): """Abstract transport class for AuthorizedCertificates.""" @@ -70,6 +69,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -93,6 +93,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -121,13 +123,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -148,27 +157,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 4126964..b1a4179 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 @@ -153,6 +153,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -208,14 +209,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 2646f05..3930241 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 @@ -82,14 +82,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -199,6 +199,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: 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 7af2081..f16e0c1 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 @@ -24,6 +24,7 @@ from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # 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 @@ -45,8 +46,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class AuthorizedDomainsTransport(abc.ABC): """Abstract transport class for AuthorizedDomains.""" @@ -68,6 +67,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -91,6 +91,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -119,13 +121,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -146,27 +155,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 e946757..a225b77 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 @@ -151,6 +151,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -206,14 +207,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 25da719..dae78ed 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 @@ -80,14 +80,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -197,6 +197,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: 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 6e10987..43f5bcc 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 @@ -25,6 +25,7 @@ from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # 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 domain_mapping @@ -48,8 +49,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class DomainMappingsTransport(abc.ABC): """Abstract transport class for DomainMappings.""" @@ -71,6 +70,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -94,6 +94,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -122,13 +124,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -149,27 +158,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 2bfa1a8..b964d47 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 @@ -153,6 +153,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -208,14 +209,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 b4ed8d3..17de4f7 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 @@ -81,14 +81,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -199,6 +199,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: 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 c34954b..82afe37 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -24,6 +24,7 @@ from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # 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 @@ -47,8 +48,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class FirewallTransport(abc.ABC): """Abstract transport class for Firewall.""" @@ -70,6 +69,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -93,6 +93,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -121,13 +123,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -148,27 +157,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 0800f20..b467cd2 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -161,6 +161,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -216,14 +217,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 854586a..f4ae62e 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 @@ -90,14 +90,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -207,6 +207,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: 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 9fbb973..39b64b2 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -25,6 +25,7 @@ from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # 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 instance @@ -48,8 +49,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class InstancesTransport(abc.ABC): """Abstract transport class for Instances.""" @@ -71,6 +70,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -94,6 +94,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -122,13 +124,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -149,27 +158,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 826c415..7e6cf85 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -153,6 +153,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -208,14 +209,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 5c50a41..d50023a 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 @@ -81,14 +81,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -199,6 +199,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: 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 d38384c..8be6524 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -25,6 +25,7 @@ from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # 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 service @@ -48,8 +49,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class ServicesTransport(abc.ABC): """Abstract transport class for Services.""" @@ -71,6 +70,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -94,6 +94,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -122,13 +124,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -149,27 +158,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 d31349a..93257a0 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -153,6 +153,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -208,14 +209,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 2f107bb..0655b37 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 @@ -81,14 +81,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -199,6 +199,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: 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 d1f014e..bf1f9bd 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -25,6 +25,7 @@ from google.api_core import retry as retries # type: ignore from google.api_core import operations_v1 # 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 version @@ -48,8 +49,6 @@ except pkg_resources.DistributionNotFound: # pragma: NO COVER _GOOGLE_AUTH_VERSION = None -_API_CORE_VERSION = google.api_core.__version__ - class VersionsTransport(abc.ABC): """Abstract transport class for Versions.""" @@ -71,6 +70,7 @@ def __init__( 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, **kwargs, ) -> None: """Instantiate the transport. @@ -94,6 +94,8 @@ def __init__( 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -122,13 +124,20 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is 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 - # TODO(busunkim): These two class methods are in the base transport + # TODO(busunkim): This method is in the base transport # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-api-core - # and google-auth are increased. + # should be deleted once the minimum required versions of google-auth is increased. # TODO: Remove this function once google-auth >= 1.25.0 is required @classmethod @@ -149,27 +158,6 @@ def _get_scopes_kwargs( return scopes_kwargs - # TODO: Remove this function once google-api-core >= 1.26.0 is required - @classmethod - def _get_self_signed_jwt_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Union[Optional[Sequence[str]], str]]: - """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version""" - - self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {} - - if _API_CORE_VERSION and ( - packaging.version.parse(_API_CORE_VERSION) - >= packaging.version.parse("1.26.0") - ): - self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES - self_signed_jwt_kwargs["scopes"] = scopes - self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST - else: - self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES - - return self_signed_jwt_kwargs - 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 36bfeee..d6a36ed 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -153,6 +153,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: @@ -208,14 +209,14 @@ def create_channel( and ``credentials_file`` are passed. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **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 20c53e8..2d47cdd 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 @@ -81,14 +81,14 @@ def create_channel( aio.Channel: A gRPC AsyncIO channel object. """ - self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes) - return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, - **self_signed_jwt_kwargs, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, **kwargs, ) @@ -199,6 +199,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, + always_use_jwt_access=True, ) if not self._grpc_channel: diff --git a/setup.py b/setup.py index 4e7e8c0..3b5b286 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" dependencies = [ - "google-api-core[grpc] >= 1.22.2, < 2.0.0dev", + "google-api-core[grpc] >= 1.26.0, <2.0.0dev", "proto-plus >= 1.18.1", "packaging >= 14.3", "grpc-google-iam-v1", diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index e5c3a86..b86813c 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.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.22.2 +google-api-core==1.26.0 proto-plus==1.18.1 grpc-google-iam-v1==0.12.3 six==1.13.0 diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index c168ab6..0d235c5 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -39,9 +39,6 @@ ) 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.services.applications.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.applications.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -55,8 +52,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -67,16 +65,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -134,6 +122,16 @@ def test_applications_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) +def test_applications_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) def test_applications_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -1269,7 +1267,6 @@ def test_applications_transport_auth_adc_old_google_auth(transport_class): (transports.ApplicationsGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 def test_applications_transport_create_channel(transport_class, grpc_helpers): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1302,83 +1299,6 @@ def test_applications_transport_create_channel(transport_class, grpc_helpers): ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.ApplicationsGrpcTransport, grpc_helpers), - (transports.ApplicationsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_applications_transport_create_channel_old_api_core( - 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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.ApplicationsGrpcTransport, grpc_helpers), - (transports.ApplicationsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_applications_transport_create_channel_user_scopes( - 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", - scopes=["1", "2"], - 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], 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 590e406..f95f82f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -39,9 +39,6 @@ ) 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.services.authorized_certificates.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.authorized_certificates.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -53,8 +50,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -65,16 +63,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -138,6 +126,18 @@ def test_authorized_certificates_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize( + "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] +) +def test_authorized_certificates_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize( "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] ) @@ -1745,7 +1745,6 @@ def test_authorized_certificates_transport_auth_adc_old_google_auth(transport_cl (transports.AuthorizedCertificatesGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 def test_authorized_certificates_transport_create_channel( transport_class, grpc_helpers ): @@ -1780,83 +1779,6 @@ def test_authorized_certificates_transport_create_channel( ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.AuthorizedCertificatesGrpcTransport, grpc_helpers), - (transports.AuthorizedCertificatesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_authorized_certificates_transport_create_channel_old_api_core( - 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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.AuthorizedCertificatesGrpcTransport, grpc_helpers), - (transports.AuthorizedCertificatesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_authorized_certificates_transport_create_channel_user_scopes( - 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", - scopes=["1", "2"], - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - @pytest.mark.parametrize( "transport_class", [ 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 65e843f..16932ba 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -39,9 +39,6 @@ ) 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.services.authorized_domains.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.authorized_domains.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -51,8 +48,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -63,16 +61,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -136,6 +124,18 @@ def test_authorized_domains_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize( + "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] +) +def test_authorized_domains_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize( "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] ) @@ -1036,7 +1036,6 @@ def test_authorized_domains_transport_auth_adc_old_google_auth(transport_class): (transports.AuthorizedDomainsGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 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. @@ -1069,83 +1068,6 @@ def test_authorized_domains_transport_create_channel(transport_class, grpc_helpe ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.AuthorizedDomainsGrpcTransport, grpc_helpers), - (transports.AuthorizedDomainsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_authorized_domains_transport_create_channel_old_api_core( - 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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.AuthorizedDomainsGrpcTransport, grpc_helpers), - (transports.AuthorizedDomainsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_authorized_domains_transport_create_channel_user_scopes( - 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", - scopes=["1", "2"], - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - @pytest.mark.parametrize( "transport_class", [ 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 05d9d6b..63f7b1f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -42,9 +42,6 @@ ) 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.services.domain_mappings.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.domain_mappings.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -57,8 +54,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -69,16 +67,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -141,6 +129,18 @@ def test_domain_mappings_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize( + "client_class", [DomainMappingsClient, DomainMappingsAsyncClient,] +) +def test_domain_mappings_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize( "client_class", [DomainMappingsClient, DomainMappingsAsyncClient,] ) @@ -1636,7 +1636,6 @@ def test_domain_mappings_transport_auth_adc_old_google_auth(transport_class): (transports.DomainMappingsGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 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. @@ -1669,83 +1668,6 @@ def test_domain_mappings_transport_create_channel(transport_class, grpc_helpers) ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.DomainMappingsGrpcTransport, grpc_helpers), - (transports.DomainMappingsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_domain_mappings_transport_create_channel_old_api_core( - 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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.DomainMappingsGrpcTransport, grpc_helpers), - (transports.DomainMappingsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_domain_mappings_transport_create_channel_user_scopes( - 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", - scopes=["1", "2"], - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - @pytest.mark.parametrize( "transport_class", [ diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 303a69a..3fc866f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -35,9 +35,6 @@ 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.services.firewall.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.firewall.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -48,8 +45,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -60,16 +58,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -125,6 +113,16 @@ def test_firewall_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) +def test_firewall_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) def test_firewall_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -1732,7 +1730,6 @@ def test_firewall_transport_auth_adc_old_google_auth(transport_class): (transports.FirewallGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 def test_firewall_transport_create_channel(transport_class, grpc_helpers): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1765,79 +1762,6 @@ def test_firewall_transport_create_channel(transport_class, grpc_helpers): ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.FirewallGrpcTransport, grpc_helpers), - (transports.FirewallGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_firewall_transport_create_channel_old_api_core(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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.FirewallGrpcTransport, grpc_helpers), - (transports.FirewallGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_firewall_transport_create_channel_user_scopes(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", - scopes=["1", "2"], - 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], diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 3d5d5a9..b2b3f96 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -38,9 +38,6 @@ 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.services.instances.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.instances.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -53,8 +50,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -65,16 +63,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -130,6 +118,16 @@ def test_instances_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) +def test_instances_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) def test_instances_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -1439,7 +1437,6 @@ def test_instances_transport_auth_adc_old_google_auth(transport_class): (transports.InstancesGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 def test_instances_transport_create_channel(transport_class, grpc_helpers): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1472,79 +1469,6 @@ def test_instances_transport_create_channel(transport_class, grpc_helpers): ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.InstancesGrpcTransport, grpc_helpers), - (transports.InstancesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_instances_transport_create_channel_old_api_core(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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.InstancesGrpcTransport, grpc_helpers), - (transports.InstancesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_instances_transport_create_channel_user_scopes(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", - scopes=["1", "2"], - 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], diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 88ad621..84a14c0 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -38,9 +38,6 @@ 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.services.services.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.services.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -54,8 +51,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -66,16 +64,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -131,6 +119,16 @@ def test_services_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) +def test_services_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) def test_services_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -1348,7 +1346,6 @@ def test_services_transport_auth_adc_old_google_auth(transport_class): (transports.ServicesGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 def test_services_transport_create_channel(transport_class, grpc_helpers): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1381,79 +1378,6 @@ def test_services_transport_create_channel(transport_class, grpc_helpers): ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.ServicesGrpcTransport, grpc_helpers), - (transports.ServicesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_services_transport_create_channel_old_api_core(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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.ServicesGrpcTransport, grpc_helpers), - (transports.ServicesGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_services_transport_create_channel_user_scopes(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", - scopes=["1", "2"], - 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], diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 6110074..cbdcba5 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -38,9 +38,6 @@ 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.services.versions.transports.base import ( - _API_CORE_VERSION, -) from google.cloud.appengine_admin_v1.services.versions.transports.base import ( _GOOGLE_AUTH_VERSION, ) @@ -57,8 +54,9 @@ import google.auth -# TODO(busunkim): Once google-api-core >= 1.26.0 is required: -# - Delete all the api-core and auth "less than" test cases +# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively +# through google-api-core: +# - Delete the auth "less than" test cases # - Delete these pytest markers (Make the "greater than or equal to" tests the default). requires_google_auth_lt_1_25_0 = pytest.mark.skipif( packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), @@ -69,16 +67,6 @@ reason="This test requires google-auth >= 1.25.0", ) -requires_api_core_lt_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"), - reason="This test requires google-api-core < 1.26.0", -) - -requires_api_core_gte_1_26_0 = pytest.mark.skipif( - packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"), - reason="This test requires google-api-core >= 1.26.0", -) - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -134,6 +122,16 @@ def test_versions_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" +@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) +def test_versions_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) def test_versions_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -1559,7 +1557,6 @@ def test_versions_transport_auth_adc_old_google_auth(transport_class): (transports.VersionsGrpcAsyncIOTransport, grpc_helpers_async), ], ) -@requires_api_core_gte_1_26_0 def test_versions_transport_create_channel(transport_class, grpc_helpers): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1592,79 +1589,6 @@ def test_versions_transport_create_channel(transport_class, grpc_helpers): ) -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.VersionsGrpcTransport, grpc_helpers), - (transports.VersionsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_versions_transport_create_channel_old_api_core(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") - - create_channel.assert_called_with( - "appengine.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - scopes=( - "https://www.googleapis.com/auth/appengine.admin", - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-platform.read-only", - ), - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.VersionsGrpcTransport, grpc_helpers), - (transports.VersionsGrpcAsyncIOTransport, grpc_helpers_async), - ], -) -@requires_api_core_lt_1_26_0 -def test_versions_transport_create_channel_user_scopes(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", - scopes=["1", "2"], - 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], From 9b34909642258b26f96f0560b4c1b87b160738f4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 24 Jun 2021 14:48:25 +0000 Subject: [PATCH 028/185] chore: release 1.1.0 (#41) :robot: I have created a release \*beep\* \*boop\* --- ## [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) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cc98be..f0e9514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [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) diff --git a/setup.py b/setup.py index 3b5b286..81a8c3a 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.0.2" +version = "1.1.0" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From e1322752503c82dfc32bc25d218c10519b5361ae Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 25 Jun 2021 22:50:11 +0000 Subject: [PATCH 029/185] chore(python): simplify nox steps in CONTRIBUTING.rst (#42) Source-Link: https://github.com/googleapis/synthtool/commit/26558bae8976a985d73c2d98c31d8612273f907d Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719 --- .github/.OwlBot.lock.yaml | 2 +- CONTRIBUTING.rst | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0954585..e2b39f9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:df50e8d462f86d6bcb42f27ecad55bb12c404f1c65de9c6fe4c4d25120080bd6 + digest: sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index beb725f..c9afd32 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -68,14 +68,12 @@ Using ``nox`` We use `nox `__ to instrument our tests. - To test your changes, run unit tests with ``nox``:: + $ nox -s unit - $ nox -s unit-3.8 - $ ... +- To run a single unit test:: -- Args to pytest can be passed through the nox command separated by a `--`. For - example, to run a single test:: + $ nox -s unit-3.9 -- -k - $ nox -s unit-3.8 -- -k .. note:: @@ -142,7 +140,7 @@ Running System Tests - To run system tests, you can execute:: # Run all system tests - $ nox -s system-3.8 + $ nox -s system # Run a single system test $ nox -s system-3.8 -- -k @@ -215,8 +213,8 @@ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/python-appengine-admin/blob/master/noxfile.py -We also explicitly decided to support Python 3 beginning with version -3.6. Reasons for this include: +We also explicitly decided to support Python 3 beginning with version 3.6. +Reasons for this include: - Encouraging use of newest versions of Python 3 - Taking the lead of `prominent`_ open-source `projects`_ From d8d2f5f9e6c986387fd0d811e4be06a68a83aa8e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Jun 2021 01:16:11 +0000 Subject: [PATCH 030/185] fix: disable always_use_jwt_access (#44) fix: disable always_use_jwt_access Committer: @busunkim96 PiperOrigin-RevId: 382142900 Source-Link: https://github.com/googleapis/googleapis/commit/513440fda515f3c799c22a30e3906dcda325004e Source-Link: https://github.com/googleapis/googleapis-gen/commit/7b1e2c31233f79a704ec21ca410bf661d6bc68d0 --- .../services/applications/transports/base.py | 2 +- .../services/applications/transports/grpc.py | 5 ++- .../applications/transports/grpc_asyncio.py | 5 ++- .../transports/base.py | 2 +- .../transports/grpc.py | 5 ++- .../transports/grpc_asyncio.py | 5 ++- .../authorized_domains/transports/base.py | 2 +- .../authorized_domains/transports/grpc.py | 5 ++- .../transports/grpc_asyncio.py | 5 ++- .../domain_mappings/transports/base.py | 2 +- .../domain_mappings/transports/grpc.py | 5 ++- .../transports/grpc_asyncio.py | 5 ++- .../services/firewall/transports/base.py | 2 +- .../services/firewall/transports/grpc.py | 5 ++- .../firewall/transports/grpc_asyncio.py | 5 ++- .../services/instances/transports/base.py | 2 +- .../services/instances/transports/grpc.py | 5 ++- .../instances/transports/grpc_asyncio.py | 5 ++- .../services/services/transports/base.py | 2 +- .../services/services/transports/grpc.py | 5 ++- .../services/transports/grpc_asyncio.py | 5 ++- .../services/versions/transports/base.py | 2 +- .../services/versions/transports/grpc.py | 5 ++- .../versions/transports/grpc_asyncio.py | 5 ++- .../appengine_admin_v1/test_applications.py | 38 +++++++++++-------- .../test_authorized_certificates.py | 38 +++++++++++-------- .../test_authorized_domains.py | 38 +++++++++++-------- .../test_domain_mappings.py | 38 +++++++++++-------- .../gapic/appengine_admin_v1/test_firewall.py | 38 +++++++++++-------- .../appengine_admin_v1/test_instances.py | 38 +++++++++++-------- .../gapic/appengine_admin_v1/test_services.py | 38 +++++++++++-------- .../gapic/appengine_admin_v1/test_versions.py | 38 +++++++++++-------- 32 files changed, 248 insertions(+), 152 deletions(-) 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 6222917..a0de499 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -105,7 +105,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 5b3b1a7..bc81f85 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -60,6 +60,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -100,6 +101,8 @@ def __init__( 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 @@ -153,7 +156,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 895b4c6..d9264e4 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -147,6 +148,8 @@ def __init__( 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 @@ -199,7 +202,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: 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 4b9b44e..5a1d2f9 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 @@ -104,7 +104,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 b1a4179..a7f20ab 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 @@ -61,6 +61,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -101,6 +102,8 @@ def __init__( 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 @@ -153,7 +156,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 3930241..8ab6414 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -148,6 +149,8 @@ def __init__( 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 @@ -199,7 +202,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: 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 f16e0c1..cb57d63 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 @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 a225b77..82d51bb 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 @@ -59,6 +59,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -99,6 +100,8 @@ def __init__( 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 @@ -151,7 +154,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 dae78ed..1848cae 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -146,6 +147,8 @@ def __init__( 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 @@ -197,7 +200,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: 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 43f5bcc..7d971f7 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 @@ -105,7 +105,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 b964d47..e7ee590 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 @@ -60,6 +60,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -100,6 +101,8 @@ def __init__( 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 @@ -153,7 +156,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 17de4f7..df14efb 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -147,6 +148,8 @@ def __init__( 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 @@ -199,7 +202,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: 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 82afe37..8f2f465 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -104,7 +104,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 b467cd2..a20b25c 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -69,6 +69,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -109,6 +110,8 @@ def __init__( 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 @@ -161,7 +164,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 f4ae62e..b250cfd 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -156,6 +157,8 @@ def __init__( 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 @@ -207,7 +210,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: 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 39b64b2..ab81cf2 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -105,7 +105,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 7e6cf85..905f187 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -60,6 +60,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -100,6 +101,8 @@ def __init__( 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 @@ -153,7 +156,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 d50023a..a8f7b05 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -147,6 +148,8 @@ def __init__( 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 @@ -199,7 +202,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: 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 8be6524..4f5d40e 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -105,7 +105,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 93257a0..4aed507 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -60,6 +60,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -100,6 +101,8 @@ def __init__( 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 @@ -153,7 +156,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 0655b37..339511c 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -147,6 +148,8 @@ def __init__( 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 @@ -199,7 +202,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: 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 bf1f9bd..085cfd3 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -105,7 +105,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. 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 d6a36ed..fc8ee54 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -60,6 +60,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -100,6 +101,8 @@ def __init__( 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 @@ -153,7 +156,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) 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 2d47cdd..b8fdefb 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__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -147,6 +148,8 @@ def __init__( 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 @@ -199,7 +202,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 0d235c5..1cc3f9f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -129,7 +129,25 @@ def test_applications_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.ApplicationsGrpcTransport, "grpc"), + (transports.ApplicationsGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_applications_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) @@ -1318,11 +1336,7 @@ def test_applications_grpc_transport_client_cert_source_for_mtls(transport_class "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1426,11 +1440,7 @@ def test_applications_transport_channel_mtls_with_client_cert_source(transport_c "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1474,11 +1484,7 @@ def test_applications_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ 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 f95f82f..567a1f3 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -135,7 +135,25 @@ def test_authorized_certificates_client_service_account_always_use_jwt(client_cl ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.AuthorizedCertificatesGrpcTransport, "grpc"), + (transports.AuthorizedCertificatesGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_authorized_certificates_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize( @@ -1803,11 +1821,7 @@ def test_authorized_certificates_grpc_transport_client_cert_source_for_mtls( "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1916,11 +1930,7 @@ def test_authorized_certificates_transport_channel_mtls_with_client_cert_source( "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1967,11 +1977,7 @@ def test_authorized_certificates_transport_channel_mtls_with_adc(transport_class "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ 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 16932ba..037bfdd 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -133,7 +133,25 @@ def test_authorized_domains_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.AuthorizedDomainsGrpcTransport, "grpc"), + (transports.AuthorizedDomainsGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_authorized_domains_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize( @@ -1090,11 +1108,7 @@ def test_authorized_domains_grpc_transport_client_cert_source_for_mtls(transport "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1203,11 +1217,7 @@ def test_authorized_domains_transport_channel_mtls_with_client_cert_source( "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1254,11 +1264,7 @@ def test_authorized_domains_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ 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 63f7b1f..2f765dc 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -138,7 +138,25 @@ def test_domain_mappings_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.DomainMappingsGrpcTransport, "grpc"), + (transports.DomainMappingsGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_domain_mappings_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize( @@ -1690,11 +1708,7 @@ def test_domain_mappings_grpc_transport_client_cert_source_for_mtls(transport_cl "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1803,11 +1817,7 @@ def test_domain_mappings_transport_channel_mtls_with_client_cert_source( "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1854,11 +1864,7 @@ def test_domain_mappings_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 3fc866f..100973b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -120,7 +120,25 @@ def test_firewall_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.FirewallGrpcTransport, "grpc"), + (transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_firewall_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) @@ -1781,11 +1799,7 @@ def test_firewall_grpc_transport_client_cert_source_for_mtls(transport_class): "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1889,11 +1903,7 @@ def test_firewall_transport_channel_mtls_with_client_cert_source(transport_class "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1937,11 +1947,7 @@ def test_firewall_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index b2b3f96..5958553 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -125,7 +125,25 @@ def test_instances_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.InstancesGrpcTransport, "grpc"), + (transports.InstancesGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_instances_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) @@ -1488,11 +1506,7 @@ def test_instances_grpc_transport_client_cert_source_for_mtls(transport_class): "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1596,11 +1610,7 @@ def test_instances_transport_channel_mtls_with_client_cert_source(transport_clas "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1644,11 +1654,7 @@ def test_instances_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 84a14c0..855a9ba 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -126,7 +126,25 @@ def test_services_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.ServicesGrpcTransport, "grpc"), + (transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_services_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) @@ -1397,11 +1415,7 @@ def test_services_grpc_transport_client_cert_source_for_mtls(transport_class): "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1505,11 +1519,7 @@ def test_services_transport_channel_mtls_with_client_cert_source(transport_class "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1553,11 +1563,7 @@ def test_services_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index cbdcba5..00afb55 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -129,7 +129,25 @@ def test_versions_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.VersionsGrpcTransport, "grpc"), + (transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_versions_client_service_account_always_use_jwt_true( + 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) @pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) @@ -1608,11 +1626,7 @@ def test_versions_grpc_transport_client_cert_source_for_mtls(transport_class): "squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -1716,11 +1730,7 @@ def test_versions_transport_channel_mtls_with_client_cert_source(transport_class "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -1764,11 +1774,7 @@ def test_versions_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - 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, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ From 1ee130cfd8136bf3ac04bb30d221925f82d505d8 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 18:48:07 +0000 Subject: [PATCH 031/185] chore: release 1.1.1 (#45) :robot: I have created a release \*beep\* \*boop\* --- ### [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0e9514..052cdac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 81a8c3a..80ac999 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.1.0" +version = "1.1.1" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 4b6190a1f4e243ee913e4348bd99249fc398f848 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 14 Jul 2021 12:15:10 -0400 Subject: [PATCH 032/185] build(python): exit with success status if no samples found (#46) Source-Link: https://github.com/googleapis/synthtool/commit/53ea3896a52f87c758e79b5a19fa338c83925a98 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:e1793a23ae0ee9aafb2e3a53b564a351f74790dbe3c2d75f8fc3b8c43e5c036c Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/test-samples-impl.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index e2b39f9..a5d3697 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719 + digest: sha256:e1793a23ae0ee9aafb2e3a53b564a351f74790dbe3c2d75f8fc3b8c43e5c036c diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh index cf5de74..311a8d5 100755 --- a/.kokoro/test-samples-impl.sh +++ b/.kokoro/test-samples-impl.sh @@ -20,9 +20,9 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -# Exit early if samples directory doesn't exist -if [ ! -d "./samples" ]; then - echo "No tests run. `./samples` not found" +# Exit 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 From 081226459c1d9ccfcc412a2443b6288671264c94 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 14 Jul 2021 18:04:28 +0000 Subject: [PATCH 033/185] build(python): remove python 3.7 from kokoro Dockerfile (#47) Source-Link: https://github.com/googleapis/synthtool/commit/e44dc0c742b1230887a73552357e0c18dcc30b92 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:5ff7446edeaede81c3ed58b23a4e76a5403fba1350ce28478045657303b6479d --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/docker/docs/Dockerfile | 35 ++------------------- .kokoro/docker/docs/fetch_gpg_keys.sh | 45 --------------------------- 3 files changed, 3 insertions(+), 79 deletions(-) delete mode 100755 .kokoro/docker/docs/fetch_gpg_keys.sh diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index a5d3697..cb06536 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:e1793a23ae0ee9aafb2e3a53b564a351f74790dbe3c2d75f8fc3b8c43e5c036c + digest: sha256:5ff7446edeaede81c3ed58b23a4e76a5403fba1350ce28478045657303b6479d diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 412b0b5..4e1b1fb 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -40,6 +40,7 @@ RUN apt-get update \ libssl-dev \ libsqlite3-dev \ portaudio19-dev \ + python3-distutils \ redis-server \ software-properties-common \ ssh \ @@ -59,40 +60,8 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb - -COPY fetch_gpg_keys.sh /tmp -# Install the desired versions of Python. -RUN set -ex \ - && export GNUPGHOME="$(mktemp -d)" \ - && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ - && /tmp/fetch_gpg_keys.sh \ - && for PYTHON_VERSION in 3.7.8 3.8.5; do \ - wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ - && wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \ - && rm -r python-${PYTHON_VERSION}.tar.xz.asc \ - && mkdir -p /usr/src/python-${PYTHON_VERSION} \ - && tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \ - && rm python-${PYTHON_VERSION}.tar.xz \ - && cd /usr/src/python-${PYTHON_VERSION} \ - && ./configure \ - --enable-shared \ - # This works only on Python 2.7 and throws a warning on every other - # version, but seems otherwise harmless. - --enable-unicode=ucs4 \ - --with-system-ffi \ - --without-ensurepip \ - && make -j$(nproc) \ - && make install \ - && ldconfig \ - ; done \ - && rm -rf "${GNUPGHOME}" \ - && rm -rf /usr/src/python* \ - && rm -rf ~/.cache/ - RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.7 /tmp/get-pip.py \ && python3.8 /tmp/get-pip.py \ && rm /tmp/get-pip.py -CMD ["python3.7"] +CMD ["python3.8"] diff --git a/.kokoro/docker/docs/fetch_gpg_keys.sh b/.kokoro/docker/docs/fetch_gpg_keys.sh deleted file mode 100755 index d653dd8..0000000 --- a/.kokoro/docker/docs/fetch_gpg_keys.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# 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. - -# A script to fetch gpg keys with retry. -# Avoid jinja parsing the file. -# - -function retry { - if [[ "${#}" -le 1 ]]; then - echo "Usage: ${0} retry_count commands.." - exit 1 - fi - local retries=${1} - local command="${@:2}" - until [[ "${retries}" -le 0 ]]; do - $command && return 0 - if [[ $? -ne 0 ]]; then - echo "command failed, retrying" - ((retries--)) - fi - done - return 1 -} - -# 3.6.9, 3.7.5 (Ned Deily) -retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \ - 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D - -# 3.8.0 (Łukasz Langa) -retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \ - E3FF2839C048B25C084DEBE9B26995E310250568 - -# From c9fac071151957e69fd83cb9aefb027c6551a55c Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Wed, 21 Jul 2021 10:52:26 -0600 Subject: [PATCH 034/185] fix(deps): pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions (#48) Expand pins on library dependencies in preparation for these dependencies taking a new major version. See https://github.com/googleapis/google-cloud-python/issues/10566. --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 80ac999..ec074c3 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,10 @@ release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" dependencies = [ - "google-api-core[grpc] >= 1.26.0, <2.0.0dev", + # 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.26.0, <3.0.0dev", "proto-plus >= 1.18.1", "packaging >= 14.3", "grpc-google-iam-v1", From 941537a6856b51aae099f36f0d820ed8c0a5b66a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 21 Jul 2021 16:49:06 -0600 Subject: [PATCH 035/185] chore: release 1.1.2 (#50) 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 052cdac..994d8c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index ec074c3..cc47b70 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.1.1" +version = "1.1.2" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 6b59802d54d044575520711416baa85b0a636bea Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 22 Jul 2021 14:18:24 +0000 Subject: [PATCH 036/185] feat: add Samples section to CONTRIBUTING.rst (#49) Source-Link: https://github.com/googleapis/synthtool/commit/52e4e46eff2a0b70e3ff5506a02929d089d077d4 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:6186535cbdbf6b9fe61f00294929221d060634dae4a0795c1cefdbc995b2d605 --- .github/.OwlBot.lock.yaml | 2 +- CONTRIBUTING.rst | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index cb06536..d57f742 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:5ff7446edeaede81c3ed58b23a4e76a5403fba1350ce28478045657303b6479d + digest: sha256:6186535cbdbf6b9fe61f00294929221d060634dae4a0795c1cefdbc995b2d605 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c9afd32..6472c6d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -177,6 +177,30 @@ 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 ******************************************** From b38db87c5cf02bc22675789e2b4936c751fe6a13 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 23 Jul 2021 15:36:22 +0000 Subject: [PATCH 037/185] chore: fix kokoro config for samples (#52) Source-Link: https://github.com/googleapis/synthtool/commit/dd05f9d12f134871c9e45282349c9856fbebecdd Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/samples/python3.6/periodic-head.cfg | 2 +- .kokoro/samples/python3.7/periodic-head.cfg | 2 +- .kokoro/samples/python3.8/periodic-head.cfg | 2 +- .kokoro/samples/python3.9/periodic-head.cfg | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d57f742..9ee60f7 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:6186535cbdbf6b9fe61f00294929221d060634dae4a0795c1cefdbc995b2d605 + digest: sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b diff --git a/.kokoro/samples/python3.6/periodic-head.cfg b/.kokoro/samples/python3.6/periodic-head.cfg index f9cfcd3..302c7b0 100644 --- a/.kokoro/samples/python3.6/periodic-head.cfg +++ b/.kokoro/samples/python3.6/periodic-head.cfg @@ -7,5 +7,5 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" + value: "github/python-appengine-admin/.kokoro/test-samples-against-head.sh" } diff --git a/.kokoro/samples/python3.7/periodic-head.cfg b/.kokoro/samples/python3.7/periodic-head.cfg index f9cfcd3..302c7b0 100644 --- a/.kokoro/samples/python3.7/periodic-head.cfg +++ b/.kokoro/samples/python3.7/periodic-head.cfg @@ -7,5 +7,5 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" + value: "github/python-appengine-admin/.kokoro/test-samples-against-head.sh" } diff --git a/.kokoro/samples/python3.8/periodic-head.cfg b/.kokoro/samples/python3.8/periodic-head.cfg index f9cfcd3..302c7b0 100644 --- a/.kokoro/samples/python3.8/periodic-head.cfg +++ b/.kokoro/samples/python3.8/periodic-head.cfg @@ -7,5 +7,5 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" + value: "github/python-appengine-admin/.kokoro/test-samples-against-head.sh" } diff --git a/.kokoro/samples/python3.9/periodic-head.cfg b/.kokoro/samples/python3.9/periodic-head.cfg index f9cfcd3..302c7b0 100644 --- a/.kokoro/samples/python3.9/periodic-head.cfg +++ b/.kokoro/samples/python3.9/periodic-head.cfg @@ -7,5 +7,5 @@ env_vars: { env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" + value: "github/python-appengine-admin/.kokoro/test-samples-against-head.sh" } From 8b6c79806ea6c052d27434da1d6b997d27a83156 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 24 Jul 2021 10:20:09 +0000 Subject: [PATCH 038/185] fix: enable self signed jwt for grpc (#53) PiperOrigin-RevId: 386504689 Source-Link: https://github.com/googleapis/googleapis/commit/762094a99ac6e03a17516b13dfbef37927267a70 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6bfc480e1a161d5de121c2bcc3745885d33b265a --- .../services/applications/client.py | 4 +++ .../authorized_certificates/client.py | 4 +++ .../services/authorized_domains/client.py | 4 +++ .../services/domain_mappings/client.py | 4 +++ .../services/firewall/client.py | 4 +++ .../services/instances/client.py | 4 +++ .../services/services/client.py | 4 +++ .../services/versions/client.py | 4 +++ .../appengine_admin_v1/test_applications.py | 29 ++++++++++------- .../test_authorized_certificates.py | 31 +++++++++++-------- .../test_authorized_domains.py | 31 +++++++++++-------- .../test_domain_mappings.py | 31 +++++++++++-------- .../gapic/appengine_admin_v1/test_firewall.py | 29 ++++++++++------- .../appengine_admin_v1/test_instances.py | 29 ++++++++++------- .../gapic/appengine_admin_v1/test_services.py | 29 ++++++++++------- .../gapic/appengine_admin_v1/test_versions.py | 29 ++++++++++------- 16 files changed, 176 insertions(+), 94 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 58a29ed..6c8e925 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -330,6 +330,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def get_application( 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 79bdf59..8f67075 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -335,6 +335,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def list_authorized_certificates( 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 c427da1..545b69d 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -334,6 +334,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def list_authorized_domains( 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 01ca9eb..8032b46 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -333,6 +333,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def list_domain_mappings( diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index ba7b180..eaa3159 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -338,6 +338,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def list_ingress_rules( diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index d834836..0991030 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -348,6 +348,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def list_instances( diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 7f20d31..2d630ee 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -332,6 +332,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def list_services( diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index ed1e086..4d05135 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -335,6 +335,10 @@ def __init__( 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=( + Transport == type(self).get_transport_class("grpc") + or Transport == type(self).get_transport_class("grpc_asyncio") + ), ) def list_versions( diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 1cc3f9f..fbea8f0 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -122,16 +122,6 @@ def test_applications_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) -def test_applications_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -139,7 +129,7 @@ def test_applications_client_service_account_always_use_jwt(client_class): (transports.ApplicationsGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_applications_client_service_account_always_use_jwt_true( +def test_applications_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -149,6 +139,13 @@ def test_applications_client_service_account_always_use_jwt_true( 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", [ApplicationsClient, ApplicationsAsyncClient,]) def test_applications_client_from_service_account_file(client_class): @@ -225,6 +222,7 @@ def test_applications_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -241,6 +239,7 @@ def test_applications_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -257,6 +256,7 @@ def test_applications_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -285,6 +285,7 @@ def test_applications_client_client_options( client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -349,6 +350,7 @@ def test_applications_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -382,6 +384,7 @@ def test_applications_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -403,6 +406,7 @@ def test_applications_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -433,6 +437,7 @@ def test_applications_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -463,6 +468,7 @@ def test_applications_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -480,6 +486,7 @@ def test_applications_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) 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 567a1f3..a8d1ccd 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -126,18 +126,6 @@ def test_authorized_certificates_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize( - "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] -) -def test_authorized_certificates_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -145,7 +133,7 @@ def test_authorized_certificates_client_service_account_always_use_jwt(client_cl (transports.AuthorizedCertificatesGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_authorized_certificates_client_service_account_always_use_jwt_true( +def test_authorized_certificates_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -155,6 +143,13 @@ def test_authorized_certificates_client_service_account_always_use_jwt_true( 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", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] @@ -239,6 +234,7 @@ def test_authorized_certificates_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -255,6 +251,7 @@ def test_authorized_certificates_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -271,6 +268,7 @@ def test_authorized_certificates_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -299,6 +297,7 @@ def test_authorized_certificates_client_client_options( client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -375,6 +374,7 @@ def test_authorized_certificates_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -408,6 +408,7 @@ def test_authorized_certificates_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -429,6 +430,7 @@ def test_authorized_certificates_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -463,6 +465,7 @@ def test_authorized_certificates_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -497,6 +500,7 @@ def test_authorized_certificates_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -516,6 +520,7 @@ def test_authorized_certificates_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) 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 037bfdd..773df28 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -124,18 +124,6 @@ def test_authorized_domains_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize( - "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] -) -def test_authorized_domains_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -143,7 +131,7 @@ def test_authorized_domains_client_service_account_always_use_jwt(client_class): (transports.AuthorizedDomainsGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_authorized_domains_client_service_account_always_use_jwt_true( +def test_authorized_domains_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -153,6 +141,13 @@ def test_authorized_domains_client_service_account_always_use_jwt_true( 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", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] @@ -233,6 +228,7 @@ def test_authorized_domains_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -249,6 +245,7 @@ def test_authorized_domains_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -265,6 +262,7 @@ def test_authorized_domains_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -293,6 +291,7 @@ def test_authorized_domains_client_client_options( client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -369,6 +368,7 @@ def test_authorized_domains_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -402,6 +402,7 @@ def test_authorized_domains_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -423,6 +424,7 @@ def test_authorized_domains_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -453,6 +455,7 @@ def test_authorized_domains_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -483,6 +486,7 @@ def test_authorized_domains_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -502,6 +506,7 @@ def test_authorized_domains_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) 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 2f765dc..39edd26 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -129,18 +129,6 @@ def test_domain_mappings_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize( - "client_class", [DomainMappingsClient, DomainMappingsAsyncClient,] -) -def test_domain_mappings_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -148,7 +136,7 @@ def test_domain_mappings_client_service_account_always_use_jwt(client_class): (transports.DomainMappingsGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_domain_mappings_client_service_account_always_use_jwt_true( +def test_domain_mappings_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -158,6 +146,13 @@ def test_domain_mappings_client_service_account_always_use_jwt_true( 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", [DomainMappingsClient, DomainMappingsAsyncClient,] @@ -238,6 +233,7 @@ def test_domain_mappings_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -254,6 +250,7 @@ def test_domain_mappings_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -270,6 +267,7 @@ def test_domain_mappings_client_client_options( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -298,6 +296,7 @@ def test_domain_mappings_client_client_options( client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -364,6 +363,7 @@ def test_domain_mappings_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -397,6 +397,7 @@ def test_domain_mappings_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -418,6 +419,7 @@ def test_domain_mappings_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -448,6 +450,7 @@ def test_domain_mappings_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -478,6 +481,7 @@ def test_domain_mappings_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -497,6 +501,7 @@ def test_domain_mappings_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 100973b..ccbc861 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -113,16 +113,6 @@ def test_firewall_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) -def test_firewall_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -130,7 +120,7 @@ def test_firewall_client_service_account_always_use_jwt(client_class): (transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_firewall_client_service_account_always_use_jwt_true( +def test_firewall_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -140,6 +130,13 @@ def test_firewall_client_service_account_always_use_jwt_true( 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", [FirewallClient, FirewallAsyncClient,]) def test_firewall_client_from_service_account_file(client_class): @@ -210,6 +207,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -226,6 +224,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -242,6 +241,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -270,6 +270,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -334,6 +335,7 @@ def test_firewall_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -367,6 +369,7 @@ def test_firewall_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -388,6 +391,7 @@ def test_firewall_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -414,6 +418,7 @@ def test_firewall_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -440,6 +445,7 @@ def test_firewall_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -457,6 +463,7 @@ def test_firewall_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 5958553..2fbe274 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -118,16 +118,6 @@ def test_instances_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) -def test_instances_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -135,7 +125,7 @@ def test_instances_client_service_account_always_use_jwt(client_class): (transports.InstancesGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_instances_client_service_account_always_use_jwt_true( +def test_instances_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -145,6 +135,13 @@ def test_instances_client_service_account_always_use_jwt_true( 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", [InstancesClient, InstancesAsyncClient,]) def test_instances_client_from_service_account_file(client_class): @@ -219,6 +216,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -235,6 +233,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -251,6 +250,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -279,6 +279,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -343,6 +344,7 @@ def test_instances_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -376,6 +378,7 @@ def test_instances_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -397,6 +400,7 @@ def test_instances_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -427,6 +431,7 @@ def test_instances_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -457,6 +462,7 @@ def test_instances_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -474,6 +480,7 @@ def test_instances_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 855a9ba..4f78a14 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -119,16 +119,6 @@ def test_services_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) -def test_services_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -136,7 +126,7 @@ def test_services_client_service_account_always_use_jwt(client_class): (transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_services_client_service_account_always_use_jwt_true( +def test_services_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -146,6 +136,13 @@ def test_services_client_service_account_always_use_jwt_true( 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", [ServicesClient, ServicesAsyncClient,]) def test_services_client_from_service_account_file(client_class): @@ -216,6 +213,7 @@ def test_services_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -232,6 +230,7 @@ def test_services_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -248,6 +247,7 @@ def test_services_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -276,6 +276,7 @@ def test_services_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -340,6 +341,7 @@ def test_services_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -373,6 +375,7 @@ def test_services_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -394,6 +397,7 @@ def test_services_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -420,6 +424,7 @@ def test_services_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -446,6 +451,7 @@ def test_services_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -463,6 +469,7 @@ def test_services_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 00afb55..f47e621 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -122,16 +122,6 @@ def test_versions_client_from_service_account_info(client_class): assert client.transport._host == "appengine.googleapis.com:443" -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) -def test_versions_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [ @@ -139,7 +129,7 @@ def test_versions_client_service_account_always_use_jwt(client_class): (transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), ], ) -def test_versions_client_service_account_always_use_jwt_true( +def test_versions_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -149,6 +139,13 @@ def test_versions_client_service_account_always_use_jwt_true( 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", [VersionsClient, VersionsAsyncClient,]) def test_versions_client_from_service_account_file(client_class): @@ -219,6 +216,7 @@ def test_versions_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -235,6 +233,7 @@ def test_versions_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -251,6 +250,7 @@ def test_versions_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -279,6 +279,7 @@ def test_versions_client_client_options(client_class, transport_class, transport client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -343,6 +344,7 @@ def test_versions_client_mtls_env_auto( 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, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -376,6 +378,7 @@ def test_versions_client_mtls_env_auto( 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, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -397,6 +400,7 @@ def test_versions_client_mtls_env_auto( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -423,6 +427,7 @@ def test_versions_client_client_options_scopes( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -449,6 +454,7 @@ def test_versions_client_client_options_credentials_file( client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) @@ -466,6 +472,7 @@ def test_versions_client_client_options_from_dict(): client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, ) From aeeefd10f953ec09ddc8e3bde38f0d90bdab47f8 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 27 Jul 2021 11:28:19 -0400 Subject: [PATCH 039/185] chore: release as 1.1.3 (#54) Release-As: 1.1.3 From d65b03f77ad1725b366d54224412598691e397ad Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 27 Jul 2021 15:36:13 +0000 Subject: [PATCH 040/185] chore: release 1.1.3 (#55) :robot: I have created a release \*beep\* \*boop\* --- ### [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 17 +++++++++++++++++ setup.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 994d8c9..62848e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index cc47b70..81c2f50 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.1.2" +version = "1.1.3" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From dfbed92c4f7480d464df81e16273a04eb7925bf8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:55:39 +0000 Subject: [PATCH 041/185] chore(python): avoid `.nox` directories when building docs (#56) Source-Link: https://github.com/googleapis/synthtool/commit/7e1f6da50524b5d98eb67adbf6dd0805df54233d Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:a1a891041baa4ffbe1a809ac1b8b9b4a71887293c9101c88e8e255943c5aec2d --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9ee60f7..b771c37 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b + digest: sha256:a1a891041baa4ffbe1a809ac1b8b9b4a71887293c9101c88e8e255943c5aec2d diff --git a/docs/conf.py b/docs/conf.py index 1f47be1..a1f1b0d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -110,6 +110,7 @@ # directories to ignore when looking for source files. exclude_patterns = [ "_build", + "**/.nox/**/*", "samples/AUTHORING_GUIDE.md", "samples/CONTRIBUTING.md", "samples/snippets/README.rst", From 20e9e11eb706409ee1b78218b57c40c425817b8c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 13 Aug 2021 11:10:27 -0400 Subject: [PATCH 042/185] chore: drop mention of Python 2.7 from templates (#57) Source-Link: https://github.com/googleapis/synthtool/commit/facee4cc1ea096cd8bcc008bb85929daa7c414c0 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- noxfile.py | 12 +++++++++--- scripts/readme-gen/templates/install_deps.tmpl.rst | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b771c37..a9fcd07 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:a1a891041baa4ffbe1a809ac1b8b9b4a71887293c9101c88e8e255943c5aec2d + digest: sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803 diff --git a/noxfile.py b/noxfile.py index 94ee6a8..93ea9b1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -84,9 +84,15 @@ def default(session): constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install("asyncmock", "pytest-asyncio", "-c", constraints_path) - - session.install("mock", "pytest", "pytest-cov", "-c", constraints_path) + session.install( + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", + "-c", + constraints_path, + ) session.install("-e", ".", "-c", constraints_path) diff --git a/scripts/readme-gen/templates/install_deps.tmpl.rst b/scripts/readme-gen/templates/install_deps.tmpl.rst index a0406db..275d649 100644 --- a/scripts/readme-gen/templates/install_deps.tmpl.rst +++ b/scripts/readme-gen/templates/install_deps.tmpl.rst @@ -12,7 +12,7 @@ Install Dependencies .. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup -#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. +#. Create a virtualenv. Samples are compatible with Python 3.6+. .. code-block:: bash From c0cda58d2f572fdf4cdf5d32a2ed78e155ec3e48 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Wed, 18 Aug 2021 07:40:49 -0600 Subject: [PATCH 043/185] chore: generate python samples templates in owlbot.py (#58) Generate python samples templates in owlbot.py --- owlbot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/owlbot.py b/owlbot.py index 30ffad7..8cf0680 100644 --- a/owlbot.py +++ b/owlbot.py @@ -39,6 +39,7 @@ # ---------------------------------------------------------------------------- templated_files = common.py_library(cov_level=99, microgenerator=True) +python.py_samples(skip_readmes=True) # the microgenerator has a good coveragerc file excludes = [".coveragerc"] From 731c92c239dc385551547ab7098e197bde6aa314 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 27 Aug 2021 17:15:24 -0400 Subject: [PATCH 044/185] chore: migrate default branch from master to main (#60) --- .kokoro/build.sh | 2 +- .kokoro/test-samples-impl.sh | 2 +- CONTRIBUTING.rst | 12 ++++---- docs/conf.py | 10 +++---- owlbot.py | 57 +++++++++++++++++++++++++++++++++++- 5 files changed, 69 insertions(+), 14 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index f9cd17f..2461dfc 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -41,7 +41,7 @@ python3 -m pip install --upgrade --quiet nox python3 -m nox --version # If this is a continuous build, send the test log to the FlakyBot. -# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. +# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then cleanup() { chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh index 311a8d5..8a324c9 100755 --- a/.kokoro/test-samples-impl.sh +++ b/.kokoro/test-samples-impl.sh @@ -80,7 +80,7 @@ for file in samples/**/requirements.txt; do EXIT=$? # If this is a periodic build, send the test log to the FlakyBot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. + # See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot $KOKORO_GFILE_DIR/linux_amd64/flakybot diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6472c6d..813587a 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -50,9 +50,9 @@ You'll have to create a development environment using a Git checkout: # Configure remotes such that you can pull changes from the googleapis/python-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 master + # fetch and merge changes from upstream into main $ git fetch upstream - $ git merge upstream/master + $ git merge upstream/main Now your local repo is set up such that you will push changes to your GitHub repo, from which you can submit a pull request. @@ -110,12 +110,12 @@ Coding Style variables:: export GOOGLE_CLOUD_TESTING_REMOTE="upstream" - export GOOGLE_CLOUD_TESTING_BRANCH="master" + export GOOGLE_CLOUD_TESTING_BRANCH="main" By doing this, you are specifying the location of the most up-to-date version of ``python-appengine-admin``. The the suggested remote name ``upstream`` should point to the official ``googleapis`` checkout and the - the branch should be the main branch on that remote (``master``). + the branch should be the main branch on that remote (``main``). - This repository contains configuration for the `pre-commit `__ tool, which automates checking @@ -209,7 +209,7 @@ The `description on PyPI`_ for the project comes directly from the ``README``. Due to the reStructuredText (``rst``) parser used by PyPI, relative links which will work on GitHub (e.g. ``CONTRIBUTING.rst`` instead of -``https://github.com/googleapis/python-appengine-admin/blob/master/CONTRIBUTING.rst``) +``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 @@ -234,7 +234,7 @@ We support: Supported versions can be found in our ``noxfile.py`` `config`_. -.. _config: https://github.com/googleapis/python-appengine-admin/blob/master/noxfile.py +.. _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. diff --git a/docs/conf.py b/docs/conf.py index a1f1b0d..4b413e4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -76,8 +76,8 @@ # The encoding of source files. # source_encoding = 'utf-8-sig' -# The master toctree document. -master_doc = "index" +# The root toctree document. +root_doc = "index" # General information about the project. project = "google-cloud-appengine-admin" @@ -280,7 +280,7 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ ( - master_doc, + root_doc, "google-cloud-appengine-admin.tex", "google-cloud-appengine-admin Documentation", author, @@ -315,7 +315,7 @@ # (source start file, name, description, authors, manual section). man_pages = [ ( - master_doc, + root_doc, "google-cloud-appengine-admin", "google-cloud-appengine-admin Documentation", [author], @@ -334,7 +334,7 @@ # dir menu entry, description, category) texinfo_documents = [ ( - master_doc, + root_doc, "google-cloud-appengine-admin", "google-cloud-appengine-admin Documentation", author, diff --git a/owlbot.py b/owlbot.py index 8cf0680..2c87755 100644 --- a/owlbot.py +++ b/owlbot.py @@ -39,7 +39,6 @@ # ---------------------------------------------------------------------------- templated_files = common.py_library(cov_level=99, microgenerator=True) -python.py_samples(skip_readmes=True) # the microgenerator has a good coveragerc file excludes = [".coveragerc"] @@ -47,4 +46,60 @@ templated_files, excludes=excludes ) +python.py_samples(skip_readmes=True) + +# Remove the replacements below once https://github.com/googleapis/synthtool/pull/1188 is merged + +# Update googleapis/repo-automation-bots repo to main in .kokoro/*.sh files +s.replace(".kokoro/*.sh", "repo-automation-bots/tree/master", "repo-automation-bots/tree/main") + +# Customize CONTRIBUTING.rst to replace master with main +s.replace( + "CONTRIBUTING.rst", + "fetch and merge changes from upstream into master", + "fetch and merge changes from upstream into main", +) + +s.replace( + "CONTRIBUTING.rst", + "git merge upstream/master", + "git merge upstream/main", +) + +s.replace( + "CONTRIBUTING.rst", + """export GOOGLE_CLOUD_TESTING_BRANCH=\"master\"""", + """export GOOGLE_CLOUD_TESTING_BRANCH=\"main\"""", +) + +s.replace( + "CONTRIBUTING.rst", + "remote \(``master``\)", + "remote (``main``)", +) + +s.replace( + "CONTRIBUTING.rst", + "blob/master/CONTRIBUTING.rst", + "blob/main/CONTRIBUTING.rst", +) + +s.replace( + "CONTRIBUTING.rst", + "blob/master/noxfile.py", + "blob/main/noxfile.py", +) + +s.replace( + "docs/conf.py", + "master_doc", + "root_doc", +) + +s.replace( + "docs/conf.py", + "# The master toctree document.", + "# The root toctree document.", +) + s.shell.run(["nox", "-s", "blacken"], hide_output=False) From 7798504b81ec2decefc87b90c3c19ed93e4d7318 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 15:26:53 +0000 Subject: [PATCH 045/185] chore(python): disable dependency dashboard (#61) --- .github/.OwlBot.lock.yaml | 2 +- renovate.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index a9fcd07..b75186c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803 + digest: sha256:d6761eec279244e57fe9d21f8343381a01d3632c034811a72f68b83119e58c69 diff --git a/renovate.json b/renovate.json index c048955..9fa8816 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,8 @@ { "extends": [ - "config:base", ":preserveSemverRanges" + "config:base", + ":preserveSemverRanges", + ":disableDependencyDashboard" ], "ignorePaths": [".pre-commit-config.yaml"], "pip_requirements": { From 35eee2906e1a6bbf210eccb4e153589068a6fc4d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 1 Sep 2021 15:44:53 +0000 Subject: [PATCH 046/185] chore(python): group renovate prs (#62) --- .github/.OwlBot.lock.yaml | 2 +- renovate.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b75186c..ef3cb34 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:d6761eec279244e57fe9d21f8343381a01d3632c034811a72f68b83119e58c69 + digest: sha256:1456ea2b3b523ccff5e13030acef56d1de28f21249c62aa0f196265880338fa7 diff --git a/renovate.json b/renovate.json index 9fa8816..c21036d 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,7 @@ { "extends": [ "config:base", + "group:all", ":preserveSemverRanges", ":disableDependencyDashboard" ], From dd9bdf1cb6cb7718a9c1e5c6166df12a1849c572 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 2 Sep 2021 16:33:50 -0400 Subject: [PATCH 047/185] chore(python): rename default branch to main (#63) * chore(python): rename default branch to main Source-Link: https://github.com/googleapis/synthtool/commit/5c0fa62eea9c33ebe61e582424b659eb264e1ba4 Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:0ffe3bdd6c7159692df5f7744da74e5ef19966288a6bf76023e8e04e0c424d7d * chore: remove obsolete replacements in owlbot.py Co-authored-by: Owl Bot Co-authored-by: Nick Cain --- .github/.OwlBot.lock.yaml | 2 +- CONTRIBUTING.rst | 6 ++--- owlbot.py | 54 --------------------------------------- 3 files changed, 4 insertions(+), 58 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ef3cb34..c07f148 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:1456ea2b3b523ccff5e13030acef56d1de28f21249c62aa0f196265880338fa7 + digest: sha256:0ffe3bdd6c7159692df5f7744da74e5ef19966288a6bf76023e8e04e0c424d7d diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 813587a..0ce1126 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -113,9 +113,9 @@ Coding Style 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 the suggested remote name ``upstream`` - should point to the official ``googleapis`` checkout and the - the branch should be the main branch on that remote (``main``). + 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 diff --git a/owlbot.py b/owlbot.py index 2c87755..73126b5 100644 --- a/owlbot.py +++ b/owlbot.py @@ -48,58 +48,4 @@ python.py_samples(skip_readmes=True) -# Remove the replacements below once https://github.com/googleapis/synthtool/pull/1188 is merged - -# Update googleapis/repo-automation-bots repo to main in .kokoro/*.sh files -s.replace(".kokoro/*.sh", "repo-automation-bots/tree/master", "repo-automation-bots/tree/main") - -# Customize CONTRIBUTING.rst to replace master with main -s.replace( - "CONTRIBUTING.rst", - "fetch and merge changes from upstream into master", - "fetch and merge changes from upstream into main", -) - -s.replace( - "CONTRIBUTING.rst", - "git merge upstream/master", - "git merge upstream/main", -) - -s.replace( - "CONTRIBUTING.rst", - """export GOOGLE_CLOUD_TESTING_BRANCH=\"master\"""", - """export GOOGLE_CLOUD_TESTING_BRANCH=\"main\"""", -) - -s.replace( - "CONTRIBUTING.rst", - "remote \(``master``\)", - "remote (``main``)", -) - -s.replace( - "CONTRIBUTING.rst", - "blob/master/CONTRIBUTING.rst", - "blob/main/CONTRIBUTING.rst", -) - -s.replace( - "CONTRIBUTING.rst", - "blob/master/noxfile.py", - "blob/main/noxfile.py", -) - -s.replace( - "docs/conf.py", - "master_doc", - "root_doc", -) - -s.replace( - "docs/conf.py", - "# The master toctree document.", - "# The root toctree document.", -) - s.shell.run(["nox", "-s", "blacken"], hide_output=False) From 5252c77c7fb7af6bbd82ac45edaf47b507188cd7 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 7 Sep 2021 11:31:58 -0600 Subject: [PATCH 048/185] chore: reference main branch of google-cloud-python (#65) --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 72ab199..6b75bcf 100644 --- a/README.rst +++ b/README.rst @@ -9,7 +9,7 @@ Python Client for App Engine Admin - `Product Documentation`_ .. |GA| image:: https://img.shields.io/badge/support-ga-gold.svg - :target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#general-availability + :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability .. |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 @@ -79,4 +79,4 @@ Next Steps 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/master/README.rst +.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst From 7e363ccf915b64f8371dba560b56f6509bc3a85c Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Tue, 21 Sep 2021 13:42:13 -0700 Subject: [PATCH 049/185] chore: relocate owl bot post processor (#67) chore: relocate owl bot post processor --- .github/.OwlBot.lock.yaml | 4 ++-- .github/.OwlBot.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index c07f148..2567653 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: - image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:0ffe3bdd6c7159692df5f7744da74e5ef19966288a6bf76023e8e04e0c424d7d + image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest + digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index d8bfd9a..c28d356 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -13,7 +13,7 @@ # limitations under the License. docker: - image: gcr.io/repo-automation-bots/owlbot-python:latest + image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest deep-remove-regex: - /owl-bot-staging From 89b4378632af08a11c3bd45d88eb0f0ac152238f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 16:00:18 +0000 Subject: [PATCH 050/185] chore: use gapic-generator-python 0.51.2 (#68) - [ ] Regenerate this pull request now. fix: add 'dict' annotation type to 'request' Committer: @busunkim96 PiperOrigin-RevId: 398509016 Source-Link: https://github.com/googleapis/googleapis/commit/b224dfa52642a733ea64849d4e06d15c274bc08f Source-Link: https://github.com/googleapis/googleapis-gen/commit/63a1db7a38d74b9639592f521ed1daaf7299ad9a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjNhMWRiN2EzOGQ3NGI5NjM5NTkyZjUyMWVkMWRhYWY3Mjk5YWQ5YSJ9 --- .../services/applications/client.py | 18 ++--- .../services/applications/transports/base.py | 2 +- .../services/applications/transports/grpc.py | 6 +- .../applications/transports/grpc_asyncio.py | 6 +- .../authorized_certificates/client.py | 22 +++--- .../transports/base.py | 2 +- .../transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../services/authorized_domains/client.py | 6 +- .../authorized_domains/transports/base.py | 2 +- .../authorized_domains/transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../services/domain_mappings/client.py | 22 +++--- .../domain_mappings/transports/base.py | 2 +- .../domain_mappings/transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../services/firewall/client.py | 26 +++---- .../services/firewall/transports/base.py | 2 +- .../services/firewall/transports/grpc.py | 6 +- .../firewall/transports/grpc_asyncio.py | 6 +- .../services/instances/client.py | 18 ++--- .../services/instances/transports/base.py | 2 +- .../services/instances/transports/grpc.py | 6 +- .../instances/transports/grpc_asyncio.py | 6 +- .../services/services/client.py | 18 ++--- .../services/services/transports/base.py | 2 +- .../services/services/transports/grpc.py | 6 +- .../services/transports/grpc_asyncio.py | 6 +- .../services/versions/client.py | 22 +++--- .../services/versions/transports/base.py | 2 +- .../services/versions/transports/grpc.py | 6 +- .../versions/transports/grpc_asyncio.py | 6 +- scripts/fixup_appengine_admin_v1_keywords.py | 70 +++++++++---------- .../appengine_admin_v1/test_instances.py | 8 +-- 34 files changed, 171 insertions(+), 171 deletions(-) diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 6c8e925..b43da0c 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -338,7 +338,7 @@ def __init__( def get_application( self, - request: appengine.GetApplicationRequest = None, + request: Union[appengine.GetApplicationRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -347,7 +347,7 @@ def get_application( r"""Gets information about an application. Args: - request (google.cloud.appengine_admin_v1.types.GetApplicationRequest): + request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]): The request object. Request message for `Applications.GetApplication`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -389,7 +389,7 @@ def get_application( def create_application( self, - request: appengine.CreateApplicationRequest = None, + request: Union[appengine.CreateApplicationRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -408,7 +408,7 @@ def create_application( Billing `__. Args: - request (google.cloud.appengine_admin_v1.types.CreateApplicationRequest): + 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, @@ -453,7 +453,7 @@ def create_application( def update_application( self, - request: appengine.UpdateApplicationRequest = None, + request: Union[appengine.UpdateApplicationRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -468,7 +468,7 @@ def update_application( the application. Args: - request (google.cloud.appengine_admin_v1.types.UpdateApplicationRequest): + 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, @@ -519,7 +519,7 @@ def update_application( def repair_application( self, - request: appengine.RepairApplicationRequest = None, + request: Union[appengine.RepairApplicationRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -538,7 +538,7 @@ def repair_application( Cloud Console Activity Log. Args: - request (google.cloud.appengine_admin_v1.types.RepairApplicationRequest): + 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, 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 a0de499..91338b9 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -124,7 +124,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 bc81f85..7e79a41 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -83,16 +83,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 d9264e4..1a03ec4 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 @@ -130,16 +130,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 8f67075..02be3a5 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -343,7 +343,7 @@ def __init__( def list_authorized_certificates( self, - request: appengine.ListAuthorizedCertificatesRequest = None, + request: Union[appengine.ListAuthorizedCertificatesRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -353,7 +353,7 @@ def list_authorized_certificates( administer. Args: - request (google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest): + 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, @@ -405,7 +405,7 @@ def list_authorized_certificates( def get_authorized_certificate( self, - request: appengine.GetAuthorizedCertificateRequest = None, + request: Union[appengine.GetAuthorizedCertificateRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -414,7 +414,7 @@ def get_authorized_certificate( r"""Gets the specified SSL certificate. Args: - request (google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest): + 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, @@ -460,7 +460,7 @@ def get_authorized_certificate( def create_authorized_certificate( self, - request: appengine.CreateAuthorizedCertificateRequest = None, + request: Union[appengine.CreateAuthorizedCertificateRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -469,7 +469,7 @@ def create_authorized_certificate( r"""Uploads the specified SSL certificate. Args: - request (google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest): + 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, @@ -515,7 +515,7 @@ def create_authorized_certificate( def update_authorized_certificate( self, - request: appengine.UpdateAuthorizedCertificateRequest = None, + request: Union[appengine.UpdateAuthorizedCertificateRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -529,7 +529,7 @@ def update_authorized_certificate( updated. Args: - request (google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest): + 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, @@ -575,7 +575,7 @@ def update_authorized_certificate( def delete_authorized_certificate( self, - request: appengine.DeleteAuthorizedCertificateRequest = None, + request: Union[appengine.DeleteAuthorizedCertificateRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -584,7 +584,7 @@ def delete_authorized_certificate( r"""Deletes the specified SSL certificate. Args: - request (google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest): + 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, 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 5a1d2f9..1ae962d 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 @@ -123,7 +123,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 a7f20ab..8f86bf8 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 @@ -84,16 +84,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 8ab6414..9b0d7ea 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 @@ -131,16 +131,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 545b69d..4d16281 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -342,7 +342,7 @@ def __init__( def list_authorized_domains( self, - request: appengine.ListAuthorizedDomainsRequest = None, + request: Union[appengine.ListAuthorizedDomainsRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -352,7 +352,7 @@ def list_authorized_domains( administer. Args: - request (google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest): + 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, 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 cb57d63..22ebc61 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 @@ -121,7 +121,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 82d51bb..5095922 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 @@ -82,16 +82,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 1848cae..f06afc5 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 @@ -129,16 +129,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 8032b46..a3c7a4c 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -341,7 +341,7 @@ def __init__( def list_domain_mappings( self, - request: appengine.ListDomainMappingsRequest = None, + request: Union[appengine.ListDomainMappingsRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -350,7 +350,7 @@ def list_domain_mappings( r"""Lists the domain mappings on an application. Args: - request (google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest): + 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, @@ -399,7 +399,7 @@ def list_domain_mappings( def get_domain_mapping( self, - request: appengine.GetDomainMappingRequest = None, + request: Union[appengine.GetDomainMappingRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -408,7 +408,7 @@ def get_domain_mapping( r"""Gets the specified domain mapping. Args: - request (google.cloud.appengine_admin_v1.types.GetDomainMappingRequest): + 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, @@ -449,7 +449,7 @@ def get_domain_mapping( def create_domain_mapping( self, - request: appengine.CreateDomainMappingRequest = None, + request: Union[appengine.CreateDomainMappingRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -461,7 +461,7 @@ def create_domain_mapping( ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. Args: - request (google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest): + 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, @@ -513,7 +513,7 @@ def create_domain_mapping( def update_domain_mapping( self, - request: appengine.UpdateDomainMappingRequest = None, + request: Union[appengine.UpdateDomainMappingRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -526,7 +526,7 @@ def update_domain_mapping( ``DomainMapping`` resource. Args: - request (google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest): + 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, @@ -578,7 +578,7 @@ def update_domain_mapping( def delete_domain_mapping( self, - request: appengine.DeleteDomainMappingRequest = None, + request: Union[appengine.DeleteDomainMappingRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -589,7 +589,7 @@ def delete_domain_mapping( ``DomainMapping`` resource. Args: - request (google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest): + 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, 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 7d971f7..b11cc15 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 @@ -124,7 +124,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 e7ee590..1f89b60 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 @@ -83,16 +83,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 df14efb..46bb973 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 @@ -130,16 +130,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index eaa3159..b15645d 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -346,7 +346,7 @@ def __init__( def list_ingress_rules( self, - request: appengine.ListIngressRulesRequest = None, + request: Union[appengine.ListIngressRulesRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -355,7 +355,7 @@ def list_ingress_rules( r"""Lists the firewall rules of an application. Args: - request (google.cloud.appengine_admin_v1.types.ListIngressRulesRequest): + 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, @@ -404,7 +404,7 @@ def list_ingress_rules( def batch_update_ingress_rules( self, - request: appengine.BatchUpdateIngressRulesRequest = None, + request: Union[appengine.BatchUpdateIngressRulesRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -419,7 +419,7 @@ def batch_update_ingress_rules( end of the list. Args: - request (google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest): + 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, @@ -460,7 +460,7 @@ def batch_update_ingress_rules( def create_ingress_rule( self, - request: appengine.CreateIngressRuleRequest = None, + request: Union[appengine.CreateIngressRuleRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -469,7 +469,7 @@ def create_ingress_rule( r"""Creates a firewall rule for the application. Args: - request (google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest): + 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, @@ -512,7 +512,7 @@ def create_ingress_rule( def get_ingress_rule( self, - request: appengine.GetIngressRuleRequest = None, + request: Union[appengine.GetIngressRuleRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -521,7 +521,7 @@ def get_ingress_rule( r"""Gets the specified firewall rule. Args: - request (google.cloud.appengine_admin_v1.types.GetIngressRuleRequest): + 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, @@ -564,7 +564,7 @@ def get_ingress_rule( def update_ingress_rule( self, - request: appengine.UpdateIngressRuleRequest = None, + request: Union[appengine.UpdateIngressRuleRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -573,7 +573,7 @@ def update_ingress_rule( r"""Updates the specified firewall rule. Args: - request (google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest): + 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, @@ -616,7 +616,7 @@ def update_ingress_rule( def delete_ingress_rule( self, - request: appengine.DeleteIngressRuleRequest = None, + request: Union[appengine.DeleteIngressRuleRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -625,7 +625,7 @@ def delete_ingress_rule( r"""Deletes the specified firewall rule. Args: - request (google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest): + 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, 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 8f2f465..04b20ea 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -123,7 +123,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 a20b25c..1809e0b 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -92,16 +92,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 b250cfd..75a7250 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 @@ -139,16 +139,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 0991030..aa6f6f5 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -356,7 +356,7 @@ def __init__( def list_instances( self, - request: appengine.ListInstancesRequest = None, + request: Union[appengine.ListInstancesRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -369,7 +369,7 @@ def list_instances( API `__. Args: - request (google.cloud.appengine_admin_v1.types.ListInstancesRequest): + 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, @@ -418,7 +418,7 @@ def list_instances( def get_instance( self, - request: appengine.GetInstanceRequest = None, + request: Union[appengine.GetInstanceRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -427,7 +427,7 @@ def get_instance( r"""Gets instance information. Args: - request (google.cloud.appengine_admin_v1.types.GetInstanceRequest): + 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, @@ -469,7 +469,7 @@ def get_instance( def delete_instance( self, - request: appengine.DeleteInstanceRequest = None, + request: Union[appengine.DeleteInstanceRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -492,7 +492,7 @@ def delete_instance( method. Args: - request (google.cloud.appengine_admin_v1.types.DeleteInstanceRequest): + 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, @@ -554,7 +554,7 @@ def delete_instance( def debug_instance( self, - request: appengine.DebugInstanceRequest = None, + request: Union[appengine.DebugInstanceRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -572,7 +572,7 @@ def debug_instance( environment. Args: - request (google.cloud.appengine_admin_v1.types.DebugInstanceRequest): + 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, 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 ab81cf2..af17f3d 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -124,7 +124,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 905f187..7252c39 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -83,16 +83,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 a8f7b05..4825fdc 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 @@ -130,16 +130,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 2d630ee..bc61a0a 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -340,7 +340,7 @@ def __init__( def list_services( self, - request: appengine.ListServicesRequest = None, + request: Union[appengine.ListServicesRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -349,7 +349,7 @@ def list_services( r"""Lists all the services in the application. Args: - request (google.cloud.appengine_admin_v1.types.ListServicesRequest): + 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, @@ -398,7 +398,7 @@ def list_services( def get_service( self, - request: appengine.GetServiceRequest = None, + request: Union[appengine.GetServiceRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -408,7 +408,7 @@ def get_service( service. Args: - request (google.cloud.appengine_admin_v1.types.GetServiceRequest): + 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, @@ -459,7 +459,7 @@ def get_service( def update_service( self, - request: appengine.UpdateServiceRequest = None, + request: Union[appengine.UpdateServiceRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -468,7 +468,7 @@ def update_service( r"""Updates the configuration of the specified service. Args: - request (google.cloud.appengine_admin_v1.types.UpdateServiceRequest): + 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, @@ -526,7 +526,7 @@ def update_service( def delete_service( self, - request: appengine.DeleteServiceRequest = None, + request: Union[appengine.DeleteServiceRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -536,7 +536,7 @@ def delete_service( versions. Args: - request (google.cloud.appengine_admin_v1.types.DeleteServiceRequest): + 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, 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 4f5d40e..a276406 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -124,7 +124,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 4aed507..6225fc5 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -83,16 +83,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 339511c..b479e83 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 @@ -130,16 +130,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 4d05135..2d3fe2d 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -343,7 +343,7 @@ def __init__( def list_versions( self, - request: appengine.ListVersionsRequest = None, + request: Union[appengine.ListVersionsRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -352,7 +352,7 @@ def list_versions( r"""Lists the versions of a service. Args: - request (google.cloud.appengine_admin_v1.types.ListVersionsRequest): + 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, @@ -401,7 +401,7 @@ def list_versions( def get_version( self, - request: appengine.GetVersionRequest = None, + request: Union[appengine.GetVersionRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -412,7 +412,7 @@ def get_version( parameter to get the full resource. Args: - request (google.cloud.appengine_admin_v1.types.GetVersionRequest): + 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, @@ -454,7 +454,7 @@ def get_version( def create_version( self, - request: appengine.CreateVersionRequest = None, + request: Union[appengine.CreateVersionRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -463,7 +463,7 @@ def create_version( r"""Deploys code and resource files to a new version. Args: - request (google.cloud.appengine_admin_v1.types.CreateVersionRequest): + 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, @@ -514,7 +514,7 @@ def create_version( def update_version( self, - request: appengine.UpdateVersionRequest = None, + request: Union[appengine.UpdateVersionRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -558,7 +558,7 @@ def update_version( - ```manual_scaling.instances`` `__ Args: - request (google.cloud.appengine_admin_v1.types.UpdateVersionRequest): + 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, @@ -609,7 +609,7 @@ def update_version( def delete_version( self, - request: appengine.DeleteVersionRequest = None, + request: Union[appengine.DeleteVersionRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -618,7 +618,7 @@ def delete_version( r"""Deletes an existing Version resource. Args: - request (google.cloud.appengine_admin_v1.types.DeleteVersionRequest): + 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, 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 085cfd3..03f11cd 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -124,7 +124,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # 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) 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 fc8ee54..9abe8a4 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -83,16 +83,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. 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 b8fdefb..52a24e5 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 @@ -130,16 +130,16 @@ def __init__( 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 applicatin default SSL credentials. + ``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 grpc channel. It is ignored if ``channel`` is provided. + 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 mutual TLS channel. It is + 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. diff --git a/scripts/fixup_appengine_admin_v1_keywords.py b/scripts/fixup_appengine_admin_v1_keywords.py index 977426f..d8d9f5c 100644 --- a/scripts/fixup_appengine_admin_v1_keywords.py +++ b/scripts/fixup_appengine_admin_v1_keywords.py @@ -39,40 +39,40 @@ def partition( 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', ), + '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: @@ -91,7 +91,7 @@ def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: return updated kwargs, ctrl_kwargs = partition( - lambda a: not a.keyword.value in self.CTRL_PARAMS, + lambda a: a.keyword.value not in self.CTRL_PARAMS, kwargs ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 2fbe274..d82988f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -780,7 +780,7 @@ def test_get_instance( vm_id="vm_id_value", requests=892, errors=669, - qps=0.340, + qps=0.34, average_latency=1578, memory_usage=1293, vm_status="vm_status_value", @@ -806,7 +806,7 @@ def test_get_instance( assert response.vm_id == "vm_id_value" assert response.requests == 892 assert response.errors == 669 - assert math.isclose(response.qps, 0.340, rel_tol=1e-6) + 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" @@ -860,7 +860,7 @@ async def test_get_instance_async( vm_id="vm_id_value", requests=892, errors=669, - qps=0.340, + qps=0.34, average_latency=1578, memory_usage=1293, vm_status="vm_status_value", @@ -887,7 +887,7 @@ async def test_get_instance_async( assert response.vm_id == "vm_id_value" assert response.requests == 892 assert response.errors == 669 - assert math.isclose(response.qps, 0.340, rel_tol=1e-6) + 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" From bcf072ff006f688e4c7c6d86484e52559651e1ff Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 27 Sep 2021 14:36:13 +0000 Subject: [PATCH 051/185] chore: release 1.1.4 (#69) :robot: I have created a release \*beep\* \*boop\* --- ### [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62848e6..a2e1622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 81c2f50..8d829db 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.1.3" +version = "1.1.4" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From a29e4200c6fdb7cad045bfd29e74a35c9a6e6fd6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 10:28:11 +0000 Subject: [PATCH 052/185] chore: use gapic-generator-python 0.52.0 (#70) - [ ] Regenerate this pull request now. fix: improper types in pagers generation PiperOrigin-RevId: 399773015 Source-Link: https://github.com/googleapis/googleapis/commit/410c184536a22fadaf00aec3cab04102e34d2322 Source-Link: https://github.com/googleapis/googleapis-gen/commit/290e883545e3ac9ff2bd00cd0dacb28f1b8ca945 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjkwZTg4MzU0NWUzYWM5ZmYyYmQwMGNkMGRhY2IyOGYxYjhjYTk0NSJ9 --- .../services/authorized_certificates/pagers.py | 12 ++++++------ .../services/authorized_domains/pagers.py | 12 ++++++------ .../services/domain_mappings/pagers.py | 12 ++++++------ .../appengine_admin_v1/services/firewall/pagers.py | 12 ++++++------ .../appengine_admin_v1/services/instances/pagers.py | 12 ++++++------ .../appengine_admin_v1/services/services/pagers.py | 12 ++++++------ .../appengine_admin_v1/services/versions/pagers.py | 12 ++++++------ 7 files changed, 42 insertions(+), 42 deletions(-) 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 25f943d..77d8f0e 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.appengine_admin_v1.types import appengine @@ -75,14 +75,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[appengine.ListAuthorizedCertificatesResponse]: + 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) -> Iterable[certificate.AuthorizedCertificate]: + def __iter__(self) -> Iterator[certificate.AuthorizedCertificate]: for page in self.pages: yield from page.certificates @@ -139,14 +139,14 @@ def __getattr__(self, name: str) -> Any: @property async def pages( self, - ) -> AsyncIterable[appengine.ListAuthorizedCertificatesResponse]: + ) -> 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) -> AsyncIterable[certificate.AuthorizedCertificate]: + def __aiter__(self) -> AsyncIterator[certificate.AuthorizedCertificate]: async def async_generator(): async for page in self.pages: for response in page.certificates: 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 5d34d47..70911d5 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.appengine_admin_v1.types import appengine @@ -75,14 +75,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[appengine.ListAuthorizedDomainsResponse]: + 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) -> Iterable[domain.AuthorizedDomain]: + def __iter__(self) -> Iterator[domain.AuthorizedDomain]: for page in self.pages: yield from page.domains @@ -137,14 +137,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[appengine.ListAuthorizedDomainsResponse]: + 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) -> AsyncIterable[domain.AuthorizedDomain]: + def __aiter__(self) -> AsyncIterator[domain.AuthorizedDomain]: async def async_generator(): async for page in self.pages: for response in page.domains: 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 478312d..24559ba 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.appengine_admin_v1.types import appengine @@ -75,14 +75,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[appengine.ListDomainMappingsResponse]: + 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) -> Iterable[domain_mapping.DomainMapping]: + def __iter__(self) -> Iterator[domain_mapping.DomainMapping]: for page in self.pages: yield from page.domain_mappings @@ -137,14 +137,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[appengine.ListDomainMappingsResponse]: + 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) -> AsyncIterable[domain_mapping.DomainMapping]: + def __aiter__(self) -> AsyncIterator[domain_mapping.DomainMapping]: async def async_generator(): async for page in self.pages: for response in page.domain_mappings: diff --git a/google/cloud/appengine_admin_v1/services/firewall/pagers.py b/google/cloud/appengine_admin_v1/services/firewall/pagers.py index 81f2787..9765510 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/pagers.py +++ b/google/cloud/appengine_admin_v1/services/firewall/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.appengine_admin_v1.types import appengine @@ -75,14 +75,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[appengine.ListIngressRulesResponse]: + 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) -> Iterable[firewall.FirewallRule]: + def __iter__(self) -> Iterator[firewall.FirewallRule]: for page in self.pages: yield from page.ingress_rules @@ -137,14 +137,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[appengine.ListIngressRulesResponse]: + 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) -> AsyncIterable[firewall.FirewallRule]: + def __aiter__(self) -> AsyncIterator[firewall.FirewallRule]: async def async_generator(): async for page in self.pages: for response in page.ingress_rules: diff --git a/google/cloud/appengine_admin_v1/services/instances/pagers.py b/google/cloud/appengine_admin_v1/services/instances/pagers.py index 44090c2..7ae59f3 100644 --- a/google/cloud/appengine_admin_v1/services/instances/pagers.py +++ b/google/cloud/appengine_admin_v1/services/instances/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.appengine_admin_v1.types import appengine @@ -75,14 +75,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[appengine.ListInstancesResponse]: + 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) -> Iterable[instance.Instance]: + def __iter__(self) -> Iterator[instance.Instance]: for page in self.pages: yield from page.instances @@ -137,14 +137,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[appengine.ListInstancesResponse]: + 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) -> AsyncIterable[instance.Instance]: + def __aiter__(self) -> AsyncIterator[instance.Instance]: async def async_generator(): async for page in self.pages: for response in page.instances: diff --git a/google/cloud/appengine_admin_v1/services/services/pagers.py b/google/cloud/appengine_admin_v1/services/services/pagers.py index 8d17bef..7754d18 100644 --- a/google/cloud/appengine_admin_v1/services/services/pagers.py +++ b/google/cloud/appengine_admin_v1/services/services/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.appengine_admin_v1.types import appengine @@ -75,14 +75,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[appengine.ListServicesResponse]: + 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) -> Iterable[service.Service]: + def __iter__(self) -> Iterator[service.Service]: for page in self.pages: yield from page.services @@ -137,14 +137,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[appengine.ListServicesResponse]: + 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) -> AsyncIterable[service.Service]: + def __aiter__(self) -> AsyncIterator[service.Service]: async def async_generator(): async for page in self.pages: for response in page.services: diff --git a/google/cloud/appengine_admin_v1/services/versions/pagers.py b/google/cloud/appengine_admin_v1/services/versions/pagers.py index 41cfb46..3417dbc 100644 --- a/google/cloud/appengine_admin_v1/services/versions/pagers.py +++ b/google/cloud/appengine_admin_v1/services/versions/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.appengine_admin_v1.types import appengine @@ -75,14 +75,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[appengine.ListVersionsResponse]: + 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) -> Iterable[version.Version]: + def __iter__(self) -> Iterator[version.Version]: for page in self.pages: yield from page.versions @@ -137,14 +137,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[appengine.ListVersionsResponse]: + 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) -> AsyncIterable[version.Version]: + def __aiter__(self) -> AsyncIterator[version.Version]: async def async_generator(): async for page in self.pages: for response in page.versions: From f34377c945216cd54fb3d3e7bb57111d77bcf31c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 15:06:13 +0000 Subject: [PATCH 053/185] chore: release 1.1.5 (#71) :robot: I have created a release \*beep\* \*boop\* --- ### [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e1622..7318cfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 8d829db..4900e94 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.1.4" +version = "1.1.5" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From b7349c595283868329d23a04d7101ecc3d5d29f5 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Oct 2021 11:00:53 -0400 Subject: [PATCH 054/185] chore: add default_version and codeowner_team to .repo-metadata.json (#72) * chore: add default_version and codeowner_team to .repo-metadata.json * set default_version to v1 --- .repo-metadata.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 5453494..b1fad72 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -9,5 +9,7 @@ "library_type": "GAPIC_AUTO", "repo": "googleapis/python-appengine-admin", "distribution_name": "google-cloud-appengine-admin", - "api_id": "appengine.googleapis.com" + "api_id": "appengine.googleapis.com", + "default_version": "v1", + "codeowner_team": "" } From 551a305ee700682908d678e21f9e68b43d4aba02 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 11:09:35 -0600 Subject: [PATCH 055/185] build: use trampoline_v2 for python samples and allow custom dockerfile (#73) Source-Link: https://github.com/googleapis/synthtool/commit/a7ed11ec0863c422ba2e73aafa75eab22c32b33d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6e7328583be8edd3ba8f35311c76a1ecbc823010279ccb6ab46b7a76e25eafcc Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/samples/lint/common.cfg | 2 +- .kokoro/samples/python3.6/common.cfg | 2 +- .kokoro/samples/python3.6/periodic.cfg | 2 +- .kokoro/samples/python3.7/common.cfg | 2 +- .kokoro/samples/python3.7/periodic.cfg | 2 +- .kokoro/samples/python3.8/common.cfg | 2 +- .kokoro/samples/python3.8/periodic.cfg | 2 +- .kokoro/samples/python3.9/common.cfg | 2 +- .kokoro/samples/python3.9/periodic.cfg | 2 +- .kokoro/test-samples-against-head.sh | 2 -- .kokoro/test-samples.sh | 2 -- .trampolinerc | 17 ++++++++++++++--- 13 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 2567653..ee94722 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a + digest: sha256:6e7328583be8edd3ba8f35311c76a1ecbc823010279ccb6ab46b7a76e25eafcc diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg index 218f83b..b8ac213 100644 --- a/.kokoro/samples/lint/common.cfg +++ b/.kokoro/samples/lint/common.cfg @@ -31,4 +31,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg index 4e83033..32d117a 100644 --- a/.kokoro/samples/python3.6/common.cfg +++ b/.kokoro/samples/python3.6/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.6/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.6/periodic.cfg +++ b/.kokoro/samples/python3.6/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg index 0eff37a..b9dc6a6 100644 --- a/.kokoro/samples/python3.7/common.cfg +++ b/.kokoro/samples/python3.7/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.7/periodic.cfg +++ b/.kokoro/samples/python3.7/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg index c8ebae1..ae2248d 100644 --- a/.kokoro/samples/python3.8/common.cfg +++ b/.kokoro/samples/python3.8/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.8/periodic.cfg +++ b/.kokoro/samples/python3.8/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg index 7ab162a..b12d923 100644 --- a/.kokoro/samples/python3.9/common.cfg +++ b/.kokoro/samples/python3.9/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-appengine-admin/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-appengine-admin/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.9/periodic.cfg +++ b/.kokoro/samples/python3.9/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh index f4d65ec..ba3a707 100755 --- a/.kokoro/test-samples-against-head.sh +++ b/.kokoro/test-samples-against-head.sh @@ -23,6 +23,4 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-appengine-admin - exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 0c68369..11c042d 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -24,8 +24,6 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-appengine-admin - # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then # preserving the test runner implementation. diff --git a/.trampolinerc b/.trampolinerc index 383b6ec..0eee72a 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -16,15 +16,26 @@ # Add required env vars here. required_envvars+=( - "STAGING_BUCKET" - "V2_STAGING_BUCKET" ) # Add env vars which are passed down into the container here. pass_down_envvars+=( + "NOX_SESSION" + ############### + # Docs builds + ############### "STAGING_BUCKET" "V2_STAGING_BUCKET" - "NOX_SESSION" + ################## + # 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. From 6f40451f86a8118f94374e1a0128a14710c4bd3a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 7 Oct 2021 18:12:56 +0000 Subject: [PATCH 056/185] chore(python): fix formatting issue in noxfile.py.j2 (#74) --- .github/.OwlBot.lock.yaml | 2 +- CONTRIBUTING.rst | 6 ++++-- noxfile.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ee94722..76d0baa 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6e7328583be8edd3ba8f35311c76a1ecbc823010279ccb6ab46b7a76e25eafcc + digest: sha256:4370ced27a324687ede5da07132dcdc5381993502a5e8a3e31e16dc631d026f0 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0ce1126..0799fc5 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 and 3.9 on both UNIX and Windows. + 3.6, 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 @@ -72,7 +72,7 @@ We use `nox `__ to instrument our tests. - To run a single unit test:: - $ nox -s unit-3.9 -- -k + $ nox -s unit-3.10 -- -k .. note:: @@ -225,11 +225,13 @@ We support: - `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/ +.. _Python 3.10: https://docs.python.org/3.10/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/noxfile.py b/noxfile.py index 93ea9b1..f885c68 100644 --- a/noxfile.py +++ b/noxfile.py @@ -29,7 +29,7 @@ DEFAULT_PYTHON_VERSION = "3.8" SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() From e5d86eef07ee05454135b5b392a6841f7932a303 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 14:22:12 +0000 Subject: [PATCH 057/185] feat: add context manager support in client (#75) - [ ] Regenerate this pull request now. chore: fix docstring for first attribute of protos committer: @busunkim96 PiperOrigin-RevId: 401271153 Source-Link: https://github.com/googleapis/googleapis/commit/787f8c9a731f44e74a90b9847d48659ca9462d10 Source-Link: https://github.com/googleapis/googleapis-gen/commit/81decffe9fc72396a8153e756d1d67a6eecfd620 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODFkZWNmZmU5ZmM3MjM5NmE4MTUzZTc1NmQxZDY3YTZlZWNmZDYyMCJ9 --- .../services/applications/async_client.py | 6 +++ .../services/applications/client.py | 18 +++++-- .../services/applications/transports/base.py | 9 ++++ .../services/applications/transports/grpc.py | 3 ++ .../applications/transports/grpc_asyncio.py | 3 ++ .../authorized_certificates/async_client.py | 6 +++ .../authorized_certificates/client.py | 18 +++++-- .../transports/base.py | 9 ++++ .../transports/grpc.py | 3 ++ .../transports/grpc_asyncio.py | 3 ++ .../authorized_domains/async_client.py | 6 +++ .../services/authorized_domains/client.py | 18 +++++-- .../authorized_domains/transports/base.py | 9 ++++ .../authorized_domains/transports/grpc.py | 3 ++ .../transports/grpc_asyncio.py | 3 ++ .../services/domain_mappings/async_client.py | 6 +++ .../services/domain_mappings/client.py | 18 +++++-- .../domain_mappings/transports/base.py | 9 ++++ .../domain_mappings/transports/grpc.py | 3 ++ .../transports/grpc_asyncio.py | 3 ++ .../services/firewall/async_client.py | 6 +++ .../services/firewall/client.py | 18 +++++-- .../services/firewall/transports/base.py | 9 ++++ .../services/firewall/transports/grpc.py | 3 ++ .../firewall/transports/grpc_asyncio.py | 3 ++ .../services/instances/async_client.py | 6 +++ .../services/instances/client.py | 18 +++++-- .../services/instances/transports/base.py | 9 ++++ .../services/instances/transports/grpc.py | 3 ++ .../instances/transports/grpc_asyncio.py | 3 ++ .../services/services/async_client.py | 6 +++ .../services/services/client.py | 18 +++++-- .../services/services/transports/base.py | 9 ++++ .../services/services/transports/grpc.py | 3 ++ .../services/transports/grpc_asyncio.py | 3 ++ .../services/versions/async_client.py | 6 +++ .../services/versions/client.py | 18 +++++-- .../services/versions/transports/base.py | 9 ++++ .../services/versions/transports/grpc.py | 3 ++ .../versions/transports/grpc_asyncio.py | 3 ++ .../appengine_admin_v1/types/app_yaml.py | 2 + .../appengine_admin_v1/types/appengine.py | 36 +++++++++++++ .../appengine_admin_v1/types/application.py | 1 + .../appengine_admin_v1/types/audit_data.py | 3 ++ .../appengine_admin_v1/types/certificate.py | 2 + .../cloud/appengine_admin_v1/types/deploy.py | 1 + .../types/domain_mapping.py | 3 ++ .../appengine_admin_v1/types/instance.py | 3 +- .../cloud/appengine_admin_v1/types/version.py | 5 ++ .../appengine_admin_v1/test_applications.py | 50 +++++++++++++++++++ .../test_authorized_certificates.py | 50 +++++++++++++++++++ .../test_authorized_domains.py | 50 +++++++++++++++++++ .../test_domain_mappings.py | 50 +++++++++++++++++++ .../gapic/appengine_admin_v1/test_firewall.py | 50 +++++++++++++++++++ .../appengine_admin_v1/test_instances.py | 50 +++++++++++++++++++ .../gapic/appengine_admin_v1/test_services.py | 50 +++++++++++++++++++ .../gapic/appengine_admin_v1/test_versions.py | 50 +++++++++++++++++++ 57 files changed, 735 insertions(+), 33 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 29ffd86..d7535b3 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -406,6 +406,12 @@ async def repair_application( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index b43da0c..79ad4fc 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -330,10 +330,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def get_application( @@ -587,6 +584,19 @@ def repair_application( # Done; return the response. return response + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 91338b9..5aaa063 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -175,6 +175,15 @@ def _prep_wrapped_messages(self, 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) -> operations_v1.OperationsClient: """Return the client designed to process long-running operations.""" 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 7e79a41..352667e 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -373,5 +373,8 @@ def repair_application( ) return self._stubs["repair_application"] + def close(self): + self.grpc_channel.close() + __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 index 1a03ec4..7c448e9 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 @@ -386,5 +386,8 @@ def repair_application( ) return self._stubs["repair_application"] + def close(self): + return self.grpc_channel.close() + __all__ = ("ApplicationsGrpcAsyncIOTransport",) 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 1110e38..b10fbf9 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 @@ -429,6 +429,12 @@ async def delete_authorized_certificate( request, retry=retry, timeout=timeout, metadata=metadata, ) + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 02be3a5..940b3ca 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -335,10 +335,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_authorized_certificates( @@ -618,6 +615,19 @@ def delete_authorized_certificate( request, retry=retry, timeout=timeout, metadata=metadata, ) + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 1ae962d..c467d95 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 @@ -187,6 +187,15 @@ def _prep_wrapped_messages(self, 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, 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 8f86bf8..58098d4 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 @@ -382,5 +382,8 @@ def delete_authorized_certificate( ) return self._stubs["delete_authorized_certificate"] + def close(self): + self.grpc_channel.close() + __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 index 9b0d7ea..5999184 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 @@ -388,5 +388,8 @@ def delete_authorized_certificate( ) 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_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index cba0655..5665df4 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 @@ -222,6 +222,12 @@ async def list_authorized_domains( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 4d16281..bffcce0 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -334,10 +334,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_authorized_domains( @@ -400,6 +397,19 @@ def list_authorized_domains( # Done; return the response. return response + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 22ebc61..fd3ab73 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 @@ -165,6 +165,15 @@ def _prep_wrapped_messages(self, 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, 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 5095922..34be2b1 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 @@ -257,5 +257,8 @@ def list_authorized_domains( ) return self._stubs["list_authorized_domains"] + def close(self): + self.grpc_channel.close() + __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 index f06afc5..97dd4da 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 @@ -260,5 +260,8 @@ def list_authorized_domains( ) 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/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 7bd11b6..2d07ccc 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 @@ -469,6 +469,12 @@ async def delete_domain_mapping( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 a3c7a4c..5182ceb 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -333,10 +333,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_domain_mappings( @@ -649,6 +646,19 @@ def delete_domain_mapping( # Done; return the response. return response + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 b11cc15..9c8a596 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 @@ -186,6 +186,15 @@ def _prep_wrapped_messages(self, 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) -> operations_v1.OperationsClient: """Return the client designed to process long-running operations.""" 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 1f89b60..5eaac3e 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 @@ -384,5 +384,8 @@ def delete_domain_mapping( ) return self._stubs["delete_domain_mapping"] + def close(self): + self.grpc_channel.close() + __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 index 46bb973..9ba3f67 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 @@ -398,5 +398,8 @@ def delete_domain_mapping( ) 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/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index fe8786f..69b4196 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -468,6 +468,12 @@ async def delete_ingress_rule( request, retry=retry, timeout=timeout, metadata=metadata, ) + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index b15645d..6e5ef6c 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -338,10 +338,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_ingress_rules( @@ -657,6 +654,19 @@ def delete_ingress_rule( request, retry=retry, timeout=timeout, metadata=metadata, ) + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 04b20ea..a9bcf9c 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -182,6 +182,15 @@ def _prep_wrapped_messages(self, 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, 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 1809e0b..7dc0324 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -404,5 +404,8 @@ def delete_ingress_rule( ) return self._stubs["delete_ingress_rule"] + def close(self): + self.grpc_channel.close() + __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 index 75a7250..ab20af5 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 @@ -412,5 +412,8 @@ def delete_ingress_rule( ) 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/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 9033e01..ec2e849 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -424,6 +424,12 @@ async def debug_instance( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index aa6f6f5..d937126 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -348,10 +348,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_instances( @@ -621,6 +618,19 @@ def debug_instance( # Done; return the response. return response + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 af17f3d..6903d56 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -175,6 +175,15 @@ def _prep_wrapped_messages(self, 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) -> operations_v1.OperationsClient: """Return the client designed to process long-running operations.""" 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 7252c39..2fa6b60 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -374,5 +374,8 @@ def debug_instance( ) return self._stubs["debug_instance"] + def close(self): + self.grpc_channel.close() + __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 index 4825fdc..5f84080 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 @@ -385,5 +385,8 @@ def debug_instance( ) return self._stubs["debug_instance"] + def close(self): + return self.grpc_channel.close() + __all__ = ("InstancesGrpcAsyncIOTransport",) 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 56ef3f9..5880026 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -411,6 +411,12 @@ async def delete_service( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index bc61a0a..dcaecca 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -332,10 +332,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_services( @@ -596,6 +593,19 @@ def delete_service( # Done; return the response. return response + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 a276406..2a637c9 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -175,6 +175,15 @@ def _prep_wrapped_messages(self, 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) -> operations_v1.OperationsClient: """Return the client designed to process long-running operations.""" 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 6225fc5..e4df27f 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -347,5 +347,8 @@ def delete_service( ) return self._stubs["delete_service"] + def close(self): + self.grpc_channel.close() + __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 index b479e83..af666f0 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 @@ -360,5 +360,8 @@ def delete_service( ) return self._stubs["delete_service"] + def close(self): + return self.grpc_channel.close() + __all__ = ("ServicesGrpcAsyncIOTransport",) 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 3d1a81e..f0a057f 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -492,6 +492,12 @@ async def delete_version( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 2d3fe2d..a8a5cb4 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -335,10 +335,7 @@ def __init__( 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=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def list_versions( @@ -678,6 +675,19 @@ def delete_version( # Done; return the response. return response + def __enter__(self): + 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() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 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 03f11cd..883d0eb 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -178,6 +178,15 @@ def _prep_wrapped_messages(self, 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) -> operations_v1.OperationsClient: """Return the client designed to process long-running operations.""" 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 9abe8a4..8b61c61 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -408,5 +408,8 @@ def delete_version( ) return self._stubs["delete_version"] + def close(self): + self.grpc_channel.close() + __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 index 52a24e5..1ada908 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 @@ -423,5 +423,8 @@ def delete_version( ) return self._stubs["delete_version"] + def close(self): + return self.grpc_channel.close() + __all__ = ("VersionsGrpcAsyncIOTransport",) diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 9c7f879..f6acd01 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -93,6 +93,7 @@ class ApiConfigHandler(proto.Message): 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. @@ -246,6 +247,7 @@ class ScriptHandler(proto.Message): class ApiEndpointHandler(proto.Message): r"""Uses Google Cloud Endpoints to handle requests. + Attributes: script_path (str): Path to the script from the application root diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index e50ef77..3c04ecd 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -103,6 +103,7 @@ class DomainOverrideStrategy(proto.Enum): class GetApplicationRequest(proto.Message): r"""Request message for ``Applications.GetApplication``. + Attributes: name (str): Name of the Application resource to get. Example: @@ -114,6 +115,7 @@ class GetApplicationRequest(proto.Message): class CreateApplicationRequest(proto.Message): r"""Request message for ``Applications.CreateApplication``. + Attributes: application (google.cloud.appengine_admin_v1.types.Application): Application configuration. @@ -126,6 +128,7 @@ class CreateApplicationRequest(proto.Message): class UpdateApplicationRequest(proto.Message): r"""Request message for ``Applications.UpdateApplication``. + Attributes: name (str): Name of the Application resource to update. Example: @@ -149,6 +152,7 @@ class UpdateApplicationRequest(proto.Message): class RepairApplicationRequest(proto.Message): r"""Request message for 'Applications.RepairApplication'. + Attributes: name (str): Name of the application to repair. Example: ``apps/myapp`` @@ -159,6 +163,7 @@ class RepairApplicationRequest(proto.Message): class ListServicesRequest(proto.Message): r"""Request message for ``Services.ListServices``. + Attributes: parent (str): Name of the parent Application resource. Example: @@ -177,6 +182,7 @@ class ListServicesRequest(proto.Message): class ListServicesResponse(proto.Message): r"""Response message for ``Services.ListServices``. + Attributes: services (Sequence[google.cloud.appengine_admin_v1.types.Service]): The services belonging to the requested @@ -196,6 +202,7 @@ def raw_page(self): class GetServiceRequest(proto.Message): r"""Request message for ``Services.GetService``. + Attributes: name (str): Name of the resource requested. Example: @@ -207,6 +214,7 @@ class GetServiceRequest(proto.Message): class UpdateServiceRequest(proto.Message): r"""Request message for ``Services.UpdateService``. + Attributes: name (str): Name of the resource to update. Example: @@ -245,6 +253,7 @@ class UpdateServiceRequest(proto.Message): class DeleteServiceRequest(proto.Message): r"""Request message for ``Services.DeleteService``. + Attributes: name (str): Name of the resource requested. Example: @@ -256,6 +265,7 @@ class DeleteServiceRequest(proto.Message): class ListVersionsRequest(proto.Message): r"""Request message for ``Versions.ListVersions``. + Attributes: parent (str): Name of the parent Service resource. Example: @@ -278,6 +288,7 @@ class ListVersionsRequest(proto.Message): class ListVersionsResponse(proto.Message): r"""Response message for ``Versions.ListVersions``. + Attributes: versions (Sequence[google.cloud.appengine_admin_v1.types.Version]): The versions belonging to the requested @@ -297,6 +308,7 @@ def raw_page(self): class GetVersionRequest(proto.Message): r"""Request message for ``Versions.GetVersion``. + Attributes: name (str): Name of the resource requested. Example: @@ -311,6 +323,7 @@ class GetVersionRequest(proto.Message): class CreateVersionRequest(proto.Message): r"""Request message for ``Versions.CreateVersion``. + Attributes: parent (str): Name of the parent resource to create this version under. @@ -325,6 +338,7 @@ class CreateVersionRequest(proto.Message): class UpdateVersionRequest(proto.Message): r"""Request message for ``Versions.UpdateVersion``. + Attributes: name (str): Name of the resource to update. Example: @@ -347,6 +361,7 @@ class UpdateVersionRequest(proto.Message): class DeleteVersionRequest(proto.Message): r"""Request message for ``Versions.DeleteVersion``. + Attributes: name (str): Name of the resource requested. Example: @@ -358,6 +373,7 @@ class DeleteVersionRequest(proto.Message): class ListInstancesRequest(proto.Message): r"""Request message for ``Instances.ListInstances``. + Attributes: parent (str): Name of the parent Version resource. Example: @@ -376,6 +392,7 @@ class ListInstancesRequest(proto.Message): class ListInstancesResponse(proto.Message): r"""Response message for ``Instances.ListInstances``. + Attributes: instances (Sequence[google.cloud.appengine_admin_v1.types.Instance]): The instances belonging to the requested @@ -395,6 +412,7 @@ def raw_page(self): class GetInstanceRequest(proto.Message): r"""Request message for ``Instances.GetInstance``. + Attributes: name (str): Name of the resource requested. Example: @@ -406,6 +424,7 @@ class GetInstanceRequest(proto.Message): class DeleteInstanceRequest(proto.Message): r"""Request message for ``Instances.DeleteInstance``. + Attributes: name (str): Name of the resource requested. Example: @@ -417,6 +436,7 @@ class DeleteInstanceRequest(proto.Message): class DebugInstanceRequest(proto.Message): r"""Request message for ``Instances.DebugInstance``. + Attributes: name (str): Name of the resource requested. Example: @@ -437,6 +457,7 @@ class DebugInstanceRequest(proto.Message): class ListIngressRulesRequest(proto.Message): r"""Request message for ``Firewall.ListIngressRules``. + Attributes: parent (str): Name of the Firewall collection to retrieve. Example: @@ -461,6 +482,7 @@ class ListIngressRulesRequest(proto.Message): class ListIngressRulesResponse(proto.Message): r"""Response message for ``Firewall.ListIngressRules``. + Attributes: ingress_rules (Sequence[google.cloud.appengine_admin_v1.types.FirewallRule]): The ingress FirewallRules for this @@ -482,6 +504,7 @@ def raw_page(self): class BatchUpdateIngressRulesRequest(proto.Message): r"""Request message for ``Firewall.BatchUpdateIngressRules``. + Attributes: name (str): Name of the Firewall collection to set. Example: @@ -499,6 +522,7 @@ class BatchUpdateIngressRulesRequest(proto.Message): class BatchUpdateIngressRulesResponse(proto.Message): r"""Response message for ``Firewall.UpdateAllIngressRules``. + Attributes: ingress_rules (Sequence[google.cloud.appengine_admin_v1.types.FirewallRule]): The full list of ingress FirewallRules for @@ -512,6 +536,7 @@ class BatchUpdateIngressRulesResponse(proto.Message): class CreateIngressRuleRequest(proto.Message): r"""Request message for ``Firewall.CreateIngressRule``. + Attributes: parent (str): Name of the parent Firewall collection in which to create a @@ -537,6 +562,7 @@ class CreateIngressRuleRequest(proto.Message): class GetIngressRuleRequest(proto.Message): r"""Request message for ``Firewall.GetIngressRule``. + Attributes: name (str): Name of the Firewall resource to retrieve. Example: @@ -548,6 +574,7 @@ class GetIngressRuleRequest(proto.Message): class UpdateIngressRuleRequest(proto.Message): r"""Request message for ``Firewall.UpdateIngressRule``. + Attributes: name (str): Name of the Firewall resource to update. Example: @@ -569,6 +596,7 @@ class UpdateIngressRuleRequest(proto.Message): class DeleteIngressRuleRequest(proto.Message): r"""Request message for ``Firewall.DeleteIngressRule``. + Attributes: name (str): Name of the Firewall resource to delete. Example: @@ -580,6 +608,7 @@ class DeleteIngressRuleRequest(proto.Message): class ListAuthorizedDomainsRequest(proto.Message): r"""Request message for ``AuthorizedDomains.ListAuthorizedDomains``. + Attributes: parent (str): Name of the parent Application resource. Example: @@ -598,6 +627,7 @@ class ListAuthorizedDomainsRequest(proto.Message): class ListAuthorizedDomainsResponse(proto.Message): r"""Response message for ``AuthorizedDomains.ListAuthorizedDomains``. + Attributes: domains (Sequence[google.cloud.appengine_admin_v1.types.AuthorizedDomain]): The authorized domains belonging to the user. @@ -738,6 +768,7 @@ class DeleteAuthorizedCertificateRequest(proto.Message): class ListDomainMappingsRequest(proto.Message): r"""Request message for ``DomainMappings.ListDomainMappings``. + Attributes: parent (str): Name of the parent Application resource. Example: @@ -756,6 +787,7 @@ class ListDomainMappingsRequest(proto.Message): class ListDomainMappingsResponse(proto.Message): r"""Response message for ``DomainMappings.ListDomainMappings``. + Attributes: domain_mappings (Sequence[google.cloud.appengine_admin_v1.types.DomainMapping]): The domain mappings for the application. @@ -776,6 +808,7 @@ def raw_page(self): class GetDomainMappingRequest(proto.Message): r"""Request message for ``DomainMappings.GetDomainMapping``. + Attributes: name (str): Name of the resource requested. Example: @@ -787,6 +820,7 @@ class GetDomainMappingRequest(proto.Message): class CreateDomainMappingRequest(proto.Message): r"""Request message for ``DomainMappings.CreateDomainMapping``. + Attributes: parent (str): Name of the parent Application resource. Example: @@ -810,6 +844,7 @@ class CreateDomainMappingRequest(proto.Message): class UpdateDomainMappingRequest(proto.Message): r"""Request message for ``DomainMappings.UpdateDomainMapping``. + Attributes: name (str): Name of the resource to update. Example: @@ -834,6 +869,7 @@ class UpdateDomainMappingRequest(proto.Message): class DeleteDomainMappingRequest(proto.Message): r"""Request message for ``DomainMappings.DeleteDomainMapping``. + Attributes: name (str): Name of the resource to delete. Example: diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index 89ee559..47022cf 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -110,6 +110,7 @@ class DatabaseType(proto.Enum): class IdentityAwareProxy(proto.Message): r"""Identity-Aware Proxy + Attributes: enabled (bool): Whether the serving infrastructure will authenticate and diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index c99e43a..eb59c60 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -26,6 +26,7 @@ class AuditData(proto.Message): r"""App Engine admin service audit log. + Attributes: update_service (google.cloud.appengine_admin_v1.types.UpdateServiceMethod): Detailed information about UpdateService @@ -45,6 +46,7 @@ class AuditData(proto.Message): class UpdateServiceMethod(proto.Message): r"""Detailed information about UpdateService call. + Attributes: request (google.cloud.appengine_admin_v1.types.UpdateServiceRequest): Update service request. @@ -57,6 +59,7 @@ class UpdateServiceMethod(proto.Message): class CreateVersionMethod(proto.Message): r"""Detailed information about CreateVersion call. + Attributes: request (google.cloud.appengine_admin_v1.types.CreateVersionRequest): Create version request. diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index 4d28039..cd20a74 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -131,6 +131,7 @@ class AuthorizedCertificate(proto.Message): 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 @@ -167,6 +168,7 @@ class CertificateRawData(proto.Message): 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 diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index 6345d8f..0013251 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -132,6 +132,7 @@ class CloudBuildOptions(proto.Message): 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 diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index bfa48da..68f1188 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -24,6 +24,7 @@ class DomainMapping(proto.Message): r"""A domain serving an App Engine application. + Attributes: name (str): Full path to the ``DomainMapping`` resource in the API. @@ -55,6 +56,7 @@ class DomainMapping(proto.Message): class SslSettings(proto.Message): r"""SSL configuration for a ``DomainMapping`` resource. + Attributes: certificate_id (str): ID of the ``AuthorizedCertificate`` resource configuring SSL @@ -100,6 +102,7 @@ class SslManagementType(proto.Enum): class ResourceRecord(proto.Message): r"""A DNS resource record. + Attributes: name (str): Relative name of the object affected by this record. Only diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index 2311bb9..2c7c779 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -93,7 +93,8 @@ class Availability(proto.Enum): DYNAMIC = 2 class Liveness(proto.Message): - r"""Wrapper for LivenessState enum. """ + r"""Wrapper for LivenessState enum. + """ class LivenessState(proto.Enum): r"""Liveness health check status for Flex instances.""" diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index c475063..f1d353f 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -488,6 +488,7 @@ class ManualScaling(proto.Message): 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 @@ -562,6 +563,7 @@ class NetworkUtilization(proto.Message): class StandardSchedulerSettings(proto.Message): r"""Scheduler settings for standard environment. + Attributes: target_cpu_utilization (float): Target CPU utilization ratio to maintain when @@ -657,6 +659,7 @@ class Volume(proto.Message): class Resources(proto.Message): r"""Machine resources for a version. + Attributes: cpu (float): Number of CPU cores needed. @@ -681,6 +684,7 @@ class Resources(proto.Message): class VpcAccessConnector(proto.Message): r"""VPC access connector specification. + Attributes: name (str): Full Serverless VPC Access Connector name @@ -693,6 +697,7 @@ class VpcAccessConnector(proto.Message): class Entrypoint(proto.Message): r"""The entrypoint for the application. + Attributes: shell (str): The format should be a shell command that can be fed to diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index fbea8f0..7c034b5 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -32,6 +32,7 @@ from google.api_core import grpc_helpers_async from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.applications import ( @@ -1137,6 +1138,9 @@ def test_applications_base_transport(): 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): @@ -1643,3 +1647,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() 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 a8d1ccd..6de2281 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -29,6 +29,7 @@ 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 from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.authorized_certificates import ( @@ -1618,6 +1619,9 @@ def test_authorized_certificates_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_authorized_certificates_base_transport_with_credentials_file(): @@ -2108,3 +2112,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() 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 773df28..4d570ea 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -29,6 +29,7 @@ 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 from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.authorized_domains import ( @@ -909,6 +910,9 @@ def test_authorized_domains_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_authorized_domains_base_transport_with_credentials_file(): @@ -1395,3 +1399,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() 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 39edd26..9a13770 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -32,6 +32,7 @@ from google.api_core import grpc_helpers_async from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.domain_mappings import ( @@ -1504,6 +1505,9 @@ def test_domain_mappings_base_transport(): 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): @@ -2021,3 +2025,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index ccbc861..b60e491 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -29,6 +29,7 @@ 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 from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.firewall import FirewallAsyncClient @@ -1611,6 +1612,9 @@ def test_firewall_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_firewall_base_transport_with_credentials_file(): @@ -2080,3 +2084,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index d82988f..d51b0a8 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -32,6 +32,7 @@ from google.api_core import grpc_helpers_async from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.instances import InstancesAsyncClient @@ -1313,6 +1314,9 @@ def test_instances_base_transport(): 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): @@ -1839,3 +1843,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 4f78a14..168aded 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -32,6 +32,7 @@ from google.api_core import grpc_helpers_async from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.services import ServicesAsyncClient @@ -1222,6 +1223,9 @@ def test_services_base_transport(): 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): @@ -1722,3 +1726,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index f47e621..84a0499 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -32,6 +32,7 @@ from google.api_core import grpc_helpers_async from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.appengine_admin_v1.services.versions import VersionsAsyncClient @@ -1433,6 +1434,9 @@ def test_versions_base_transport(): 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): @@ -1933,3 +1937,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): 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 = { + "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 = [ + "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() From bd2d3ca604123a2d1d10be1cad7d2a4571188c92 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 17:16:17 +0000 Subject: [PATCH 058/185] chore(python): Add kokoro configs for python 3.10 samples testing (#76) --- .github/.OwlBot.lock.yaml | 2 +- .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 +++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .kokoro/samples/python3.10/common.cfg create mode 100644 .kokoro/samples/python3.10/continuous.cfg create mode 100644 .kokoro/samples/python3.10/periodic-head.cfg create mode 100644 .kokoro/samples/python3.10/periodic.cfg create mode 100644 .kokoro/samples/python3.10/presubmit.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 76d0baa..7d98291 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4370ced27a324687ede5da07132dcdc5381993502a5e8a3e31e16dc631d026f0 + digest: sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b diff --git a/.kokoro/samples/python3.10/common.cfg b/.kokoro/samples/python3.10/common.cfg new file mode 100644 index 0000000..0ed8714 --- /dev/null +++ b/.kokoro/samples/python3.10/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.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 new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.10/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.10/periodic-head.cfg b/.kokoro/samples/python3.10/periodic-head.cfg new file mode 100644 index 0000000..302c7b0 --- /dev/null +++ b/.kokoro/samples/python3.10/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.10/periodic.cfg b/.kokoro/samples/python3.10/periodic.cfg new file mode 100644 index 0000000..71cd1e5 --- /dev/null +++ b/.kokoro/samples/python3.10/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.10/presubmit.cfg b/.kokoro/samples/python3.10/presubmit.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.10/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 From e915580dd5e66a4d44cede94acfde0e181e9fe3a Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 11 Oct 2021 11:54:40 -0400 Subject: [PATCH 059/185] feat: add trove classifier for python 3.10 (#78) --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 4900e94..e763bb6 100644 --- a/setup.py +++ b/setup.py @@ -67,6 +67,8 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules", ], From e6191d5db6df40b17752e46cb4a54ac9ea12d97b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 11 Oct 2021 10:44:23 -0600 Subject: [PATCH 060/185] chore: release 1.2.0 (#77) 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 7318cfd..83b5bdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [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) diff --git a/setup.py b/setup.py index e763bb6..d53a40e 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.1.5" +version = "1.2.0" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From aa7e283a2a640be2641fcf64e32a5d0986ff57f8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Oct 2021 12:46:02 -0400 Subject: [PATCH 061/185] chore(python): modify templated noxfile to support non-cloud APIs (#80) Source-Link: https://github.com/googleapis/synthtool/commit/76d5fec7a9e77a12c28654b333103578623a0c1b Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:979d9498e07c50097c1aeda937dcd32094ecc7440278a83e832b6a05602f62b6 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- noxfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7d98291..4423944 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b + digest: sha256:979d9498e07c50097c1aeda937dcd32094ecc7440278a83e832b6a05602f62b6 diff --git a/noxfile.py b/noxfile.py index f885c68..de41c6b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -101,7 +101,7 @@ def default(session): "py.test", "--quiet", f"--junitxml=unit_{session.python}_sponge_log.xml", - "--cov=google/cloud", + "--cov=google", "--cov=tests/unit", "--cov-append", "--cov-config=.coveragerc", From e54d2ae411f070e75f30b03b269d16a75a51cac3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 17:02:07 -0400 Subject: [PATCH 062/185] chore(python): push cloud library docs to staging bucket for Cloud RAD (#82) Source-Link: https://github.com/googleapis/synthtool/commit/7fd61f8efae782a7cfcecc599faf52f9737fe584 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:4ee57a76a176ede9087c14330c625a71553cf9c72828b2c0ca12f5338171ba60 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/docs/common.cfg | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 4423944..108063d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:979d9498e07c50097c1aeda937dcd32094ecc7440278a83e832b6a05602f62b6 + digest: sha256:4ee57a76a176ede9087c14330c625a71553cf9c72828b2c0ca12f5338171ba60 diff --git a/.kokoro/docs/common.cfg b/.kokoro/docs/common.cfg index 5f1c114..7437bef 100644 --- a/.kokoro/docs/common.cfg +++ b/.kokoro/docs/common.cfg @@ -30,6 +30,7 @@ env_vars: { env_vars: { key: "V2_STAGING_BUCKET" + # Push google cloud library docs to the Cloud RAD bucket `docs-staging-v2` value: "docs-staging-v2" } From 446e301ab0408b8d1d567be6f7e2ec8bf7626fc9 Mon Sep 17 00:00:00 2001 From: nicain Date: Mon, 25 Oct 2021 14:12:16 -0700 Subject: [PATCH 063/185] chore: Remove master branch reference (#81) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #64 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 # 🦕 --- docs/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.rst b/docs/README.rst index b2f5998..f3166e3 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -9,7 +9,7 @@ Python Client for App Engine Admin - `Product Documentation`_ .. |beta| image:: https://img.shields.io/badge/support-beta-orange.svg - :target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#beta-support + :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 @@ -79,4 +79,4 @@ Next Steps 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/master/README.rst +.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst From fd7fdd7f7ef666f1c9ff64ac27f98b4573a5d1f3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 15:12:11 +0000 Subject: [PATCH 064/185] chore: use gapic-generator-python 0.53.4 (#83) - [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: https://github.com/googleapis/googleapis/commit/83d81b0c8fc22291a13398d6d77f02dc97a5b6f4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9 --- .../services/applications/async_client.py | 28 ++--- .../services/applications/client.py | 10 +- .../services/applications/transports/base.py | 37 +------ .../services/applications/transports/grpc.py | 2 +- .../applications/transports/grpc_asyncio.py | 3 +- .../authorized_certificates/async_client.py | 34 +++--- .../authorized_certificates/client.py | 12 +- .../transports/base.py | 35 +----- .../transports/grpc_asyncio.py | 1 - .../authorized_domains/async_client.py | 10 +- .../services/authorized_domains/client.py | 4 +- .../authorized_domains/transports/base.py | 35 +----- .../transports/grpc_asyncio.py | 1 - .../services/domain_mappings/async_client.py | 34 +++--- .../services/domain_mappings/client.py | 12 +- .../domain_mappings/transports/base.py | 37 +------ .../domain_mappings/transports/grpc.py | 2 +- .../transports/grpc_asyncio.py | 3 +- .../services/firewall/async_client.py | 40 +++---- .../services/firewall/client.py | 14 ++- .../services/firewall/transports/base.py | 35 +----- .../firewall/transports/grpc_asyncio.py | 1 - .../services/instances/async_client.py | 28 ++--- .../services/instances/client.py | 10 +- .../services/instances/transports/base.py | 37 +------ .../services/instances/transports/grpc.py | 2 +- .../instances/transports/grpc_asyncio.py | 3 +- .../services/services/async_client.py | 28 ++--- .../services/services/client.py | 10 +- .../services/services/transports/base.py | 37 +------ .../services/services/transports/grpc.py | 2 +- .../services/transports/grpc_asyncio.py | 3 +- .../services/versions/async_client.py | 34 +++--- .../services/versions/client.py | 12 +- .../services/versions/transports/base.py | 37 +------ .../services/versions/transports/grpc.py | 2 +- .../versions/transports/grpc_asyncio.py | 3 +- .../appengine_admin_v1/types/app_yaml.py | 10 ++ .../appengine_admin_v1/types/audit_data.py | 9 ++ .../appengine_admin_v1/types/operation.py | 4 + .../cloud/appengine_admin_v1/types/version.py | 13 +++ setup.py | 3 +- testing/constraints-3.6.txt | 3 +- .../appengine_admin_v1/test_applications.py | 103 ++---------------- .../test_authorized_certificates.py | 103 ++---------------- .../test_authorized_domains.py | 103 ++---------------- .../test_domain_mappings.py | 103 ++---------------- .../gapic/appengine_admin_v1/test_firewall.py | 100 ++--------------- .../appengine_admin_v1/test_instances.py | 100 ++--------------- .../gapic/appengine_admin_v1/test_services.py | 100 ++--------------- .../gapic/appengine_admin_v1/test_versions.py | 100 ++--------------- 51 files changed, 309 insertions(+), 1183 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 d7535b3..081746a 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -161,16 +163,16 @@ def __init__( async def get_application( self, - request: appengine.GetApplicationRequest = None, + request: Union[appengine.GetApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> application.Application: r"""Gets information about an application. Args: - request (:class:`google.cloud.appengine_admin_v1.types.GetApplicationRequest`): + request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]): The request object. Request message for `Applications.GetApplication`. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -211,9 +213,9 @@ async def get_application( async def create_application( self, - request: appengine.CreateApplicationRequest = None, + request: Union[appengine.CreateApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -230,7 +232,7 @@ async def create_application( Billing `__. Args: - request (:class:`google.cloud.appengine_admin_v1.types.CreateApplicationRequest`): + 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, @@ -274,9 +276,9 @@ async def create_application( async def update_application( self, - request: appengine.UpdateApplicationRequest = None, + request: Union[appengine.UpdateApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -289,7 +291,7 @@ async def update_application( the application. Args: - request (:class:`google.cloud.appengine_admin_v1.types.UpdateApplicationRequest`): + 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, @@ -339,9 +341,9 @@ async def update_application( async def repair_application( self, - request: appengine.RepairApplicationRequest = None, + request: Union[appengine.RepairApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -358,7 +360,7 @@ async def repair_application( Cloud Console Activity Log. Args: - request (:class:`google.cloud.appengine_admin_v1.types.RepairApplicationRequest`): + 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, diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 79ad4fc..9de6bd9 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -337,7 +339,7 @@ def get_application( self, request: Union[appengine.GetApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> application.Application: @@ -388,7 +390,7 @@ def create_application( self, request: Union[appengine.CreateApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -452,7 +454,7 @@ def update_application( self, request: Union[appengine.UpdateApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -518,7 +520,7 @@ def repair_application( self, request: Union[appengine.RepairApplicationRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: 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 5aaa063..51e5281 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -40,15 +39,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class ApplicationsTransport(abc.ABC): """Abstract transport class for Applications.""" @@ -102,7 +92,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -135,29 +125,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -185,7 +152,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() 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 352667e..d40eab7 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -113,7 +113,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 7c448e9..141ebf1 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 @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore @@ -160,7 +159,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 b10fbf9..a63f1eb 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 @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -169,9 +171,9 @@ def __init__( async def list_authorized_certificates( self, - request: appengine.ListAuthorizedCertificatesRequest = None, + request: Union[appengine.ListAuthorizedCertificatesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedCertificatesAsyncPager: @@ -179,7 +181,7 @@ async def list_authorized_certificates( administer. Args: - request (:class:`google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest`): + 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, @@ -228,16 +230,16 @@ async def list_authorized_certificates( async def get_authorized_certificate( self, - request: appengine.GetAuthorizedCertificateRequest = None, + request: Union[appengine.GetAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. Args: - request (:class:`google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest`): + 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, @@ -280,16 +282,16 @@ async def get_authorized_certificate( async def create_authorized_certificate( self, - request: appengine.CreateAuthorizedCertificateRequest = None, + request: Union[appengine.CreateAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. Args: - request (:class:`google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest`): + 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, @@ -332,9 +334,9 @@ async def create_authorized_certificate( async def update_authorized_certificate( self, - request: appengine.UpdateAuthorizedCertificateRequest = None, + request: Union[appengine.UpdateAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: @@ -346,7 +348,7 @@ async def update_authorized_certificate( updated. Args: - request (:class:`google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest`): + 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, @@ -389,16 +391,16 @@ async def update_authorized_certificate( async def delete_authorized_certificate( self, - request: appengine.DeleteAuthorizedCertificateRequest = None, + request: Union[appengine.DeleteAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified SSL certificate. Args: - request (:class:`google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest`): + 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, 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 940b3ca..02b3c8c 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -342,7 +344,7 @@ def list_authorized_certificates( self, request: Union[appengine.ListAuthorizedCertificatesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedCertificatesPager: @@ -404,7 +406,7 @@ def get_authorized_certificate( self, request: Union[appengine.GetAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: @@ -459,7 +461,7 @@ def create_authorized_certificate( self, request: Union[appengine.CreateAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: @@ -514,7 +516,7 @@ def update_authorized_certificate( self, request: Union[appengine.UpdateAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> certificate.AuthorizedCertificate: @@ -574,7 +576,7 @@ def delete_authorized_certificate( self, request: Union[appengine.DeleteAuthorizedCertificateRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: 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 c467d95..54287d1 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,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -39,15 +38,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class AuthorizedCertificatesTransport(abc.ABC): """Abstract transport class for AuthorizedCertificates.""" @@ -101,7 +91,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -134,29 +124,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - 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_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/transports/grpc_asyncio.py index 5999184..f73d6c4 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 @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore 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 5665df4..ecd2f4b 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 @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -165,9 +167,9 @@ def __init__( async def list_authorized_domains( self, - request: appengine.ListAuthorizedDomainsRequest = None, + request: Union[appengine.ListAuthorizedDomainsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedDomainsAsyncPager: @@ -175,7 +177,7 @@ async def list_authorized_domains( administer. Args: - request (:class:`google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest`): + 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, 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 bffcce0..956b3a0 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -341,7 +343,7 @@ def list_authorized_domains( self, request: Union[appengine.ListAuthorizedDomainsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAuthorizedDomainsPager: 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 fd3ab73..56463d0 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,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -37,15 +36,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class AuthorizedDomainsTransport(abc.ABC): """Abstract transport class for AuthorizedDomains.""" @@ -99,7 +89,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -132,29 +122,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - 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_asyncio.py b/google/cloud/appengine_admin_v1/services/authorized_domains/transports/grpc_asyncio.py index 97dd4da..0c93027 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 @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore 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 2d07ccc..3c31106 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 @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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.domain_mappings import pagers @@ -166,16 +168,16 @@ def __init__( async def list_domain_mappings( self, - request: appengine.ListDomainMappingsRequest = None, + request: Union[appengine.ListDomainMappingsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDomainMappingsAsyncPager: r"""Lists the domain mappings on an application. Args: - request (:class:`google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest`): + 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, @@ -223,16 +225,16 @@ async def list_domain_mappings( async def get_domain_mapping( self, - request: appengine.GetDomainMappingRequest = None, + request: Union[appengine.GetDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. Args: - request (:class:`google.cloud.appengine_admin_v1.types.GetDomainMappingRequest`): + 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, @@ -272,9 +274,9 @@ async def get_domain_mapping( async def create_domain_mapping( self, - request: appengine.CreateDomainMappingRequest = None, + request: Union[appengine.CreateDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -284,7 +286,7 @@ async def create_domain_mapping( ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. Args: - request (:class:`google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest`): + 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, @@ -335,9 +337,9 @@ async def create_domain_mapping( async def update_domain_mapping( self, - request: appengine.UpdateDomainMappingRequest = None, + request: Union[appengine.UpdateDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -348,7 +350,7 @@ async def update_domain_mapping( ``DomainMapping`` resource. Args: - request (:class:`google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest`): + 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, @@ -399,9 +401,9 @@ async def update_domain_mapping( async def delete_domain_mapping( self, - request: appengine.DeleteDomainMappingRequest = None, + request: Union[appengine.DeleteDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -410,7 +412,7 @@ async def delete_domain_mapping( ``DomainMapping`` resource. Args: - request (:class:`google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest`): + 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, 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 5182ceb..3dbf495 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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.domain_mappings import pagers @@ -340,7 +342,7 @@ def list_domain_mappings( self, request: Union[appengine.ListDomainMappingsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDomainMappingsPager: @@ -398,7 +400,7 @@ def get_domain_mapping( self, request: Union[appengine.GetDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> domain_mapping.DomainMapping: @@ -448,7 +450,7 @@ def create_domain_mapping( self, request: Union[appengine.CreateDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -512,7 +514,7 @@ def update_domain_mapping( self, request: Union[appengine.UpdateDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -577,7 +579,7 @@ def delete_domain_mapping( self, request: Union[appengine.DeleteDomainMappingRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: 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 9c8a596..2dd6ff6 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,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -40,15 +39,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class DomainMappingsTransport(abc.ABC): """Abstract transport class for DomainMappings.""" @@ -102,7 +92,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -135,29 +125,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -196,7 +163,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() 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 5eaac3e..16aea3c 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 @@ -113,7 +113,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 9ba3f67..71d0f59 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 @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore @@ -160,7 +159,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 69b4196..237ce9a 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -165,16 +167,16 @@ def __init__( async def list_ingress_rules( self, - request: appengine.ListIngressRulesRequest = None, + request: Union[appengine.ListIngressRulesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIngressRulesAsyncPager: r"""Lists the firewall rules of an application. Args: - request (:class:`google.cloud.appengine_admin_v1.types.ListIngressRulesRequest`): + 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, @@ -222,9 +224,9 @@ async def list_ingress_rules( async def batch_update_ingress_rules( self, - request: appengine.BatchUpdateIngressRulesRequest = None, + request: Union[appengine.BatchUpdateIngressRulesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> appengine.BatchUpdateIngressRulesResponse: @@ -237,7 +239,7 @@ async def batch_update_ingress_rules( end of the list. Args: - request (:class:`google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest`): + 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, @@ -275,16 +277,16 @@ async def batch_update_ingress_rules( async def create_ingress_rule( self, - request: appengine.CreateIngressRuleRequest = None, + request: Union[appengine.CreateIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. Args: - request (:class:`google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest`): + 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, @@ -326,16 +328,16 @@ async def create_ingress_rule( async def get_ingress_rule( self, - request: appengine.GetIngressRuleRequest = None, + request: Union[appengine.GetIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. Args: - request (:class:`google.cloud.appengine_admin_v1.types.GetIngressRuleRequest`): + 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, @@ -377,16 +379,16 @@ async def get_ingress_rule( async def update_ingress_rule( self, - request: appengine.UpdateIngressRuleRequest = None, + request: Union[appengine.UpdateIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. Args: - request (:class:`google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest`): + 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, @@ -428,16 +430,16 @@ async def update_ingress_rule( async def delete_ingress_rule( self, - request: appengine.DeleteIngressRuleRequest = None, + request: Union[appengine.DeleteIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes the specified firewall rule. Args: - request (:class:`google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest`): + 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, diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 6e5ef6c..495b873 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -345,7 +347,7 @@ def list_ingress_rules( self, request: Union[appengine.ListIngressRulesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIngressRulesPager: @@ -403,7 +405,7 @@ def batch_update_ingress_rules( self, request: Union[appengine.BatchUpdateIngressRulesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> appengine.BatchUpdateIngressRulesResponse: @@ -459,7 +461,7 @@ def create_ingress_rule( self, request: Union[appengine.CreateIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: @@ -511,7 +513,7 @@ def get_ingress_rule( self, request: Union[appengine.GetIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: @@ -563,7 +565,7 @@ def update_ingress_rule( self, request: Union[appengine.UpdateIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> firewall.FirewallRule: @@ -615,7 +617,7 @@ def delete_ingress_rule( self, request: Union[appengine.DeleteIngressRuleRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: 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 a9bcf9c..f6d01be 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -39,15 +38,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class FirewallTransport(abc.ABC): """Abstract transport class for Firewall.""" @@ -101,7 +91,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -134,29 +124,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - 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_asyncio.py b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc_asyncio.py index ab20af5..a2b3c2a 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 @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore 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 ec2e849..e94c473 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -163,9 +165,9 @@ def __init__( async def list_instances( self, - request: appengine.ListInstancesRequest = None, + request: Union[appengine.ListInstancesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesAsyncPager: @@ -176,7 +178,7 @@ async def list_instances( API `__. Args: - request (:class:`google.cloud.appengine_admin_v1.types.ListInstancesRequest`): + 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, @@ -224,16 +226,16 @@ async def list_instances( async def get_instance( self, - request: appengine.GetInstanceRequest = None, + request: Union[appengine.GetInstanceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instance.Instance: r"""Gets instance information. Args: - request (:class:`google.cloud.appengine_admin_v1.types.GetInstanceRequest`): + 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, @@ -274,9 +276,9 @@ async def get_instance( async def delete_instance( self, - request: appengine.DeleteInstanceRequest = None, + request: Union[appengine.DeleteInstanceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -297,7 +299,7 @@ async def delete_instance( method. Args: - request (:class:`google.cloud.appengine_admin_v1.types.DeleteInstanceRequest`): + 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, @@ -358,9 +360,9 @@ async def delete_instance( async def debug_instance( self, - request: appengine.DebugInstanceRequest = None, + request: Union[appengine.DebugInstanceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -376,7 +378,7 @@ async def debug_instance( environment. Args: - request (:class:`google.cloud.appengine_admin_v1.types.DebugInstanceRequest`): + 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, diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index d937126..c2b7ef7 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -355,7 +357,7 @@ def list_instances( self, request: Union[appengine.ListInstancesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstancesPager: @@ -417,7 +419,7 @@ def get_instance( self, request: Union[appengine.GetInstanceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instance.Instance: @@ -468,7 +470,7 @@ def delete_instance( self, request: Union[appengine.DeleteInstanceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -553,7 +555,7 @@ def debug_instance( self, request: Union[appengine.DebugInstanceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: 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 6903d56..53e72d8 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -40,15 +39,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class InstancesTransport(abc.ABC): """Abstract transport class for Instances.""" @@ -102,7 +92,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -135,29 +125,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -185,7 +152,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() 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 2fa6b60..61f9fd0 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -113,7 +113,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 5f84080..507b83d 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 @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore @@ -160,7 +159,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 5880026..4a49f44 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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.services import pagers @@ -159,16 +161,16 @@ def __init__( async def list_services( self, - request: appengine.ListServicesRequest = None, + request: Union[appengine.ListServicesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesAsyncPager: r"""Lists all the services in the application. Args: - request (:class:`google.cloud.appengine_admin_v1.types.ListServicesRequest`): + 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, @@ -216,9 +218,9 @@ async def list_services( async def get_service( self, - request: appengine.GetServiceRequest = None, + request: Union[appengine.GetServiceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.Service: @@ -226,7 +228,7 @@ async def get_service( service. Args: - request (:class:`google.cloud.appengine_admin_v1.types.GetServiceRequest`): + 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, @@ -276,16 +278,16 @@ async def get_service( async def update_service( self, - request: appengine.UpdateServiceRequest = None, + request: Union[appengine.UpdateServiceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the configuration of the specified service. Args: - request (:class:`google.cloud.appengine_admin_v1.types.UpdateServiceRequest`): + 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, @@ -342,9 +344,9 @@ async def update_service( async def delete_service( self, - request: appengine.DeleteServiceRequest = None, + request: Union[appengine.DeleteServiceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -352,7 +354,7 @@ async def delete_service( versions. Args: - request (:class:`google.cloud.appengine_admin_v1.types.DeleteServiceRequest`): + 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, diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index dcaecca..b47e7b1 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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.services import pagers @@ -339,7 +341,7 @@ def list_services( self, request: Union[appengine.ListServicesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesPager: @@ -397,7 +399,7 @@ def get_service( self, request: Union[appengine.GetServiceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.Service: @@ -458,7 +460,7 @@ def update_service( self, request: Union[appengine.UpdateServiceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -525,7 +527,7 @@ def delete_service( self, request: Union[appengine.DeleteServiceRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: 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 2a637c9..3d7eef4 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -40,15 +39,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class ServicesTransport(abc.ABC): """Abstract transport class for Services.""" @@ -102,7 +92,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -135,29 +125,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -185,7 +152,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() 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 e4df27f..fafc93d 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -113,7 +113,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 af666f0..b30a349 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 @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore @@ -160,7 +159,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 f0a057f..f9741fe 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -162,16 +164,16 @@ def __init__( async def list_versions( self, - request: appengine.ListVersionsRequest = None, + request: Union[appengine.ListVersionsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVersionsAsyncPager: r"""Lists the versions of a service. Args: - request (:class:`google.cloud.appengine_admin_v1.types.ListVersionsRequest`): + 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, @@ -219,9 +221,9 @@ async def list_versions( async def get_version( self, - request: appengine.GetVersionRequest = None, + request: Union[appengine.GetVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> version.Version: @@ -230,7 +232,7 @@ async def get_version( parameter to get the full resource. Args: - request (:class:`google.cloud.appengine_admin_v1.types.GetVersionRequest`): + 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, @@ -271,16 +273,16 @@ async def get_version( async def create_version( self, - request: appengine.CreateVersionRequest = None, + request: Union[appengine.CreateVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deploys code and resource files to a new version. Args: - request (:class:`google.cloud.appengine_admin_v1.types.CreateVersionRequest`): + 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, @@ -330,9 +332,9 @@ async def create_version( async def update_version( self, - request: appengine.UpdateVersionRequest = None, + request: Union[appengine.UpdateVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -374,7 +376,7 @@ async def update_version( - ```manual_scaling.instances`` `__ Args: - request (:class:`google.cloud.appengine_admin_v1.types.UpdateVersionRequest`): + 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, @@ -424,16 +426,16 @@ async def update_version( async def delete_version( self, - request: appengine.DeleteVersionRequest = None, + request: Union[appengine.DeleteVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes an existing Version resource. Args: - request (:class:`google.cloud.appengine_admin_v1.types.DeleteVersionRequest`): + 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, diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index a8a5cb4..f68c594 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + 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 @@ -342,7 +344,7 @@ def list_versions( self, request: Union[appengine.ListVersionsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListVersionsPager: @@ -400,7 +402,7 @@ def get_version( self, request: Union[appengine.GetVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> version.Version: @@ -453,7 +455,7 @@ def create_version( self, request: Union[appengine.CreateVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -513,7 +515,7 @@ def update_version( self, request: Union[appengine.UpdateVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: @@ -608,7 +610,7 @@ def delete_version( self, request: Union[appengine.DeleteVersionRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gac_operation.Operation: 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 883d0eb..f3b7e92 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -40,15 +39,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class VersionsTransport(abc.ABC): """Abstract transport class for Versions.""" @@ -102,7 +92,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -135,29 +125,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -188,7 +155,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() 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 8b61c61..7abaca2 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -113,7 +113,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 1ada908..9069dc8 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 @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore @@ -160,7 +159,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index f6acd01..56cf0dc 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -124,6 +124,13 @@ class UrlMap(proto.Message): 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, @@ -135,13 +142,16 @@ class UrlMap(proto.Message): 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): diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index eb59c60..a72792b 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -27,13 +27,22 @@ 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 = proto.Field( diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py index 4c0c35a..f5b89c4 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -28,6 +28,9 @@ 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: @@ -56,6 +59,7 @@ class OperationMetadataV1(proto.Message): operation poll. @OutputOnly create_version_metadata (google.cloud.appengine_admin_v1.types.CreateVersionMetadataV1): + This field is a member of `oneof`_ ``method_metadata``. """ method = proto.Field(proto.STRING, number=1,) diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index f1d353f..3a24b70 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -69,6 +69,13 @@ 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: @@ -85,6 +92,7 @@ class Version(proto.Message): 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 @@ -92,12 +100,14 @@ class Version(proto.Message): 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 (Sequence[google.cloud.appengine_admin_v1.types.InboundServiceType]): Before an application can receive email or XMPP messages, the application must be @@ -698,10 +708,13 @@ class VpcAccessConnector(proto.Message): 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 = proto.Field(proto.STRING, number=1, oneof="command",) diff --git a/setup.py b/setup.py index d53a40e..e2b55b3 100644 --- a/setup.py +++ b/setup.py @@ -28,9 +28,8 @@ # 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.26.0, <3.0.0dev", + "google-api-core[grpc] >= 1.28.0, <3.0.0dev", "proto-plus >= 1.18.1", - "packaging >= 14.3", "grpc-google-iam-v1", "six", ] diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index b86813c..f4ff370 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,8 +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.26.0 +google-api-core==1.28.0 proto-plus==1.18.1 grpc-google-iam-v1==0.12.3 six==1.13.0 -packaging==14.3 diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 7c034b5..a99ea93 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -40,9 +39,6 @@ ) 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.services.applications.transports.base import ( - _GOOGLE_AUTH_VERSION, -) 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 @@ -53,20 +49,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -214,7 +196,7 @@ def test_applications_client_client_options( 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -231,7 +213,7 @@ def test_applications_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -248,7 +230,7 @@ def test_applications_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -277,7 +259,7 @@ def test_applications_client_client_options( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -334,7 +316,7 @@ def test_applications_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -376,7 +358,7 @@ def test_applications_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -398,7 +380,7 @@ def test_applications_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -429,7 +411,7 @@ def test_applications_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -460,7 +442,7 @@ def test_applications_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1147,7 +1129,6 @@ def test_applications_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_applications_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1172,30 +1153,6 @@ def test_applications_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_applications_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -1207,7 +1164,6 @@ def test_applications_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -1224,22 +1180,6 @@ def test_applications_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_applications_auth_adc_old_google_auth(): - # 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=( - "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", [ @@ -1247,7 +1187,6 @@ def test_applications_auth_adc_old_google_auth(): transports.ApplicationsGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_applications_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1265,30 +1204,6 @@ def test_applications_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.ApplicationsGrpcTransport, - transports.ApplicationsGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_applications_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ 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 6de2281..300dbfa 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -40,9 +39,6 @@ ) 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.services.authorized_certificates.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.appengine_admin_v1.types import appengine from google.cloud.appengine_admin_v1.types import certificate from google.oauth2 import service_account @@ -51,20 +47,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -226,7 +208,7 @@ def test_authorized_certificates_client_client_options( 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -243,7 +225,7 @@ def test_authorized_certificates_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -260,7 +242,7 @@ def test_authorized_certificates_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -289,7 +271,7 @@ def test_authorized_certificates_client_client_options( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -358,7 +340,7 @@ def test_authorized_certificates_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -400,7 +382,7 @@ def test_authorized_certificates_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -422,7 +404,7 @@ def test_authorized_certificates_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -457,7 +439,7 @@ def test_authorized_certificates_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -492,7 +474,7 @@ def test_authorized_certificates_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1623,7 +1605,6 @@ def test_authorized_certificates_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_authorized_certificates_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1648,30 +1629,6 @@ def test_authorized_certificates_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_authorized_certificates_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -1683,7 +1640,6 @@ def test_authorized_certificates_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -1700,22 +1656,6 @@ def test_authorized_certificates_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_authorized_certificates_auth_adc_old_google_auth(): - # 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=( - "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", [ @@ -1723,7 +1663,6 @@ def test_authorized_certificates_auth_adc_old_google_auth(): transports.AuthorizedCertificatesGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_authorized_certificates_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1741,30 +1680,6 @@ def test_authorized_certificates_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedCertificatesGrpcTransport, - transports.AuthorizedCertificatesGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_authorized_certificates_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ 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 4d570ea..ea20035 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -40,29 +39,12 @@ ) 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.services.authorized_domains.transports.base import ( - _GOOGLE_AUTH_VERSION, -) 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 -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -220,7 +202,7 @@ def test_authorized_domains_client_client_options( 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -237,7 +219,7 @@ def test_authorized_domains_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -254,7 +236,7 @@ def test_authorized_domains_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -283,7 +265,7 @@ def test_authorized_domains_client_client_options( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -352,7 +334,7 @@ def test_authorized_domains_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -394,7 +376,7 @@ def test_authorized_domains_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -416,7 +398,7 @@ def test_authorized_domains_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -447,7 +429,7 @@ def test_authorized_domains_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -478,7 +460,7 @@ def test_authorized_domains_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -914,7 +896,6 @@ def test_authorized_domains_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_authorized_domains_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -939,30 +920,6 @@ def test_authorized_domains_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_authorized_domains_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -974,7 +931,6 @@ def test_authorized_domains_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -991,22 +947,6 @@ def test_authorized_domains_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_authorized_domains_auth_adc_old_google_auth(): - # 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=( - "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", [ @@ -1014,7 +954,6 @@ def test_authorized_domains_auth_adc_old_google_auth(): transports.AuthorizedDomainsGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_authorized_domains_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1032,30 +971,6 @@ def test_authorized_domains_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.AuthorizedDomainsGrpcTransport, - transports.AuthorizedDomainsGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_authorized_domains_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ 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 9a13770..1ed3557 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -43,9 +42,6 @@ ) 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.services.domain_mappings.transports.base import ( - _GOOGLE_AUTH_VERSION, -) 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 operation as ga_operation @@ -55,20 +51,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -225,7 +207,7 @@ def test_domain_mappings_client_client_options( 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -242,7 +224,7 @@ def test_domain_mappings_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -259,7 +241,7 @@ def test_domain_mappings_client_client_options( 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -288,7 +270,7 @@ def test_domain_mappings_client_client_options( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -347,7 +329,7 @@ def test_domain_mappings_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -389,7 +371,7 @@ def test_domain_mappings_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -411,7 +393,7 @@ def test_domain_mappings_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -442,7 +424,7 @@ def test_domain_mappings_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -473,7 +455,7 @@ def test_domain_mappings_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1514,7 +1496,6 @@ def test_domain_mappings_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_domain_mappings_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1539,30 +1520,6 @@ def test_domain_mappings_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_domain_mappings_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -1574,7 +1531,6 @@ def test_domain_mappings_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -1591,22 +1547,6 @@ def test_domain_mappings_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_domain_mappings_auth_adc_old_google_auth(): - # 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=( - "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", [ @@ -1614,7 +1554,6 @@ def test_domain_mappings_auth_adc_old_google_auth(): transports.DomainMappingsGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_domain_mappings_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1632,30 +1571,6 @@ def test_domain_mappings_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.DomainMappingsGrpcTransport, - transports.DomainMappingsGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_domain_mappings_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index b60e491..a05bec5 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -36,9 +35,6 @@ 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.services.firewall.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.appengine_admin_v1.types import appengine from google.cloud.appengine_admin_v1.types import firewall from google.oauth2 import service_account @@ -46,20 +42,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -199,7 +181,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -216,7 +198,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -233,7 +215,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -262,7 +244,7 @@ def test_firewall_client_client_options(client_class, transport_class, transport 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -319,7 +301,7 @@ def test_firewall_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -361,7 +343,7 @@ def test_firewall_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -383,7 +365,7 @@ def test_firewall_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -410,7 +392,7 @@ def test_firewall_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -437,7 +419,7 @@ def test_firewall_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1616,7 +1598,6 @@ def test_firewall_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_firewall_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1641,30 +1622,6 @@ def test_firewall_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_firewall_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -1676,7 +1633,6 @@ def test_firewall_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -1693,27 +1649,10 @@ def test_firewall_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_firewall_auth_adc_old_google_auth(): - # 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=( - "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,], ) -@requires_google_auth_gte_1_25_0 def test_firewall_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1731,27 +1670,6 @@ def test_firewall_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [transports.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport,], -) -@requires_google_auth_lt_1_25_0 -def test_firewall_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index d51b0a8..75d66d2 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -39,9 +38,6 @@ 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.services.instances.transports.base import ( - _GOOGLE_AUTH_VERSION, -) 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 @@ -51,20 +47,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -208,7 +190,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -225,7 +207,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -242,7 +224,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -271,7 +253,7 @@ def test_instances_client_client_options(client_class, transport_class, transpor 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -328,7 +310,7 @@ def test_instances_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -370,7 +352,7 @@ def test_instances_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -392,7 +374,7 @@ def test_instances_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -423,7 +405,7 @@ def test_instances_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -454,7 +436,7 @@ def test_instances_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1323,7 +1305,6 @@ def test_instances_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_instances_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1348,30 +1329,6 @@ def test_instances_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_instances_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -1383,7 +1340,6 @@ def test_instances_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -1400,27 +1356,10 @@ def test_instances_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_instances_auth_adc_old_google_auth(): - # 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=( - "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,], ) -@requires_google_auth_gte_1_25_0 def test_instances_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1438,27 +1377,6 @@ def test_instances_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [transports.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport,], -) -@requires_google_auth_lt_1_25_0 -def test_instances_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 168aded..811d07f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -39,9 +38,6 @@ 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.services.services.transports.base import ( - _GOOGLE_AUTH_VERSION, -) 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 @@ -52,20 +48,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -205,7 +187,7 @@ def test_services_client_client_options(client_class, transport_class, transport 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -222,7 +204,7 @@ def test_services_client_client_options(client_class, transport_class, transport 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -239,7 +221,7 @@ def test_services_client_client_options(client_class, transport_class, transport 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -268,7 +250,7 @@ def test_services_client_client_options(client_class, transport_class, transport 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -325,7 +307,7 @@ def test_services_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -367,7 +349,7 @@ def test_services_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -389,7 +371,7 @@ def test_services_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -416,7 +398,7 @@ def test_services_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -443,7 +425,7 @@ def test_services_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1232,7 +1214,6 @@ def test_services_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_services_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1257,30 +1238,6 @@ def test_services_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_services_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -1292,7 +1249,6 @@ def test_services_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -1309,27 +1265,10 @@ def test_services_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_services_auth_adc_old_google_auth(): - # 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=( - "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,], ) -@requires_google_auth_gte_1_25_0 def test_services_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1347,27 +1286,6 @@ def test_services_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport,], -) -@requires_google_auth_lt_1_25_0 -def test_services_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 84a0499..ef9622d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -39,9 +38,6 @@ 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.services.versions.transports.base import ( - _GOOGLE_AUTH_VERSION, -) 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 @@ -55,20 +51,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -208,7 +190,7 @@ def test_versions_client_client_options(client_class, transport_class, transport 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(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -225,7 +207,7 @@ def test_versions_client_client_options(client_class, transport_class, transport 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -242,7 +224,7 @@ def test_versions_client_client_options(client_class, transport_class, transport 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() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -271,7 +253,7 @@ def test_versions_client_client_options(client_class, transport_class, transport 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -328,7 +310,7 @@ def test_versions_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -370,7 +352,7 @@ def test_versions_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -392,7 +374,7 @@ def test_versions_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -419,7 +401,7 @@ def test_versions_client_client_options_scopes( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -446,7 +428,7 @@ def test_versions_client_client_options_credentials_file( 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) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1443,7 +1425,6 @@ def test_versions_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_versions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1468,30 +1449,6 @@ def test_versions_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_versions_base_transport_with_credentials_file_old_google_auth(): - # 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=( - "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( @@ -1503,7 +1460,6 @@ def test_versions_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 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: @@ -1520,27 +1476,10 @@ def test_versions_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_versions_auth_adc_old_google_auth(): - # 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=( - "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,], ) -@requires_google_auth_gte_1_25_0 def test_versions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1558,27 +1497,6 @@ def test_versions_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], -) -@requires_google_auth_lt_1_25_0 -def test_versions_transport_auth_adc_old_google_auth(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") - adc.assert_called_once_with( - 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,grpc_helpers", [ From 9518f8b67fdf39f6104e37f84df61efacf6951f0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:46:13 +0000 Subject: [PATCH 065/185] chore: release 1.2.1 (#84) :robot: I have created a release \*beep\* \*boop\* --- ### [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)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 13 +++++++++++++ setup.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83b5bdd..8896aa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index e2b55b3..ddec92c 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.2.0" +version = "1.2.1" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 63b73d126990d49a30984dddac61a3fcfdea4188 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:46:24 -0500 Subject: [PATCH 066/185] chore: use gapic-generator-python 0.56.2 (#87) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: https://github.com/googleapis/googleapis/commit/2921f9fb3bfbd16f6b2da0104373e2b47a80a65e Source-Link: https://github.com/googleapis/googleapis-gen/commit/6598ca8cbbf5226733a099c4506518a5af6ff74c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot 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 | 13 ++++++---- .../services/applications/client.py | 25 +++++++++++++------ .../services/applications/transports/base.py | 10 ++++---- .../services/applications/transports/grpc.py | 6 ++--- .../applications/transports/grpc_asyncio.py | 6 ++--- .../authorized_certificates/async_client.py | 13 ++++++---- .../authorized_certificates/client.py | 25 +++++++++++++------ .../transports/base.py | 8 +++--- .../transports/grpc.py | 4 +-- .../transports/grpc_asyncio.py | 4 +-- .../authorized_domains/async_client.py | 13 ++++++---- .../services/authorized_domains/client.py | 25 +++++++++++++------ .../authorized_domains/transports/base.py | 8 +++--- .../authorized_domains/transports/grpc.py | 4 +-- .../transports/grpc_asyncio.py | 4 +-- .../services/domain_mappings/async_client.py | 13 ++++++---- .../services/domain_mappings/client.py | 25 +++++++++++++------ .../domain_mappings/transports/base.py | 10 ++++---- .../domain_mappings/transports/grpc.py | 6 ++--- .../transports/grpc_asyncio.py | 6 ++--- .../services/firewall/async_client.py | 13 ++++++---- .../services/firewall/client.py | 25 +++++++++++++------ .../services/firewall/transports/base.py | 8 +++--- .../services/firewall/transports/grpc.py | 4 +-- .../firewall/transports/grpc_asyncio.py | 4 +-- .../services/instances/async_client.py | 13 ++++++---- .../services/instances/client.py | 25 +++++++++++++------ .../services/instances/transports/base.py | 10 ++++---- .../services/instances/transports/grpc.py | 6 ++--- .../instances/transports/grpc_asyncio.py | 6 ++--- .../services/services/async_client.py | 13 ++++++---- .../services/services/client.py | 25 +++++++++++++------ .../services/services/transports/base.py | 10 ++++---- .../services/services/transports/grpc.py | 6 ++--- .../services/transports/grpc_asyncio.py | 6 ++--- .../services/versions/async_client.py | 13 ++++++---- .../services/versions/client.py | 25 +++++++++++++------ .../services/versions/transports/base.py | 10 ++++---- .../services/versions/transports/grpc.py | 6 ++--- .../versions/transports/grpc_asyncio.py | 6 ++--- .../appengine_admin_v1/types/app_yaml.py | 3 +++ .../appengine_admin_v1/types/audit_data.py | 2 ++ .../cloud/appengine_admin_v1/types/version.py | 4 +++ 43 files changed, 288 insertions(+), 183 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 081746a..84e98ff 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 9de6bd9..00243e2 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -269,8 +271,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 51e5281..d2d1e1d 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -18,11 +18,11 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # 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 +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 d40eab7..10e372d 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -16,9 +16,9 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_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 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 141ebf1..c38542d 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 @@ -16,9 +16,9 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore -from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 a63f1eb..c7088f1 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 @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 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 02b3c8c..b07b0c7 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -274,8 +276,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 54287d1..3f3c295 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 @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # 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 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 58098d4..8771c28 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 @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_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 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 f73d6c4..216cd78 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 @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 ecd2f4b..1f53362 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 @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 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 956b3a0..985f66c 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -273,8 +275,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 56463d0..0729c5a 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 @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # 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 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 34be2b1..7e6d297 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 @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_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 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 0c93027..d5c20c2 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 @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 3c31106..3ee8535 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 @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 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 3dbf495..19cf402 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -272,8 +274,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 2dd6ff6..c3a392d 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 @@ -18,11 +18,11 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # 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 +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 16aea3c..5b639b9 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 @@ -16,9 +16,9 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_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 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 71d0f59..c39e110 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 @@ -16,9 +16,9 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore -from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 237ce9a..2f33bd0 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 495b873..5dd1cfc 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -277,8 +279,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 f6d01be..49e3fef 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # 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 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 7dc0324..31efb7c 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_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 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 a2b3c2a..34da7ca 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 @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 e94c473..72c33f6 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index c2b7ef7..d4d7c7c 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -287,8 +289,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 53e72d8..171b2a3 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -18,11 +18,11 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # 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 +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 61f9fd0..d9c39e6 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -16,9 +16,9 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_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 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 507b83d..cc6873c 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 @@ -16,9 +16,9 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore -from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 4a49f44..35dc7a7 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index b47e7b1..e6327e9 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -271,8 +273,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 3d7eef4..5306744 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -18,11 +18,11 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # 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 +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 fafc93d..47335a4 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -16,9 +16,9 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_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 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 b30a349..4f6dcac 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 @@ -16,9 +16,9 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore -from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 f9741fe..9b0a3f7 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +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 diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index f68c594..f541971 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +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.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 -OptionalRetry = Union[retries.Retry, object] +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 @@ -274,8 +276,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 f3b7e92..0751165 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -18,11 +18,11 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # 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 +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 7abaca2..a431097 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -16,9 +16,9 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_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 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 9069dc8..3d36ffd 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 @@ -16,9 +16,9 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore -from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 56cf0dc..0240b81 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -142,15 +142,18 @@ class UrlMap(proto.Message): 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. diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index a72792b..525dacd 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -38,10 +38,12 @@ class AuditData(proto.Message): 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``. """ diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 3a24b70..01d6083 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -92,6 +92,7 @@ class Version(proto.Message): 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 @@ -100,6 +101,7 @@ class Version(proto.Message): 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 @@ -107,6 +109,7 @@ class Version(proto.Message): 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 (Sequence[google.cloud.appengine_admin_v1.types.InboundServiceType]): Before an application can receive email or @@ -714,6 +717,7 @@ class Entrypoint(proto.Message): shell (str): The format should be a shell command that can be fed to ``bash -c``. + This field is a member of `oneof`_ ``command``. """ From d8259293096b68ac2460e2d089a8117e22a1e7f6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:09:51 -0500 Subject: [PATCH 067/185] chore(python): add .github/CODEOWNERS as a templated file (#88) Source-Link: https://github.com/googleapis/synthtool/commit/c5026b3217973a8db55db8ee85feee0e9a65e295 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 108063d..7519fa3 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4ee57a76a176ede9087c14330c625a71553cf9c72828b2c0ca12f5338171ba60 + digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index be888a9..44cc868 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,9 +3,10 @@ # # 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. -# The @googleapis/yoshi-python is the default owner for changes in this repo -* @googleapis/yoshi-python - +# @googleapis/yoshi-python is the default owner for changes in this repo +* @googleapis/yoshi-python +# @googleapis/python-samples-owners is the default owner for samples changes /samples/ @googleapis/python-samples-owners From e6d80e56f6eef25273c8bfbfa8ee1da934302fb0 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Thu, 18 Nov 2021 13:10:03 -0500 Subject: [PATCH 068/185] chore: update doc links from googleapis.dev to cloud.google.com (#89) --- .repo-metadata.json | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index b1fad72..9fe5d4f 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,7 +2,7 @@ "name": "appengine", "name_pretty": "App Engine Admin API", "product_documentation": "https://cloud.google.com/appengine/docs/admin-api/", - "client_documentation": "https://googleapis.dev/python/appengine/latest", + "client_documentation": "https://cloud.google.com/python/docs/reference/appengine/latest", "issue_tracker": "", "release_level": "ga", "language": "python", diff --git a/README.rst b/README.rst index 6b75bcf..692ff64 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,7 @@ Python Client for App Engine 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 +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/appengine/latest .. _Product Documentation: https://cloud.google.com/appengine/docs/admin-api/ Quick Start From c01efb13d2a35023e33bf585fc3fca51099de4f5 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 28 Dec 2021 13:33:12 -0500 Subject: [PATCH 069/185] chore: update .repo-metadata.json (#92) --- .repo-metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 9fe5d4f..ea220ae 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,12 +4,13 @@ "product_documentation": "https://cloud.google.com/appengine/docs/admin-api/", "client_documentation": "https://cloud.google.com/python/docs/reference/appengine/latest", "issue_tracker": "", - "release_level": "ga", + "release_level": "stable", "language": "python", "library_type": "GAPIC_AUTO", "repo": "googleapis/python-appengine-admin", "distribution_name": "google-cloud-appengine-admin", "api_id": "appengine.googleapis.com", "default_version": "v1", - "codeowner_team": "" + "codeowner_team": "", + "api_shortname": "appengine" } From a61d6b13f2afea6c8834e94d3c3da3807212c84a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 6 Jan 2022 09:07:28 -0700 Subject: [PATCH 070/185] chore: use python-samples-reviewers (#94) Source-Link: https://github.com/googleapis/synthtool/commit/da9308710160980198d85a4bcddac1d6f6f1a5bc Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7519fa3..f33299d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 + digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 44cc868..e446644 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,5 +8,5 @@ # @googleapis/yoshi-python is the default owner for changes in this repo * @googleapis/yoshi-python -# @googleapis/python-samples-owners is the default owner for samples changes -/samples/ @googleapis/python-samples-owners +# @googleapis/python-samples-reviewers is the default owner for samples changes +/samples/ @googleapis/python-samples-reviewers From e426078cd7962dd9cadb4e3db8c5da2015b7bd5f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 7 Jan 2022 13:49:15 -0500 Subject: [PATCH 071/185] chore: use gapic-generator-python 0.58.4 (#93) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: https://github.com/googleapis/googleapis/commit/73da6697f598f1ba30618924936a59f8e457ec89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot 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/applications/transports/base.py | 1 - .../transports/base.py | 1 - .../authorized_domains/transports/base.py | 1 - .../domain_mappings/transports/base.py | 1 - .../services/firewall/transports/base.py | 1 - .../services/instances/transports/base.py | 1 - .../services/services/transports/base.py | 1 - .../services/versions/transports/base.py | 1 - .../appengine_admin_v1/test_applications.py | 50 ++++------- .../test_authorized_certificates.py | 77 +++++++---------- .../test_authorized_domains.py | 37 +++++---- .../test_domain_mappings.py | 71 ++++++---------- .../gapic/appengine_admin_v1/test_firewall.py | 82 +++++++------------ .../appengine_admin_v1/test_instances.py | 62 ++++++-------- .../gapic/appengine_admin_v1/test_services.py | 60 ++++++-------- .../gapic/appengine_admin_v1/test_versions.py | 69 ++++++---------- 16 files changed, 190 insertions(+), 326 deletions(-) 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 d2d1e1d..61624e0 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -108,7 +108,6 @@ def __init__( 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 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 3f3c295..5009315 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 @@ -107,7 +107,6 @@ def __init__( 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 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 0729c5a..c9bc5fd 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 @@ -105,7 +105,6 @@ def __init__( 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 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 c3a392d..5b88674 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 @@ -108,7 +108,6 @@ def __init__( 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 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 49e3fef..3dbbafe 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -107,7 +107,6 @@ def __init__( 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 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 171b2a3..14c52fb 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -108,7 +108,6 @@ def __init__( 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 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 5306744..f92d7cd 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -108,7 +108,6 @@ def __init__( 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 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 0751165..41bf091 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -108,7 +108,6 @@ def __init__( 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 diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index a99ea93..8192150 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -246,20 +246,20 @@ def test_applications_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -316,7 +316,7 @@ def test_applications_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -411,7 +411,7 @@ def test_applications_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -442,7 +442,7 @@ def test_applications_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -473,9 +473,8 @@ def test_applications_client_client_options_from_dict(): ) -def test_get_application( - transport: str = "grpc", request_type=appengine.GetApplicationRequest -): +@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, ) @@ -522,10 +521,6 @@ def test_get_application( ) -def test_get_application_from_dict(): - test_get_application(request_type=dict) - - 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. @@ -649,9 +644,8 @@ async def test_get_application_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_application( - transport: str = "grpc", request_type=appengine.CreateApplicationRequest -): +@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, ) @@ -677,10 +671,6 @@ def test_create_application( assert isinstance(response, future.Future) -def test_create_application_from_dict(): - test_create_application(request_type=dict) - - 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. @@ -734,9 +724,8 @@ async def test_create_application_async_from_dict(): await test_create_application_async(request_type=dict) -def test_update_application( - transport: str = "grpc", request_type=appengine.UpdateApplicationRequest -): +@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, ) @@ -762,10 +751,6 @@ def test_update_application( assert isinstance(response, future.Future) -def test_update_application_from_dict(): - test_update_application(request_type=dict) - - 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. @@ -874,9 +859,8 @@ async def test_update_application_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_repair_application( - transport: str = "grpc", request_type=appengine.RepairApplicationRequest -): +@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, ) @@ -902,10 +886,6 @@ def test_repair_application( assert isinstance(response, future.Future) -def test_repair_application_from_dict(): - test_repair_application(request_type=dict) - - 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. @@ -1543,7 +1523,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( 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 300dbfa..d9f284b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -258,20 +258,20 @@ def test_authorized_certificates_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -340,7 +340,7 @@ def test_authorized_certificates_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -439,7 +439,7 @@ def test_authorized_certificates_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -474,7 +474,7 @@ def test_authorized_certificates_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -507,9 +507,10 @@ def test_authorized_certificates_client_client_options_from_dict(): ) -def test_list_authorized_certificates( - transport: str = "grpc", request_type=appengine.ListAuthorizedCertificatesRequest -): +@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, ) @@ -538,10 +539,6 @@ def test_list_authorized_certificates( assert response.next_page_token == "next_page_token_value" -def test_list_authorized_certificates_from_dict(): - test_list_authorized_certificates(request_type=dict) - - 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. @@ -658,9 +655,9 @@ async def test_list_authorized_certificates_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_authorized_certificates_pager(): +def test_list_authorized_certificates_pager(transport_name: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -706,9 +703,9 @@ def test_list_authorized_certificates_pager(): assert all(isinstance(i, certificate.AuthorizedCertificate) for i in results) -def test_list_authorized_certificates_pages(): +def test_list_authorized_certificates_pages(transport_name: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -838,9 +835,10 @@ async def test_list_authorized_certificates_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_authorized_certificate( - transport: str = "grpc", request_type=appengine.GetAuthorizedCertificateRequest -): +@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, ) @@ -879,10 +877,6 @@ def test_get_authorized_certificate( assert response.domain_mappings_count == 2238 -def test_get_authorized_certificate_from_dict(): - test_get_authorized_certificate(request_type=dict) - - 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. @@ -1009,9 +1003,10 @@ async def test_get_authorized_certificate_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_authorized_certificate( - transport: str = "grpc", request_type=appengine.CreateAuthorizedCertificateRequest -): +@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, ) @@ -1050,10 +1045,6 @@ def test_create_authorized_certificate( assert response.domain_mappings_count == 2238 -def test_create_authorized_certificate_from_dict(): - test_create_authorized_certificate(request_type=dict) - - 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. @@ -1180,9 +1171,10 @@ async def test_create_authorized_certificate_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_update_authorized_certificate( - transport: str = "grpc", request_type=appengine.UpdateAuthorizedCertificateRequest -): +@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, ) @@ -1221,10 +1213,6 @@ def test_update_authorized_certificate( assert response.domain_mappings_count == 2238 -def test_update_authorized_certificate_from_dict(): - test_update_authorized_certificate(request_type=dict) - - 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. @@ -1351,9 +1339,10 @@ async def test_update_authorized_certificate_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_delete_authorized_certificate( - transport: str = "grpc", request_type=appengine.DeleteAuthorizedCertificateRequest -): +@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, ) @@ -1379,10 +1368,6 @@ def test_delete_authorized_certificate( assert response is None -def test_delete_authorized_certificate_from_dict(): - test_delete_authorized_certificate(request_type=dict) - - 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. @@ -2008,7 +1993,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( 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 ea20035..f852bc7 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -252,20 +252,20 @@ def test_authorized_domains_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -334,7 +334,7 @@ def test_authorized_domains_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -429,7 +429,7 @@ def test_authorized_domains_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -460,7 +460,7 @@ def test_authorized_domains_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -493,9 +493,10 @@ def test_authorized_domains_client_client_options_from_dict(): ) -def test_list_authorized_domains( - transport: str = "grpc", request_type=appengine.ListAuthorizedDomainsRequest -): +@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, ) @@ -524,10 +525,6 @@ def test_list_authorized_domains( assert response.next_page_token == "next_page_token_value" -def test_list_authorized_domains_from_dict(): - test_list_authorized_domains(request_type=dict) - - 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. @@ -641,8 +638,10 @@ async def test_list_authorized_domains_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_authorized_domains_pager(): - client = AuthorizedDomainsClient(credentials=ga_credentials.AnonymousCredentials,) +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( @@ -681,8 +680,10 @@ def test_list_authorized_domains_pager(): assert all(isinstance(i, domain.AuthorizedDomain) for i in results) -def test_list_authorized_domains_pages(): - client = AuthorizedDomainsClient(credentials=ga_credentials.AnonymousCredentials,) +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( @@ -1295,7 +1296,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( 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 1ed3557..e79a31d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -257,20 +257,20 @@ def test_domain_mappings_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -329,7 +329,7 @@ def test_domain_mappings_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -424,7 +424,7 @@ def test_domain_mappings_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -455,7 +455,7 @@ def test_domain_mappings_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -488,9 +488,8 @@ def test_domain_mappings_client_client_options_from_dict(): ) -def test_list_domain_mappings( - transport: str = "grpc", request_type=appengine.ListDomainMappingsRequest -): +@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, ) @@ -519,10 +518,6 @@ def test_list_domain_mappings( assert response.next_page_token == "next_page_token_value" -def test_list_domain_mappings_from_dict(): - test_list_domain_mappings(request_type=dict) - - 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. @@ -636,8 +631,10 @@ async def test_list_domain_mappings_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_domain_mappings_pager(): - client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials,) +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( @@ -682,8 +679,10 @@ def test_list_domain_mappings_pager(): assert all(isinstance(i, domain_mapping.DomainMapping) for i in results) -def test_list_domain_mappings_pages(): - client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials,) +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( @@ -806,9 +805,8 @@ async def test_list_domain_mappings_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_domain_mapping( - transport: str = "grpc", request_type=appengine.GetDomainMappingRequest -): +@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, ) @@ -838,10 +836,6 @@ def test_get_domain_mapping( assert response.id == "id_value" -def test_get_domain_mapping_from_dict(): - test_get_domain_mapping(request_type=dict) - - 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. @@ -954,9 +948,8 @@ async def test_get_domain_mapping_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_domain_mapping( - transport: str = "grpc", request_type=appengine.CreateDomainMappingRequest -): +@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, ) @@ -982,10 +975,6 @@ def test_create_domain_mapping( assert isinstance(response, future.Future) -def test_create_domain_mapping_from_dict(): - test_create_domain_mapping(request_type=dict) - - 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. @@ -1096,9 +1085,8 @@ async def test_create_domain_mapping_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_update_domain_mapping( - transport: str = "grpc", request_type=appengine.UpdateDomainMappingRequest -): +@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, ) @@ -1124,10 +1112,6 @@ def test_update_domain_mapping( assert isinstance(response, future.Future) -def test_update_domain_mapping_from_dict(): - test_update_domain_mapping(request_type=dict) - - 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. @@ -1238,9 +1222,8 @@ async def test_update_domain_mapping_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_delete_domain_mapping( - transport: str = "grpc", request_type=appengine.DeleteDomainMappingRequest -): +@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, ) @@ -1266,10 +1249,6 @@ def test_delete_domain_mapping( assert isinstance(response, future.Future) -def test_delete_domain_mapping_from_dict(): - test_delete_domain_mapping(request_type=dict) - - 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. @@ -1921,7 +1900,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index a05bec5..ceab4ed 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -231,20 +231,20 @@ def test_firewall_client_client_options(client_class, transport_class, transport # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -301,7 +301,7 @@ def test_firewall_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -392,7 +392,7 @@ def test_firewall_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -419,7 +419,7 @@ def test_firewall_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -450,9 +450,8 @@ def test_firewall_client_client_options_from_dict(): ) -def test_list_ingress_rules( - transport: str = "grpc", request_type=appengine.ListIngressRulesRequest -): +@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, ) @@ -481,10 +480,6 @@ def test_list_ingress_rules( assert response.next_page_token == "next_page_token_value" -def test_list_ingress_rules_from_dict(): - test_list_ingress_rules(request_type=dict) - - 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. @@ -594,8 +589,10 @@ async def test_list_ingress_rules_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_ingress_rules_pager(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials,) +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( @@ -636,8 +633,10 @@ def test_list_ingress_rules_pager(): assert all(isinstance(i, firewall.FirewallRule) for i in results) -def test_list_ingress_rules_pages(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials,) +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( @@ -748,9 +747,10 @@ async def test_list_ingress_rules_async_pages(): assert page_.raw_page.next_page_token == token -def test_batch_update_ingress_rules( - transport: str = "grpc", request_type=appengine.BatchUpdateIngressRulesRequest -): +@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, ) @@ -776,10 +776,6 @@ def test_batch_update_ingress_rules( assert isinstance(response, appengine.BatchUpdateIngressRulesResponse) -def test_batch_update_ingress_rules_from_dict(): - test_batch_update_ingress_rules(request_type=dict) - - 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. @@ -889,9 +885,8 @@ async def test_batch_update_ingress_rules_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_ingress_rule( - transport: str = "grpc", request_type=appengine.CreateIngressRuleRequest -): +@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, ) @@ -926,10 +921,6 @@ def test_create_ingress_rule( assert response.description == "description_value" -def test_create_ingress_rule_from_dict(): - test_create_ingress_rule(request_type=dict) - - 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. @@ -1047,9 +1038,8 @@ async def test_create_ingress_rule_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_get_ingress_rule( - transport: str = "grpc", request_type=appengine.GetIngressRuleRequest -): +@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, ) @@ -1082,10 +1072,6 @@ def test_get_ingress_rule( assert response.description == "description_value" -def test_get_ingress_rule_from_dict(): - test_get_ingress_rule(request_type=dict) - - 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. @@ -1195,9 +1181,8 @@ async def test_get_ingress_rule_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_update_ingress_rule( - transport: str = "grpc", request_type=appengine.UpdateIngressRuleRequest -): +@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, ) @@ -1232,10 +1217,6 @@ def test_update_ingress_rule( assert response.description == "description_value" -def test_update_ingress_rule_from_dict(): - test_update_ingress_rule(request_type=dict) - - 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. @@ -1353,9 +1334,8 @@ async def test_update_ingress_rule_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_delete_ingress_rule( - transport: str = "grpc", request_type=appengine.DeleteIngressRuleRequest -): +@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, ) @@ -1381,10 +1361,6 @@ def test_delete_ingress_rule( assert response is None -def test_delete_ingress_rule_from_dict(): - test_delete_ingress_rule(request_type=dict) - - 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. @@ -1983,7 +1959,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 75d66d2..54ec79d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -240,20 +240,20 @@ def test_instances_client_client_options(client_class, transport_class, transpor # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -310,7 +310,7 @@ def test_instances_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -405,7 +405,7 @@ def test_instances_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -436,7 +436,7 @@ def test_instances_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -467,9 +467,8 @@ def test_instances_client_client_options_from_dict(): ) -def test_list_instances( - transport: str = "grpc", request_type=appengine.ListInstancesRequest -): +@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, ) @@ -496,10 +495,6 @@ def test_list_instances( assert response.next_page_token == "next_page_token_value" -def test_list_instances_from_dict(): - test_list_instances(request_type=dict) - - 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. @@ -601,8 +596,10 @@ async def test_list_instances_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_instances_pager(): - client = InstancesClient(credentials=ga_credentials.AnonymousCredentials,) +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: @@ -639,8 +636,10 @@ def test_list_instances_pager(): assert all(isinstance(i, instance.Instance) for i in results) -def test_list_instances_pages(): - client = InstancesClient(credentials=ga_credentials.AnonymousCredentials,) +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: @@ -739,9 +738,8 @@ async def test_list_instances_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_instance( - transport: str = "grpc", request_type=appengine.GetInstanceRequest -): +@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, ) @@ -798,10 +796,6 @@ def test_get_instance( assert response.vm_liveness == instance.Instance.Liveness.LivenessState.UNKNOWN -def test_get_instance_from_dict(): - test_get_instance(request_type=dict) - - 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. @@ -933,9 +927,8 @@ async def test_get_instance_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_delete_instance( - transport: str = "grpc", request_type=appengine.DeleteInstanceRequest -): +@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, ) @@ -959,10 +952,6 @@ def test_delete_instance( assert isinstance(response, future.Future) -def test_delete_instance_from_dict(): - test_delete_instance(request_type=dict) - - 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. @@ -1063,9 +1052,8 @@ async def test_delete_instance_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_debug_instance( - transport: str = "grpc", request_type=appengine.DebugInstanceRequest -): +@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, ) @@ -1089,10 +1077,6 @@ def test_debug_instance( assert isinstance(response, future.Future) -def test_debug_instance_from_dict(): - test_debug_instance(request_type=dict) - - 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. @@ -1742,7 +1726,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 811d07f..4d8cb2c 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -237,20 +237,20 @@ def test_services_client_client_options(client_class, transport_class, transport # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -307,7 +307,7 @@ def test_services_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -398,7 +398,7 @@ def test_services_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -425,7 +425,7 @@ def test_services_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -456,9 +456,8 @@ def test_services_client_client_options_from_dict(): ) -def test_list_services( - transport: str = "grpc", request_type=appengine.ListServicesRequest -): +@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, ) @@ -485,10 +484,6 @@ def test_list_services( assert response.next_page_token == "next_page_token_value" -def test_list_services_from_dict(): - test_list_services(request_type=dict) - - 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. @@ -590,8 +585,10 @@ async def test_list_services_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_services_pager(): - client = ServicesClient(credentials=ga_credentials.AnonymousCredentials,) +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: @@ -624,8 +621,10 @@ def test_list_services_pager(): assert all(isinstance(i, service.Service) for i in results) -def test_list_services_pages(): - client = ServicesClient(credentials=ga_credentials.AnonymousCredentials,) +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: @@ -712,7 +711,8 @@ async def test_list_services_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_service(transport: str = "grpc", request_type=appengine.GetServiceRequest): +@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, ) @@ -738,10 +738,6 @@ def test_get_service(transport: str = "grpc", request_type=appengine.GetServiceR assert response.id == "id_value" -def test_get_service_from_dict(): - test_get_service(request_type=dict) - - 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. @@ -842,9 +838,8 @@ async def test_get_service_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_update_service( - transport: str = "grpc", request_type=appengine.UpdateServiceRequest -): +@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, ) @@ -868,10 +863,6 @@ def test_update_service( assert isinstance(response, future.Future) -def test_update_service_from_dict(): - test_update_service(request_type=dict) - - 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. @@ -972,9 +963,8 @@ async def test_update_service_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_delete_service( - transport: str = "grpc", request_type=appengine.DeleteServiceRequest -): +@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, ) @@ -998,10 +988,6 @@ def test_delete_service( assert isinstance(response, future.Future) -def test_delete_service_from_dict(): - test_delete_service(request_type=dict) - - 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. @@ -1625,7 +1611,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index ef9622d..047ce45 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -240,20 +240,20 @@ def test_versions_client_client_options(client_class, transport_class, transport # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + 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() + 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(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -310,7 +310,7 @@ def test_versions_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -401,7 +401,7 @@ def test_versions_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -428,7 +428,7 @@ def test_versions_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -459,9 +459,8 @@ def test_versions_client_client_options_from_dict(): ) -def test_list_versions( - transport: str = "grpc", request_type=appengine.ListVersionsRequest -): +@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, ) @@ -488,10 +487,6 @@ def test_list_versions( assert response.next_page_token == "next_page_token_value" -def test_list_versions_from_dict(): - test_list_versions(request_type=dict) - - 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. @@ -593,8 +588,10 @@ async def test_list_versions_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_versions_pager(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials,) +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: @@ -627,8 +624,10 @@ def test_list_versions_pager(): assert all(isinstance(i, version.Version) for i in results) -def test_list_versions_pages(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials,) +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: @@ -715,7 +714,8 @@ async def test_list_versions_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_version(transport: str = "grpc", request_type=appengine.GetVersionRequest): +@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, ) @@ -781,10 +781,6 @@ def test_get_version(transport: str = "grpc", request_type=appengine.GetVersionR assert response.version_url == "version_url_value" -def test_get_version_from_dict(): - test_get_version(request_type=dict) - - 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. @@ -922,9 +918,8 @@ async def test_get_version_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_version( - transport: str = "grpc", request_type=appengine.CreateVersionRequest -): +@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, ) @@ -948,10 +943,6 @@ def test_create_version( assert isinstance(response, future.Future) -def test_create_version_from_dict(): - test_create_version(request_type=dict) - - 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. @@ -1052,9 +1043,8 @@ async def test_create_version_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_update_version( - transport: str = "grpc", request_type=appengine.UpdateVersionRequest -): +@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, ) @@ -1078,10 +1068,6 @@ def test_update_version( assert isinstance(response, future.Future) -def test_update_version_from_dict(): - test_update_version(request_type=dict) - - 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. @@ -1182,9 +1168,8 @@ async def test_update_version_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_delete_version( - transport: str = "grpc", request_type=appengine.DeleteVersionRequest -): +@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, ) @@ -1208,10 +1193,6 @@ def test_delete_version( assert isinstance(response, future.Future) -def test_delete_version_from_dict(): - test_delete_version(request_type=dict) - - 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. @@ -1836,7 +1817,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( From 98d4970dc21e837875addff8dfb759ba9993d47b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 13 Jan 2022 11:53:43 -0500 Subject: [PATCH 072/185] build: switch to release-please for tagging (#95) Source-Link: https://github.com/googleapis/synthtool/commit/f8077d237e0df2cb0066dfc6e09fc41e1c59646a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/release-please.yml | 1 + .github/release-trigger.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .github/release-trigger.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f33299d..ff5126c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 + digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 diff --git a/.github/release-please.yml b/.github/release-please.yml index 4507ad0..466597e 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1 +1,2 @@ releaseType: python +handleGHRelease: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 0000000..d4ca941 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true From 67d231f354f6476b4a5768ce5b3338b1f59d0199 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 14 Jan 2022 11:30:26 -0500 Subject: [PATCH 073/185] chore(python): update release.sh to use keystore (#96) Source-Link: https://github.com/googleapis/synthtool/commit/69fda12e2994f0b595a397e8bb6e3e9f380524eb Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/release.sh | 2 +- .kokoro/release/common.cfg | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ff5126c..eecb84c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 + digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 107a7d9..5bbb5f5 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") +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 index 935c70f..cf3a771 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,8 +23,18 @@ env_vars: { 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,google-cloud-pypi-token" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } From b40f0b6e41c0a42f24e0833c30272c34b6477dd9 Mon Sep 17 00:00:00 2001 From: Dina Graves Portman Date: Thu, 20 Jan 2022 10:56:34 -0500 Subject: [PATCH 074/185] chore: add codeowners (#97) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: add codeowners * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .github/CODEOWNERS | 8 ++++---- .repo-metadata.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e446644..63a84c3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,8 +5,8 @@ # 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 is the default owner for changes in this repo -* @googleapis/yoshi-python +# @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 is the default owner for samples changes -/samples/ @googleapis/python-samples-reviewers +# @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/.repo-metadata.json b/.repo-metadata.json index ea220ae..b3acb0a 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -11,6 +11,6 @@ "distribution_name": "google-cloud-appengine-admin", "api_id": "appengine.googleapis.com", "default_version": "v1", - "codeowner_team": "", + "codeowner_team": "@googleapis/aap-dpes", "api_shortname": "appengine" } From 75cffed5ea15a000d35367e8f75bcf35340e1de1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 20 Jan 2022 14:43:17 -0500 Subject: [PATCH 075/185] ci(python): run lint / unit tests / docs as GH actions (#98) Source-Link: https://github.com/googleapis/synthtool/commit/57be0cdb0b94e1669cee0ca38d790de1dfdbcd44 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 Co-authored-by: Owl Bot Co-authored-by: Dina Graves Portman --- .github/.OwlBot.lock.yaml | 15 ++++++++- .github/workflows/docs.yml | 38 +++++++++++++++++++++++ .github/workflows/lint.yml | 25 +++++++++++++++ .github/workflows/unittest.yml | 57 ++++++++++++++++++++++++++++++++++ 4 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index eecb84c..8cb4380 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,16 @@ +# 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. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 + digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..f7b8344 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +on: + pull_request: + branches: + - main +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - 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@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - 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 new file mode 100644 index 0000000..1e8b05c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - main +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - 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 new file mode 100644 index 0000000..074ee25 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,57 @@ +on: + pull_request: + branches: + - main +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8', '3.9', '3.10'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + 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@v2 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - 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@v2 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=100 From b599bbd35a84381c7622d13cd4358da14b6c211b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 23 Jan 2022 05:39:22 -0500 Subject: [PATCH 076/185] chore(python): set coverage level to 100% (#99) * chore(python): use cov_level in unittest gh action Source-Link: https://github.com/googleapis/synthtool/commit/e5aaa84b1dda1829c54d4696827817f133ed9780 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0 * set coverage to 100% Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 2 +- noxfile.py | 2 +- owlbot.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 8cb4380..39ad3ce 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:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 + digest: sha256:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0 diff --git a/noxfile.py b/noxfile.py index de41c6b..2a2001c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -175,7 +175,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=99") + session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") diff --git a/owlbot.py b/owlbot.py index 73126b5..afb7005 100644 --- a/owlbot.py +++ b/owlbot.py @@ -38,7 +38,7 @@ # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library(cov_level=99, microgenerator=True) +templated_files = common.py_library(cov_level=100, microgenerator=True) # the microgenerator has a good coveragerc file excludes = [".coveragerc"] From 67f3bb4c0fa31f795c6aef4bd19b9a5fe9da0360 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 10:00:08 -0500 Subject: [PATCH 077/185] feat: add api key support (#100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: upgrade gapic-generator-java, gax-java and gapic-generator-python PiperOrigin-RevId: 423842556 Source-Link: https://github.com/googleapis/googleapis/commit/a616ca08f4b1416abbac7bc5dd6d61c791756a81 Source-Link: https://github.com/googleapis/googleapis-gen/commit/29b938c58c1e51d019f2ee539d55dc0a3c86a905 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjliOTM4YzU4YzFlNTFkMDE5ZjJlZTUzOWQ1NWRjMGEzYzg2YTkwNSJ9 * 🦉 Updates from OwlBot 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 | 38 ++++- .../services/applications/client.py | 127 +++++++++++------ .../authorized_certificates/async_client.py | 38 ++++- .../authorized_certificates/client.py | 127 +++++++++++------ .../authorized_domains/async_client.py | 38 ++++- .../services/authorized_domains/client.py | 127 +++++++++++------ .../services/domain_mappings/async_client.py | 38 ++++- .../services/domain_mappings/client.py | 127 +++++++++++------ .../services/firewall/async_client.py | 38 ++++- .../services/firewall/client.py | 127 +++++++++++------ .../services/instances/async_client.py | 38 ++++- .../services/instances/client.py | 127 +++++++++++------ .../services/services/async_client.py | 38 ++++- .../services/services/client.py | 127 +++++++++++------ .../services/versions/async_client.py | 38 ++++- .../services/versions/client.py | 127 +++++++++++------ .../appengine_admin_v1/test_applications.py | 124 ++++++++++++++++ .../test_authorized_certificates.py | 133 ++++++++++++++++++ .../test_authorized_domains.py | 131 +++++++++++++++++ .../test_domain_mappings.py | 128 +++++++++++++++++ .../gapic/appengine_admin_v1/test_firewall.py | 124 ++++++++++++++++ .../appengine_admin_v1/test_instances.py | 124 ++++++++++++++++ .../gapic/appengine_admin_v1/test_services.py | 124 ++++++++++++++++ .../gapic/appengine_admin_v1/test_versions.py | 124 ++++++++++++++++ 24 files changed, 1980 insertions(+), 352 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 84e98ff..56b460c 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -104,6 +104,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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 ApplicationsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> ApplicationsTransport: """Returns the transport used by the client instance. diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 00243e2..995dbde 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -220,6 +220,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -270,57 +337,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -332,6 +364,15 @@ def __init__( ) 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, 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 c7088f1..d65f30c 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -111,6 +111,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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. 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 b07b0c7..0aba697 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -225,6 +225,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -275,57 +342,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -337,6 +369,15 @@ def __init__( ) 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, 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 1f53362..3b3b334 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -108,6 +108,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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. 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 985f66c..a115d45 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -224,6 +224,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -274,57 +341,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -336,6 +368,15 @@ def __init__( ) 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, 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 3ee8535..f413495 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -109,6 +109,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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. 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 19cf402..66bf79e 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -223,6 +223,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -273,57 +340,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -335,6 +367,15 @@ def __init__( ) 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, 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 2f33bd0..44c1bf9 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -108,6 +108,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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. diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 5dd1cfc..877cf33 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -228,6 +228,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -278,57 +345,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -340,6 +372,15 @@ def __init__( ) 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, 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 72c33f6..1aa1d66 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -106,6 +106,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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. diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index d4d7c7c..d7d1855 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -238,6 +238,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -288,57 +355,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -350,6 +382,15 @@ def __init__( ) 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, 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 35dc7a7..4695300 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -102,6 +102,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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. diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index e6327e9..05b3a24 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -222,6 +222,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -272,57 +339,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -334,6 +366,15 @@ def __init__( ) 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, 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 9b0a3f7..18b9e67 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -105,6 +105,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): 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 variabel 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. diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index f541971..cac266b 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -225,6 +225,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: 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 variabel 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, *, @@ -275,57 +342,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + 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: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -337,6 +369,15 @@ def __init__( ) 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, diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 8192150..f330401 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -393,6 +393,83 @@ def test_applications_client_mtls_env_auto( ) +@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", [ @@ -1014,6 +1091,23 @@ def test_credentials_transport_error(): 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(), @@ -1588,3 +1682,33 @@ def test_client_ctx(): 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, + ) 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 d9f284b..6698dae 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -417,6 +417,87 @@ def test_authorized_certificates_client_mtls_env_auto( ) +@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", [ @@ -1497,6 +1578,25 @@ def test_credentials_transport_error(): 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(), @@ -2058,3 +2158,36 @@ def test_client_ctx(): 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, + ) 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 f852bc7..eb2f81b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -411,6 +411,87 @@ def test_authorized_domains_client_mtls_env_auto( ) +@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", [ @@ -812,6 +893,23 @@ def test_credentials_transport_error(): 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(), @@ -1361,3 +1459,36 @@ def test_client_ctx(): 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, + ) 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 e79a31d..b29ab23 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -406,6 +406,87 @@ def test_domain_mappings_client_mtls_env_auto( ) +@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", [ @@ -1379,6 +1460,23 @@ def test_credentials_transport_error(): 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(), @@ -1965,3 +2063,33 @@ def test_client_ctx(): 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, + ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index ceab4ed..b4d7b7b 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -378,6 +378,83 @@ def test_firewall_client_mtls_env_auto( ) +@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", [ @@ -1485,6 +1562,23 @@ def test_credentials_transport_error(): 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(), @@ -2024,3 +2118,33 @@ def test_client_ctx(): 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, + ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 54ec79d..bb5124f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -387,6 +387,83 @@ def test_instances_client_mtls_env_auto( ) +@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", [ @@ -1197,6 +1274,23 @@ def test_credentials_transport_error(): 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(), @@ -1791,3 +1885,33 @@ def test_client_ctx(): 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, + ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 4d8cb2c..492f692 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -384,6 +384,83 @@ def test_services_client_mtls_env_auto( ) +@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", [ @@ -1108,6 +1185,23 @@ def test_credentials_transport_error(): 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(), @@ -1676,3 +1770,33 @@ def test_client_ctx(): 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, + ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 047ce45..205e784 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -387,6 +387,83 @@ def test_versions_client_mtls_env_auto( ) +@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", [ @@ -1313,6 +1390,23 @@ def test_credentials_transport_error(): 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(), @@ -1882,3 +1976,33 @@ def test_client_ctx(): 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, + ) From 70edb2c9a59c360faf18cb0ae1a2a3ac778bd844 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 27 Jan 2022 14:52:31 -0500 Subject: [PATCH 078/185] chore(main): release 1.3.0 (#101) 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 8896aa8..c0b6a28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [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) diff --git a/setup.py b/setup.py index ddec92c..7b42be9 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.2.1" +version = "1.3.0" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From a6ec7acb2f7b0a8acb68bd7de770c299eb9ee8d2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 14:01:05 +0000 Subject: [PATCH 079/185] chore: use gapic-generator-python 0.62.1 (#103) - [ ] Regenerate this pull request now. fix: resolve DuplicateCredentialArgs error when using credentials_file committer: parthea PiperOrigin-RevId: 425964861 Source-Link: https://github.com/googleapis/googleapis/commit/84b1a5a4f6fb2d04905be58e586b8a7a4310a8cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/4fb761bbd8506ac156f49bac5f18306aa8eb3aa8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9 --- .../services/applications/transports/grpc.py | 7 +- .../applications/transports/grpc_asyncio.py | 7 +- .../transports/grpc.py | 5 +- .../transports/grpc_asyncio.py | 5 +- .../authorized_domains/transports/grpc.py | 5 +- .../transports/grpc_asyncio.py | 5 +- .../domain_mappings/transports/grpc.py | 7 +- .../transports/grpc_asyncio.py | 7 +- .../services/firewall/transports/grpc.py | 5 +- .../firewall/transports/grpc_asyncio.py | 5 +- .../services/instances/transports/grpc.py | 7 +- .../instances/transports/grpc_asyncio.py | 7 +- .../services/services/transports/grpc.py | 7 +- .../services/transports/grpc_asyncio.py | 7 +- .../services/versions/transports/grpc.py | 7 +- .../versions/transports/grpc_asyncio.py | 7 +- .../cloud/appengine_admin_v1/types/deploy.py | 4 +- .../cloud/appengine_admin_v1/types/version.py | 7 +- .../appengine_admin_v1/test_applications.py | 84 ++++++++++++++++++- .../test_authorized_certificates.py | 77 ++++++++++++++++- .../test_authorized_domains.py | 83 +++++++++++++++++- .../test_domain_mappings.py | 84 ++++++++++++++++++- .../gapic/appengine_admin_v1/test_firewall.py | 79 ++++++++++++++++- .../appengine_admin_v1/test_instances.py | 74 +++++++++++++++- .../gapic/appengine_admin_v1/test_services.py | 80 +++++++++++++++++- .../gapic/appengine_admin_v1/test_versions.py | 80 +++++++++++++++++- 26 files changed, 694 insertions(+), 58 deletions(-) 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 10e372d..2c18276 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -162,8 +162,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -236,7 +239,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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) 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 c38542d..6f3b544 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 @@ -207,8 +207,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -238,7 +241,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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 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 8771c28..03fc5e7 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 @@ -162,8 +162,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, 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 216cd78..748ce16 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 @@ -207,8 +207,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, 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 7e6d297..4beceb3 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 @@ -160,8 +160,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, 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 d5c20c2..01ff7ed 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 @@ -205,8 +205,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, 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 5b639b9..15a8db9 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 @@ -162,8 +162,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -236,7 +239,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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) 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 c39e110..9cc4ec1 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 @@ -207,8 +207,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -238,7 +241,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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 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 31efb7c..f402df4 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -170,8 +170,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, 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 34da7ca..6c73eb4 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 @@ -215,8 +215,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, 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 d9c39e6..705fff4 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -162,8 +162,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -236,7 +239,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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) 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 cc6873c..d4624f3 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 @@ -207,8 +207,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -238,7 +241,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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 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 47335a4..c4cfb5a 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -162,8 +162,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -236,7 +239,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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) 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 4f6dcac..a6f14f7 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 @@ -207,8 +207,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -238,7 +241,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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 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 a431097..7aca34e 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -162,8 +162,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -236,7 +239,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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) 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 3d36ffd..48735ea 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 @@ -207,8 +207,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # 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, @@ -238,7 +241,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # 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 diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index 0013251..57515dd 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -97,8 +97,8 @@ class ContainerInfo(proto.Message): 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". + "gcr.io/my-project/image:tag" or + "gcr.io/my-project/image@digest". """ image = proto.Field(proto.STRING, number=1,) diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 01d6083..5dcc841 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -251,8 +251,7 @@ class Version(proto.Message): 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" + "https://myversion-dot-myservice-dot-myapp.appspot.com" @OutputOnly endpoints_api_service (google.cloud.appengine_admin_v1.types.EndpointsApiService): Cloud Endpoints configuration. @@ -701,8 +700,8 @@ class VpcAccessConnector(proto.Message): Attributes: name (str): Full Serverless VPC Access Connector name - e.g. /projects/my-project/locations/us- - central1/connectors/c1. + e.g. + /projects/my-project/locations/us-central1/connectors/c1. """ name = proto.Field(proto.STRING, number=1,) diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index f330401..eec9aaa 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -29,6 +29,7 @@ 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 @@ -502,21 +503,28 @@ def test_applications_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (ApplicationsClient, transports.ApplicationsGrpcTransport, "grpc"), + ( + ApplicationsClient, + transports.ApplicationsGrpcTransport, + "grpc", + grpc_helpers, + ), ( ApplicationsAsyncClient, transports.ApplicationsGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_applications_client_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -550,6 +558,76 @@ def test_applications_client_client_options_from_dict(): ) +@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, + ) + + # 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( 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 6698dae..8f65a27 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -534,25 +534,28 @@ def test_authorized_certificates_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "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_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -588,6 +591,76 @@ def test_authorized_certificates_client_client_options_from_dict(): ) +@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, + ) + + # 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,] ) 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 eb2f81b..273410a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -524,21 +524,28 @@ def test_authorized_domains_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (AuthorizedDomainsClient, transports.AuthorizedDomainsGrpcTransport, "grpc"), + ( + AuthorizedDomainsClient, + transports.AuthorizedDomainsGrpcTransport, + "grpc", + grpc_helpers, + ), ( AuthorizedDomainsAsyncClient, transports.AuthorizedDomainsGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_authorized_domains_client_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -574,6 +581,76 @@ def test_authorized_domains_client_client_options_from_dict(): ) +@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, + ) + + # 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,] ) 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 b29ab23..03d713c 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -29,6 +29,7 @@ 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 @@ -519,21 +520,28 @@ def test_domain_mappings_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (DomainMappingsClient, transports.DomainMappingsGrpcTransport, "grpc"), + ( + DomainMappingsClient, + transports.DomainMappingsGrpcTransport, + "grpc", + grpc_helpers, + ), ( DomainMappingsAsyncClient, transports.DomainMappingsGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_domain_mappings_client_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -569,6 +577,76 @@ def test_domain_mappings_client_client_options_from_dict(): ) +@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, + ) + + # 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( diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index b4d7b7b..377b54f 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -483,17 +483,23 @@ def test_firewall_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (FirewallClient, transports.FirewallGrpcTransport, "grpc"), - (FirewallAsyncClient, transports.FirewallGrpcAsyncIOTransport, "grpc_asyncio"), + (FirewallClient, transports.FirewallGrpcTransport, "grpc", grpc_helpers), + ( + FirewallAsyncClient, + transports.FirewallGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), ], ) def test_firewall_client_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -527,6 +533,71 @@ def test_firewall_client_client_options_from_dict(): ) +@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, + ) + + # 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( diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index bb5124f..0fd4808 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -29,6 +29,7 @@ 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 @@ -496,21 +497,23 @@ def test_instances_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (InstancesClient, transports.InstancesGrpcTransport, "grpc"), + (InstancesClient, transports.InstancesGrpcTransport, "grpc", grpc_helpers), ( InstancesAsyncClient, transports.InstancesGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_instances_client_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -544,6 +547,71 @@ def test_instances_client_client_options_from_dict(): ) +@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, + ) + + # 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( diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 492f692..28875a6 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -29,6 +29,7 @@ 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 @@ -489,17 +490,23 @@ def test_services_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (ServicesClient, transports.ServicesGrpcTransport, "grpc"), - (ServicesAsyncClient, transports.ServicesGrpcAsyncIOTransport, "grpc_asyncio"), + (ServicesClient, transports.ServicesGrpcTransport, "grpc", grpc_helpers), + ( + ServicesAsyncClient, + transports.ServicesGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), ], ) def test_services_client_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -533,6 +540,71 @@ def test_services_client_client_options_from_dict(): ) +@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, + ) + + # 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( diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 205e784..e20860a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -29,6 +29,7 @@ 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 @@ -492,17 +493,23 @@ def test_versions_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (VersionsClient, transports.VersionsGrpcTransport, "grpc"), - (VersionsAsyncClient, transports.VersionsGrpcAsyncIOTransport, "grpc_asyncio"), + (VersionsClient, transports.VersionsGrpcTransport, "grpc", grpc_helpers), + ( + VersionsAsyncClient, + transports.VersionsGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), ], ) def test_versions_client_client_options_credentials_file( - client_class, transport_class, transport_name + 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) @@ -536,6 +543,71 @@ def test_versions_client_client_options_from_dict(): ) +@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, + ) + + # 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( From 5f989b948c03c409466b76f8c5853819261b9737 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:18:53 +0000 Subject: [PATCH 080/185] chore: use gapic-generator-python 0.63.1 (#105) - [x] Regenerate this pull request now. docs: add autogenerated code snippets PiperOrigin-RevId: 426256923 Source-Link: https://github.com/googleapis/googleapis/commit/9ebabfa115341b8016b6ed64b22c04260360a8ff Source-Link: https://github.com/googleapis/googleapis-gen/commit/a88175263e60a1d45d3a447848652b0f670b2cb8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTg4MTc1MjYzZTYwYTFkNDVkM2E0NDc4NDg2NTJiMGY2NzBiMmNiOCJ9 --- .../services/applications/async_client.py | 81 + .../services/applications/client.py | 85 + .../authorized_certificates/async_client.py | 88 + .../authorized_certificates/client.py | 93 + .../authorized_domains/async_client.py | 18 + .../services/authorized_domains/client.py | 19 + .../services/domain_mappings/async_client.py | 98 + .../services/domain_mappings/client.py | 103 + .../services/firewall/async_client.py | 105 + .../services/firewall/client.py | 111 + .../services/instances/async_client.py | 78 + .../services/instances/client.py | 82 + .../services/services/async_client.py | 77 + .../services/services/client.py | 81 + .../services/versions/async_client.py | 97 + .../services/versions/client.py | 102 + ...1_applications_create_application_async.py | 46 + ...v1_applications_create_application_sync.py | 46 + ...n_v1_applications_get_application_async.py | 44 + ...in_v1_applications_get_application_sync.py | 44 + ...1_applications_repair_application_async.py | 46 + ...v1_applications_repair_application_sync.py | 46 + ...1_applications_update_application_async.py | 46 + ...v1_applications_update_application_sync.py | 46 + ...tes_create_authorized_certificate_async.py | 44 + ...ates_create_authorized_certificate_sync.py | 44 + ...tes_delete_authorized_certificate_async.py | 42 + ...ates_delete_authorized_certificate_sync.py | 42 + ...icates_get_authorized_certificate_async.py | 44 + ...ficates_get_authorized_certificate_sync.py | 44 + ...ates_list_authorized_certificates_async.py | 43 + ...cates_list_authorized_certificates_sync.py | 43 + ...tes_update_authorized_certificate_async.py | 44 + ...ates_update_authorized_certificate_sync.py | 44 + ...d_domains_list_authorized_domains_async.py | 43 + ...ed_domains_list_authorized_domains_sync.py | 43 + ...in_mappings_create_domain_mapping_async.py | 46 + ...ain_mappings_create_domain_mapping_sync.py | 46 + ...in_mappings_delete_domain_mapping_async.py | 46 + ...ain_mappings_delete_domain_mapping_sync.py | 46 + ...omain_mappings_get_domain_mapping_async.py | 44 + ...domain_mappings_get_domain_mapping_sync.py | 44 + ...ain_mappings_list_domain_mappings_async.py | 43 + ...main_mappings_list_domain_mappings_sync.py | 43 + ...in_mappings_update_domain_mapping_async.py | 46 + ...ain_mappings_update_domain_mapping_sync.py | 46 + ...rewall_batch_update_ingress_rules_async.py | 44 + ...irewall_batch_update_ingress_rules_sync.py | 44 + ...n_v1_firewall_create_ingress_rule_async.py | 44 + ...in_v1_firewall_create_ingress_rule_sync.py | 44 + ...n_v1_firewall_delete_ingress_rule_async.py | 42 + ...in_v1_firewall_delete_ingress_rule_sync.py | 42 + ...dmin_v1_firewall_get_ingress_rule_async.py | 44 + ...admin_v1_firewall_get_ingress_rule_sync.py | 44 + ...in_v1_firewall_list_ingress_rules_async.py | 43 + ...min_v1_firewall_list_ingress_rules_sync.py | 43 + ...n_v1_firewall_update_ingress_rule_async.py | 44 + ...in_v1_firewall_update_ingress_rule_sync.py | 44 + ...admin_v1_instances_debug_instance_async.py | 46 + ..._admin_v1_instances_debug_instance_sync.py | 46 + ...dmin_v1_instances_delete_instance_async.py | 46 + ...admin_v1_instances_delete_instance_sync.py | 46 + ...e_admin_v1_instances_get_instance_async.py | 44 + ...ne_admin_v1_instances_get_instance_sync.py | 44 + ...admin_v1_instances_list_instances_async.py | 43 + ..._admin_v1_instances_list_instances_sync.py | 43 + ..._admin_v1_services_delete_service_async.py | 46 + ...e_admin_v1_services_delete_service_sync.py | 46 + ...ine_admin_v1_services_get_service_async.py | 44 + ...gine_admin_v1_services_get_service_sync.py | 44 + ...e_admin_v1_services_list_services_async.py | 43 + ...ne_admin_v1_services_list_services_sync.py | 43 + ..._admin_v1_services_update_service_async.py | 46 + ...e_admin_v1_services_update_service_sync.py | 46 + ..._admin_v1_versions_create_version_async.py | 46 + ...e_admin_v1_versions_create_version_sync.py | 46 + ..._admin_v1_versions_delete_version_async.py | 46 + ...e_admin_v1_versions_delete_version_sync.py | 46 + ...ine_admin_v1_versions_get_version_async.py | 44 + ...gine_admin_v1_versions_get_version_sync.py | 44 + ...e_admin_v1_versions_list_versions_async.py | 43 + ...ne_admin_v1_versions_list_versions_sync.py | 43 + ..._admin_v1_versions_update_version_async.py | 46 + ...e_admin_v1_versions_update_version_sync.py | 46 + .../snippet_metadata_appengine admin_v1.json | 2942 +++++++++++++++++ 85 files changed, 7282 insertions(+) create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py create mode 100644 samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py create mode 100644 samples/generated_samples/snippet_metadata_appengine admin_v1.json 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 56b460c..8b11c15 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -210,6 +210,24 @@ async def get_application( ) -> application.Application: r"""Gets information about an application. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]): The request object. Request message for @@ -270,6 +288,27 @@ async def create_application( `Managing Projects, Applications, and Billing `__. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]): The request object. Request message for @@ -329,6 +368,27 @@ async def update_application( - ``default_cookie_expiration`` - Cookie expiration policy for the application. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]): The request object. Request message for @@ -398,6 +458,27 @@ async def repair_application( . If the deletion was recent, the numeric ID can be found in the Cloud Console Activity Log. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.RepairApplicationRequest, dict]): The request object. Request message for diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 995dbde..77b6de9 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -395,6 +395,25 @@ def get_application( ) -> application.Application: r"""Gets information about an application. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetApplicationRequest, dict]): The request object. Request message for @@ -456,6 +475,28 @@ def create_application( `Managing Projects, Applications, and Billing `__. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateApplicationRequest, dict]): The request object. Request message for @@ -516,6 +557,28 @@ def update_application( - ``default_cookie_expiration`` - Cookie expiration policy for the application. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateApplicationRequest, dict]): The request object. Request message for @@ -586,6 +649,28 @@ def repair_application( . If the deletion was recent, the numeric ID can be found in the Cloud Console Activity Log. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.RepairApplicationRequest, dict]): The request object. Request message for 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 d65f30c..a71105e 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 @@ -219,6 +219,24 @@ async def list_authorized_certificates( r"""Lists all SSL certificates the user is authorized to administer. + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]): The request object. Request message for @@ -277,6 +295,24 @@ async def get_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]): The request object. Request message for @@ -329,6 +365,24 @@ async def create_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]): The request object. Request message for @@ -386,6 +440,25 @@ async def update_authorized_certificate( certificate. The certificate ``display_name`` may also be updated. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]): The request object. Request message for @@ -438,6 +511,21 @@ async def delete_authorized_certificate( ) -> None: r"""Deletes the specified SSL certificate. + .. code-block:: + + 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 + response = client.delete_authorized_certificate(request=request) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): The request object. Request message for 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 0aba697..1dc32d9 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -401,6 +401,25 @@ def list_authorized_certificates( r"""Lists all SSL certificates the user is authorized to administer. + + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedCertificatesRequest, dict]): The request object. Request message for @@ -462,6 +481,25 @@ def get_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetAuthorizedCertificateRequest, dict]): The request object. Request message for @@ -517,6 +555,25 @@ def create_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateAuthorizedCertificateRequest, dict]): The request object. Request message for @@ -577,6 +634,26 @@ def update_authorized_certificate( certificate. The certificate ``display_name`` may also be updated. + + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateAuthorizedCertificateRequest, dict]): The request object. Request message for @@ -632,6 +709,22 @@ def delete_authorized_certificate( ) -> None: r"""Deletes the specified SSL certificate. + + .. code-block:: + + 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 + response = client.delete_authorized_certificate(request=request) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): The request object. Request message for 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 3b3b334..34a7da2 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 @@ -215,6 +215,24 @@ async def list_authorized_domains( r"""Lists all domains the user is authorized to administer. + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]): The request object. Request message for 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 a115d45..50e6870 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -400,6 +400,25 @@ def list_authorized_domains( r"""Lists all domains the user is authorized to administer. + + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListAuthorizedDomainsRequest, dict]): The request object. Request message for 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 f413495..d00cfb0 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 @@ -215,6 +215,23 @@ async def list_domain_mappings( ) -> pagers.ListDomainMappingsAsyncPager: r"""Lists the domain mappings on an application. + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]): The request object. Request message for @@ -272,6 +289,24 @@ async def get_domain_mapping( ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]): The request object. Request message for @@ -324,6 +359,27 @@ async def create_domain_mapping( list of available authorized domains, see ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]): The request object. Request message for @@ -388,6 +444,27 @@ async def update_domain_mapping( administer the associated domain in order to update a ``DomainMapping`` resource. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]): The request object. Request message for @@ -450,6 +527,27 @@ async def delete_domain_mapping( to administer the associated domain in order to delete a ``DomainMapping`` resource. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]): The request object. Request message for 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 66bf79e..25c963b 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -398,6 +398,24 @@ def list_domain_mappings( ) -> pagers.ListDomainMappingsPager: r"""Lists the domain mappings on an application. + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListDomainMappingsRequest, dict]): The request object. Request message for @@ -456,6 +474,25 @@ def get_domain_mapping( ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetDomainMappingRequest, dict]): The request object. Request message for @@ -509,6 +546,28 @@ def create_domain_mapping( list of available authorized domains, see ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateDomainMappingRequest, dict]): The request object. Request message for @@ -574,6 +633,28 @@ def update_domain_mapping( administer the associated domain in order to update a ``DomainMapping`` resource. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest, dict]): The request object. Request message for @@ -637,6 +718,28 @@ def delete_domain_mapping( to administer the associated domain in order to delete a ``DomainMapping`` resource. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest, dict]): The request object. Request message for 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 44c1bf9..d2ea24f 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -214,6 +214,23 @@ async def list_ingress_rules( ) -> pagers.ListIngressRulesAsyncPager: r"""Lists the firewall rules of an application. + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]): The request object. Request message for @@ -277,6 +294,25 @@ async def batch_update_ingress_rules( IP range, then an "allow all" rule is explicitly added to the end of the list. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]): The request object. Request message for @@ -324,6 +360,24 @@ async def create_ingress_rule( ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]): The request object. Request message for @@ -375,6 +429,24 @@ async def get_ingress_rule( ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]): The request object. Request message for @@ -426,6 +498,24 @@ async def update_ingress_rule( ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]): The request object. Request message for @@ -477,6 +567,21 @@ async def delete_ingress_rule( ) -> None: r"""Deletes the specified firewall rule. + .. code-block:: + + 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 + response = client.delete_ingress_rule(request=request) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): The request object. Request message for diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 877cf33..918615c 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -403,6 +403,24 @@ def list_ingress_rules( ) -> pagers.ListIngressRulesPager: r"""Lists the firewall rules of an application. + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListIngressRulesRequest, dict]): The request object. Request message for @@ -467,6 +485,26 @@ def batch_update_ingress_rules( IP range, then an "allow all" rule is explicitly added to the end of the list. + + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.BatchUpdateIngressRulesRequest, dict]): The request object. Request message for @@ -517,6 +555,25 @@ def create_ingress_rule( ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateIngressRuleRequest, dict]): The request object. Request message for @@ -569,6 +626,25 @@ def get_ingress_rule( ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetIngressRuleRequest, dict]): The request object. Request message for @@ -621,6 +697,25 @@ def update_ingress_rule( ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateIngressRuleRequest, dict]): The request object. Request message for @@ -673,6 +768,22 @@ def delete_ingress_rule( ) -> None: r"""Deletes the specified firewall rule. + + .. code-block:: + + 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 + response = client.delete_ingress_rule(request=request) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): The request object. Request message for 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 1aa1d66..f4c1edf 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -216,6 +216,24 @@ async def list_instances( `Stackdriver Monitoring API `__. + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]): The request object. Request message for @@ -273,6 +291,24 @@ async def get_instance( ) -> instance.Instance: r"""Gets instance information. + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]): The request object. Request message for @@ -337,6 +373,27 @@ async def delete_instance( ```apps.services.versions.patch`` `__ method. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]): The request object. Request message for @@ -416,6 +473,27 @@ async def debug_instance( Only applicable for instances in App Engine flexible environment. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]): The request object. Request message for diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index d7d1855..aec5a8e 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -417,6 +417,25 @@ def list_instances( `Stackdriver Monitoring API `__. + + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListInstancesRequest, dict]): The request object. Request message for @@ -475,6 +494,25 @@ def get_instance( ) -> instance.Instance: r"""Gets instance information. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetInstanceRequest, dict]): The request object. Request message for @@ -540,6 +578,28 @@ def delete_instance( ```apps.services.versions.patch`` `__ method. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteInstanceRequest, dict]): The request object. Request message for @@ -620,6 +680,28 @@ def debug_instance( Only applicable for instances in App Engine flexible environment. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DebugInstanceRequest, dict]): The request object. Request message for 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 4695300..5ce9803 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -208,6 +208,23 @@ async def list_services( ) -> pagers.ListServicesAsyncPager: r"""Lists all the services in the application. + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]): The request object. Request message for @@ -266,6 +283,25 @@ async def get_service( r"""Gets the current configuration of the specified service. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]): The request object. Request message for @@ -325,6 +361,26 @@ async def update_service( ) -> operation_async.AsyncOperation: r"""Updates the configuration of the specified service. + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]): The request object. Request message for @@ -392,6 +448,27 @@ async def delete_service( r"""Deletes the specified service and all enclosed versions. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]): The request object. Request message for diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 05b3a24..8fb4103 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -397,6 +397,24 @@ def list_services( ) -> pagers.ListServicesPager: r"""Lists all the services in the application. + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListServicesRequest, dict]): The request object. Request message for @@ -456,6 +474,26 @@ def get_service( r"""Gets the current configuration of the specified service. + + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetServiceRequest, dict]): The request object. Request message for @@ -516,6 +554,27 @@ def update_service( ) -> gac_operation.Operation: r"""Updates the configuration of the specified service. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateServiceRequest, dict]): The request object. Request message for @@ -584,6 +643,28 @@ def delete_service( r"""Deletes the specified service and all enclosed versions. + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteServiceRequest, dict]): The request object. Request message for 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 18b9e67..8846daf 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -211,6 +211,23 @@ async def list_versions( ) -> pagers.ListVersionsAsyncPager: r"""Lists the versions of a service. + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]): The request object. Request message for @@ -270,6 +287,25 @@ async def get_version( ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` parameter to get the full resource. + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]): The request object. Request message for @@ -320,6 +356,26 @@ async def create_version( ) -> operation_async.AsyncOperation: r"""Deploys code and resource files to a new version. + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]): The request object. Request message for @@ -414,6 +470,27 @@ async def update_version( - ```manual_scaling.instances`` `__ + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]): The request object. Request message for @@ -473,6 +550,26 @@ async def delete_version( ) -> operation_async.AsyncOperation: r"""Deletes an existing Version resource. + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]): The request object. Request message for diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index cac266b..85ed1c9 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -400,6 +400,24 @@ def list_versions( ) -> pagers.ListVersionsPager: r"""Lists the versions of a service. + + .. code-block:: + + 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) + for response in page_result: + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.ListVersionsRequest, dict]): The request object. Request message for @@ -460,6 +478,26 @@ def get_version( ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` parameter to get the full resource. + + + .. code-block:: + + 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 response + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.GetVersionRequest, dict]): The request object. Request message for @@ -511,6 +549,27 @@ def create_version( ) -> gac_operation.Operation: r"""Deploys code and resource files to a new version. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.CreateVersionRequest, dict]): The request object. Request message for @@ -606,6 +665,28 @@ def update_version( - ```manual_scaling.instances`` `__ + + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.UpdateVersionRequest, dict]): The request object. Request message for @@ -666,6 +747,27 @@ def delete_version( ) -> gac_operation.Operation: r"""Deletes an existing Version resource. + + .. code-block:: + + 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() + print(response) + Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteVersionRequest, dict]): The request object. Request message for diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py new file mode 100644 index 0000000..a0f96a5 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_CreateApplication_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_CreateApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py new file mode 100644 index 0000000..d70acdb --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_CreateApplication_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_CreateApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py new file mode 100644 index 0000000..0faa4ad --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_GetApplication_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_GetApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py new file mode 100644 index 0000000..412b38d --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_GetApplication_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_GetApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py new file mode 100644 index 0000000..fd4d1e7 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_RepairApplication_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_RepairApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py new file mode 100644 index 0000000..4f766b8 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_RepairApplication_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_RepairApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py new file mode 100644 index 0000000..d774f8c --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_UpdateApplication_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_UpdateApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py new file mode 100644 index 0000000..e14fb6f --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Applications_UpdateApplication_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Applications_UpdateApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py new file mode 100644 index 0000000..de8c667 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py new file mode 100644 index 0000000..c517d3d --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py new file mode 100644 index 0000000..dce35b4 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_async] +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 + response = await client.delete_authorized_certificate(request=request) + + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py new file mode 100644 index 0000000..7509392 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] +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 + response = client.delete_authorized_certificate(request=request) + + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py new file mode 100644 index 0000000..e70c0e1 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py new file mode 100644 index 0000000..5f8a833 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py new file mode 100644 index 0000000..3ac7df3 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_async] +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) + async for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py new file mode 100644 index 0000000..96e4ea9 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_sync] +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) + for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py new file mode 100644 index 0000000..be1b229 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py new file mode 100644 index 0000000..312a568 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py new file mode 100644 index 0000000..51d3f9a --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_async] +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) + async for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py new file mode 100644 index 0000000..bc71523 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_sync] +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) + for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py new file mode 100644 index 0000000..7f34ef2 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py new file mode 100644 index 0000000..fa05ce7 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py new file mode 100644 index 0000000..135d256 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py new file mode 100644 index 0000000..df31ec1 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py new file mode 100644 index 0000000..c0925c1 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py new file mode 100644 index 0000000..ddb713b --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py new file mode 100644 index 0000000..db6685f --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_async] +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) + async for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py new file mode 100644 index 0000000..e1f469d --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_sync] +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) + for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py new file mode 100644 index 0000000..882c1d9 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py new file mode 100644 index 0000000..2acab93 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py new file mode 100644 index 0000000..f76f06d --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py new file mode 100644 index 0000000..1fce269 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py new file mode 100644 index 0000000..762149b --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_CreateIngressRule_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py new file mode 100644 index 0000000..16a5a1a --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_CreateIngressRule_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py new file mode 100644 index 0000000..ebd7306 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_DeleteIngressRule_async] +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 + response = await client.delete_ingress_rule(request=request) + + +# [END appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py new file mode 100644 index 0000000..be2cf11 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_DeleteIngressRule_sync] +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 + response = client.delete_ingress_rule(request=request) + + +# [END appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py new file mode 100644 index 0000000..646591a --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_GetIngressRule_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py new file mode 100644 index 0000000..c564d74 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_GetIngressRule_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py new file mode 100644 index 0000000..dc43797 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_ListIngressRules_async] +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) + async for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py new file mode 100644 index 0000000..e8f39e3 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_ListIngressRules_sync] +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) + for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py new file mode 100644 index 0000000..148f247 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_UpdateIngressRule_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py new file mode 100644 index 0000000..d268644 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Firewall_UpdateIngressRule_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py new file mode 100644 index 0000000..49451b2 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_DebugInstance_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_DebugInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py new file mode 100644 index 0000000..ef4c6de --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_DebugInstance_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_DebugInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py new file mode 100644 index 0000000..a529766 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_DeleteInstance_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_DeleteInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py new file mode 100644 index 0000000..3fab3d9 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_DeleteInstance_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_DeleteInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py new file mode 100644 index 0000000..fca870f --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_GetInstance_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_GetInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py new file mode 100644 index 0000000..b09de0f --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_GetInstance_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_GetInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py new file mode 100644 index 0000000..509fe07 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_ListInstances_async] +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) + async for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_ListInstances_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py new file mode 100644 index 0000000..be8017d --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Instances_ListInstances_sync] +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) + for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Instances_ListInstances_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py new file mode 100644 index 0000000..d7cfb69 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_DeleteService_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_DeleteService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py new file mode 100644 index 0000000..84cf4ed --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_DeleteService_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_DeleteService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py new file mode 100644 index 0000000..b813c19 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_GetService_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_GetService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py new file mode 100644 index 0000000..7a8d499 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_GetService_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_GetService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py new file mode 100644 index 0000000..d6b9285 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_ListServices_async] +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) + async for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_ListServices_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py new file mode 100644 index 0000000..1e780b6 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_ListServices_sync] +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) + for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_ListServices_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py new file mode 100644 index 0000000..4586000 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_UpdateService_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_UpdateService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py new file mode 100644 index 0000000..2d4b34a --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Services_UpdateService_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Services_UpdateService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py new file mode 100644 index 0000000..3581a16 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_CreateVersion_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_CreateVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py new file mode 100644 index 0000000..da9d3ee --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_CreateVersion_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_CreateVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py new file mode 100644 index 0000000..b1d3cec --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_DeleteVersion_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_DeleteVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py new file mode 100644 index 0000000..ba4f4f5 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_DeleteVersion_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_DeleteVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py new file mode 100644 index 0000000..f7deb61 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_GetVersion_async] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_GetVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py new file mode 100644 index 0000000..eeb9c7d --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_GetVersion_sync] +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 response + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_GetVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py new file mode 100644 index 0000000..2d5b0e6 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_ListVersions_async] +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) + async for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_ListVersions_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py new file mode 100644 index 0000000..c7979bc --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_ListVersions_sync] +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) + for response in page_result: + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_ListVersions_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py new file mode 100644 index 0000000..11537b1 --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_UpdateVersion_async] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_UpdateVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py new file mode 100644 index 0000000..50cff1c --- /dev/null +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# 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_generated_appengine_admin_v1_Versions_UpdateVersion_sync] +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() + print(response) + +# [END appengine_generated_appengine_admin_v1_Versions_UpdateVersion_sync] diff --git a/samples/generated_samples/snippet_metadata_appengine admin_v1.json b/samples/generated_samples/snippet_metadata_appengine admin_v1.json new file mode 100644 index 0000000..401edb9 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_appengine admin_v1.json @@ -0,0 +1,2942 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "CreateApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_create_application_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_CreateApplication_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "CreateApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_create_application_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_CreateApplication_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "GetApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_get_application_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_GetApplication_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "GetApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_get_application_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_GetApplication_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "RepairApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_repair_application_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_RepairApplication_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "RepairApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_repair_application_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_RepairApplication_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "UpdateApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_update_application_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_UpdateApplication_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Applications" + }, + "shortName": "UpdateApplication" + } + }, + "file": "appengine_generated_appengine_admin_v1_applications_update_application_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Applications_UpdateApplication_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "CreateAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "CreateAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "DeleteAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_async", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "DeleteAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_sync", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "GetAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "GetAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "ListAuthorizedCertificates" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "ListAuthorizedCertificates" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "UpdateAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AuthorizedCertificates" + }, + "shortName": "UpdateAuthorizedCertificate" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "AuthorizedDomains" + }, + "shortName": "ListAuthorizedDomains" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "AuthorizedDomains" + }, + "shortName": "ListAuthorizedDomains" + } + }, + "file": "appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "CreateDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "CreateDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "DeleteDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "DeleteDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "GetDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "GetDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "ListDomainMappings" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "ListDomainMappings" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "UpdateDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "DomainMappings" + }, + "shortName": "UpdateDomainMapping" + } + }, + "file": "appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "BatchUpdateIngressRules" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "BatchUpdateIngressRules" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "CreateIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "CreateIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "DeleteIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_async", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "DeleteIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_sync", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "GetIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "GetIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "ListIngressRules" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "ListIngressRules" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "UpdateIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Firewall" + }, + "shortName": "UpdateIngressRule" + } + }, + "file": "appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "DebugInstance" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_debug_instance_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_DebugInstance_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "DebugInstance" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_DebugInstance_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "DeleteInstance" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_delete_instance_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_DeleteInstance_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "DeleteInstance" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_DeleteInstance_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "GetInstance" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_get_instance_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_GetInstance_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "GetInstance" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_get_instance_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_GetInstance_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "ListInstances" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_list_instances_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_ListInstances_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Instances" + }, + "shortName": "ListInstances" + } + }, + "file": "appengine_generated_appengine_admin_v1_instances_list_instances_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Instances_ListInstances_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "DeleteService" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_delete_service_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_DeleteService_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "DeleteService" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_delete_service_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_DeleteService_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "GetService" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_get_service_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_GetService_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "GetService" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_get_service_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_GetService_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "ListServices" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_list_services_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_ListServices_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "ListServices" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_list_services_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_ListServices_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "UpdateService" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_update_service_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_UpdateService_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Services" + }, + "shortName": "UpdateService" + } + }, + "file": "appengine_generated_appengine_admin_v1_services_update_service_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Services_UpdateService_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "CreateVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_create_version_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_CreateVersion_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "CreateVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_create_version_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_CreateVersion_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "DeleteVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_delete_version_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_DeleteVersion_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "DeleteVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_delete_version_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_DeleteVersion_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "GetVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_get_version_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_GetVersion_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "GetVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_get_version_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_GetVersion_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "ListVersions" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_list_versions_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_ListVersions_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "ListVersions" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_list_versions_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_ListVersions_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "UpdateVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_update_version_async.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_UpdateVersion_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Versions" + }, + "shortName": "UpdateVersion" + } + }, + "file": "appengine_generated_appengine_admin_v1_versions_update_version_sync.py", + "regionTag": "appengine_generated_appengine_admin_v1_Versions_UpdateVersion_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} From 1900a84b13583ea87103c7eb90054257fd1f4641 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:11:47 -0700 Subject: [PATCH 081/185] chore: edit generated snippet formatting (#106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: https://github.com/googleapis/googleapis/commit/55b9e1e0b3106c850d13958352bc0751147b6b15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bf4e86b753f42cb0edb1fd51fbe840d7da0a1cde Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot 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 | 8 +- .../services/applications/client.py | 8 +- .../authorized_certificates/async_client.py | 10 +- .../authorized_certificates/client.py | 10 +- .../authorized_domains/async_client.py | 2 + .../services/authorized_domains/client.py | 2 + .../services/domain_mappings/async_client.py | 10 +- .../services/domain_mappings/client.py | 10 +- .../services/firewall/async_client.py | 12 +- .../services/firewall/client.py | 12 +- .../services/instances/async_client.py | 8 +- .../services/instances/client.py | 8 +- .../services/services/async_client.py | 8 +- .../services/services/client.py | 8 +- .../services/versions/async_client.py | 10 +- .../services/versions/client.py | 10 +- ...1_applications_create_application_async.py | 2 + ...v1_applications_create_application_sync.py | 2 + ...n_v1_applications_get_application_async.py | 2 +- ...in_v1_applications_get_application_sync.py | 2 +- ...1_applications_repair_application_async.py | 2 + ...v1_applications_repair_application_sync.py | 2 + ...1_applications_update_application_async.py | 2 + ...v1_applications_update_application_sync.py | 2 + ...tes_create_authorized_certificate_async.py | 2 +- ...ates_create_authorized_certificate_sync.py | 2 +- ...tes_delete_authorized_certificate_async.py | 2 +- ...ates_delete_authorized_certificate_sync.py | 2 +- ...icates_get_authorized_certificate_async.py | 2 +- ...ficates_get_authorized_certificate_sync.py | 2 +- ...ates_list_authorized_certificates_async.py | 2 + ...cates_list_authorized_certificates_sync.py | 2 + ...tes_update_authorized_certificate_async.py | 2 +- ...ates_update_authorized_certificate_sync.py | 2 +- ...d_domains_list_authorized_domains_async.py | 2 + ...ed_domains_list_authorized_domains_sync.py | 2 + ...in_mappings_create_domain_mapping_async.py | 2 + ...ain_mappings_create_domain_mapping_sync.py | 2 + ...in_mappings_delete_domain_mapping_async.py | 2 + ...ain_mappings_delete_domain_mapping_sync.py | 2 + ...omain_mappings_get_domain_mapping_async.py | 2 +- ...domain_mappings_get_domain_mapping_sync.py | 2 +- ...ain_mappings_list_domain_mappings_async.py | 2 + ...main_mappings_list_domain_mappings_sync.py | 2 + ...in_mappings_update_domain_mapping_async.py | 2 + ...ain_mappings_update_domain_mapping_sync.py | 2 + ...rewall_batch_update_ingress_rules_async.py | 2 +- ...irewall_batch_update_ingress_rules_sync.py | 2 +- ...n_v1_firewall_create_ingress_rule_async.py | 2 +- ...in_v1_firewall_create_ingress_rule_sync.py | 2 +- ...n_v1_firewall_delete_ingress_rule_async.py | 2 +- ...in_v1_firewall_delete_ingress_rule_sync.py | 2 +- ...dmin_v1_firewall_get_ingress_rule_async.py | 2 +- ...admin_v1_firewall_get_ingress_rule_sync.py | 2 +- ...in_v1_firewall_list_ingress_rules_async.py | 2 + ...min_v1_firewall_list_ingress_rules_sync.py | 2 + ...n_v1_firewall_update_ingress_rule_async.py | 2 +- ...in_v1_firewall_update_ingress_rule_sync.py | 2 +- ...admin_v1_instances_debug_instance_async.py | 2 + ..._admin_v1_instances_debug_instance_sync.py | 2 + ...dmin_v1_instances_delete_instance_async.py | 2 + ...admin_v1_instances_delete_instance_sync.py | 2 + ...e_admin_v1_instances_get_instance_async.py | 2 +- ...ne_admin_v1_instances_get_instance_sync.py | 2 +- ...admin_v1_instances_list_instances_async.py | 2 + ..._admin_v1_instances_list_instances_sync.py | 2 + ..._admin_v1_services_delete_service_async.py | 2 + ...e_admin_v1_services_delete_service_sync.py | 2 + ...ine_admin_v1_services_get_service_async.py | 2 +- ...gine_admin_v1_services_get_service_sync.py | 2 +- ...e_admin_v1_services_list_services_async.py | 2 + ...ne_admin_v1_services_list_services_sync.py | 2 + ..._admin_v1_services_update_service_async.py | 2 + ...e_admin_v1_services_update_service_sync.py | 2 + ..._admin_v1_versions_create_version_async.py | 2 + ...e_admin_v1_versions_create_version_sync.py | 2 + ..._admin_v1_versions_delete_version_async.py | 2 + ...e_admin_v1_versions_delete_version_sync.py | 2 + ...ine_admin_v1_versions_get_version_async.py | 2 +- ...gine_admin_v1_versions_get_version_sync.py | 2 +- ...e_admin_v1_versions_list_versions_async.py | 2 + ...ne_admin_v1_versions_list_versions_sync.py | 2 + ..._admin_v1_versions_update_version_async.py | 2 + ...e_admin_v1_versions_update_version_sync.py | 2 + .../snippet_metadata_appengine admin_v1.json | 320 +++++++++++------- 85 files changed, 416 insertions(+), 176 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 8b11c15..c69e9dc 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -225,7 +225,7 @@ def sample_get_application(): # Make the request response = client.get_application(request=request) - # Handle response + # Handle the response print(response) Args: @@ -307,6 +307,8 @@ def sample_create_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -387,6 +389,8 @@ def sample_update_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -477,6 +481,8 @@ def sample_repair_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 77b6de9..ecbe0ae 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -411,7 +411,7 @@ def sample_get_application(): # Make the request response = client.get_application(request=request) - # Handle response + # Handle the response print(response) Args: @@ -495,6 +495,8 @@ def sample_create_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -577,6 +579,8 @@ def sample_update_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -669,6 +673,8 @@ def sample_repair_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: 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 a71105e..13a510a 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 @@ -234,6 +234,8 @@ def sample_list_authorized_certificates(): # Make the request page_result = client.list_authorized_certificates(request=request) + + # Handle the response for response in page_result: print(response) @@ -310,7 +312,7 @@ def sample_get_authorized_certificate(): # Make the request response = client.get_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) Args: @@ -380,7 +382,7 @@ def sample_create_authorized_certificate(): # Make the request response = client.create_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) Args: @@ -456,7 +458,7 @@ def sample_update_authorized_certificate(): # Make the request response = client.update_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) Args: @@ -524,7 +526,7 @@ def sample_delete_authorized_certificate(): ) # Make the request - response = client.delete_authorized_certificate(request=request) + client.delete_authorized_certificate(request=request) Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): 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 1dc32d9..8da7809 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -417,6 +417,8 @@ def sample_list_authorized_certificates(): # Make the request page_result = client.list_authorized_certificates(request=request) + + # Handle the response for response in page_result: print(response) @@ -497,7 +499,7 @@ def sample_get_authorized_certificate(): # Make the request response = client.get_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) Args: @@ -571,7 +573,7 @@ def sample_create_authorized_certificate(): # Make the request response = client.create_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) Args: @@ -651,7 +653,7 @@ def sample_update_authorized_certificate(): # Make the request response = client.update_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) Args: @@ -723,7 +725,7 @@ def sample_delete_authorized_certificate(): ) # Make the request - response = client.delete_authorized_certificate(request=request) + client.delete_authorized_certificate(request=request) Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): 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 34a7da2..80eba40 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 @@ -230,6 +230,8 @@ def sample_list_authorized_domains(): # Make the request page_result = client.list_authorized_domains(request=request) + + # Handle the response for response in page_result: print(response) 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 50e6870..b6180de 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -416,6 +416,8 @@ def sample_list_authorized_domains(): # Make the request page_result = client.list_authorized_domains(request=request) + + # Handle the response for response in page_result: print(response) 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 d00cfb0..eb1f00d 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 @@ -229,6 +229,8 @@ def sample_list_domain_mappings(): # Make the request page_result = client.list_domain_mappings(request=request) + + # Handle the response for response in page_result: print(response) @@ -304,7 +306,7 @@ def sample_get_domain_mapping(): # Make the request response = client.get_domain_mapping(request=request) - # Handle response + # Handle the response print(response) Args: @@ -378,6 +380,8 @@ def sample_create_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -463,6 +467,8 @@ def sample_update_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -546,6 +552,8 @@ def sample_delete_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: 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 25c963b..d1910b8 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -413,6 +413,8 @@ def sample_list_domain_mappings(): # Make the request page_result = client.list_domain_mappings(request=request) + + # Handle the response for response in page_result: print(response) @@ -490,7 +492,7 @@ def sample_get_domain_mapping(): # Make the request response = client.get_domain_mapping(request=request) - # Handle response + # Handle the response print(response) Args: @@ -566,6 +568,8 @@ def sample_create_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -653,6 +657,8 @@ def sample_update_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -738,6 +744,8 @@ def sample_delete_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: 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 d2ea24f..8064078 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -228,6 +228,8 @@ def sample_list_ingress_rules(): # Make the request page_result = client.list_ingress_rules(request=request) + + # Handle the response for response in page_result: print(response) @@ -310,7 +312,7 @@ def sample_batch_update_ingress_rules(): # Make the request response = client.batch_update_ingress_rules(request=request) - # Handle response + # Handle the response print(response) Args: @@ -375,7 +377,7 @@ def sample_create_ingress_rule(): # Make the request response = client.create_ingress_rule(request=request) - # Handle response + # Handle the response print(response) Args: @@ -444,7 +446,7 @@ def sample_get_ingress_rule(): # Make the request response = client.get_ingress_rule(request=request) - # Handle response + # Handle the response print(response) Args: @@ -513,7 +515,7 @@ def sample_update_ingress_rule(): # Make the request response = client.update_ingress_rule(request=request) - # Handle response + # Handle the response print(response) Args: @@ -580,7 +582,7 @@ def sample_delete_ingress_rule(): ) # Make the request - response = client.delete_ingress_rule(request=request) + client.delete_ingress_rule(request=request) Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 918615c..aa26f0a 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -418,6 +418,8 @@ def sample_list_ingress_rules(): # Make the request page_result = client.list_ingress_rules(request=request) + + # Handle the response for response in page_result: print(response) @@ -502,7 +504,7 @@ def sample_batch_update_ingress_rules(): # Make the request response = client.batch_update_ingress_rules(request=request) - # Handle response + # Handle the response print(response) Args: @@ -571,7 +573,7 @@ def sample_create_ingress_rule(): # Make the request response = client.create_ingress_rule(request=request) - # Handle response + # Handle the response print(response) Args: @@ -642,7 +644,7 @@ def sample_get_ingress_rule(): # Make the request response = client.get_ingress_rule(request=request) - # Handle response + # Handle the response print(response) Args: @@ -713,7 +715,7 @@ def sample_update_ingress_rule(): # Make the request response = client.update_ingress_rule(request=request) - # Handle response + # Handle the response print(response) Args: @@ -782,7 +784,7 @@ def sample_delete_ingress_rule(): ) # Make the request - response = client.delete_ingress_rule(request=request) + client.delete_ingress_rule(request=request) Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): 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 f4c1edf..b3d2332 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -231,6 +231,8 @@ def sample_list_instances(): # Make the request page_result = client.list_instances(request=request) + + # Handle the response for response in page_result: print(response) @@ -306,7 +308,7 @@ def sample_get_instance(): # Make the request response = client.get_instance(request=request) - # Handle response + # Handle the response print(response) Args: @@ -392,6 +394,8 @@ def sample_delete_instance(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -492,6 +496,8 @@ def sample_debug_instance(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index aec5a8e..ea87ee9 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -433,6 +433,8 @@ def sample_list_instances(): # Make the request page_result = client.list_instances(request=request) + + # Handle the response for response in page_result: print(response) @@ -510,7 +512,7 @@ def sample_get_instance(): # Make the request response = client.get_instance(request=request) - # Handle response + # Handle the response print(response) Args: @@ -598,6 +600,8 @@ def sample_delete_instance(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -700,6 +704,8 @@ def sample_debug_instance(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: 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 5ce9803..59ffd28 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -222,6 +222,8 @@ def sample_list_services(): # Make the request page_result = client.list_services(request=request) + + # Handle the response for response in page_result: print(response) @@ -299,7 +301,7 @@ def sample_get_service(): # Make the request response = client.get_service(request=request) - # Handle response + # Handle the response print(response) Args: @@ -379,6 +381,8 @@ def sample_update_service(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -467,6 +471,8 @@ def sample_delete_service(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 8fb4103..8bf21ea 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -412,6 +412,8 @@ def sample_list_services(): # Make the request page_result = client.list_services(request=request) + + # Handle the response for response in page_result: print(response) @@ -491,7 +493,7 @@ def sample_get_service(): # Make the request response = client.get_service(request=request) - # Handle response + # Handle the response print(response) Args: @@ -573,6 +575,8 @@ def sample_update_service(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -663,6 +667,8 @@ def sample_delete_service(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: 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 8846daf..a868123 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -225,6 +225,8 @@ def sample_list_versions(): # Make the request page_result = client.list_versions(request=request) + + # Handle the response for response in page_result: print(response) @@ -303,7 +305,7 @@ def sample_get_version(): # Make the request response = client.get_version(request=request) - # Handle response + # Handle the response print(response) Args: @@ -374,6 +376,8 @@ def sample_create_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -489,6 +493,8 @@ def sample_update_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -568,6 +574,8 @@ def sample_delete_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 85ed1c9..9ba60bf 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -415,6 +415,8 @@ def sample_list_versions(): # Make the request page_result = client.list_versions(request=request) + + # Handle the response for response in page_result: print(response) @@ -495,7 +497,7 @@ def sample_get_version(): # Make the request response = client.get_version(request=request) - # Handle response + # Handle the response print(response) Args: @@ -568,6 +570,8 @@ def sample_create_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -685,6 +689,8 @@ def sample_update_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: @@ -766,6 +772,8 @@ def sample_delete_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) Args: diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py index a0f96a5..c34a123 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py @@ -41,6 +41,8 @@ async def sample_create_application(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_CreateApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py index d70acdb..0d67311 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py @@ -41,6 +41,8 @@ def sample_create_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_CreateApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py index 0faa4ad..21ca165 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py @@ -38,7 +38,7 @@ async def sample_get_application(): # Make the request response = await client.get_application(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_GetApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py index 412b38d..7312932 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py @@ -38,7 +38,7 @@ def sample_get_application(): # Make the request response = client.get_application(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_GetApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py index fd4d1e7..7bfcdab 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py @@ -41,6 +41,8 @@ async def sample_repair_application(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_RepairApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py index 4f766b8..c895045 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py @@ -41,6 +41,8 @@ def sample_repair_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_RepairApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py index d774f8c..0dd71ed 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py @@ -41,6 +41,8 @@ async def sample_update_application(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_UpdateApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py index e14fb6f..deb4c69 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py @@ -41,6 +41,8 @@ def sample_update_application(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Applications_UpdateApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py index de8c667..1e38324 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py @@ -38,7 +38,7 @@ async def sample_create_authorized_certificate(): # Make the request response = await client.create_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py index c517d3d..4d181c9 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py @@ -38,7 +38,7 @@ def sample_create_authorized_certificate(): # Make the request response = client.create_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py index dce35b4..ec01c88 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py @@ -36,7 +36,7 @@ async def sample_delete_authorized_certificate(): ) # Make the request - response = await client.delete_authorized_certificate(request=request) + await client.delete_authorized_certificate(request=request) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py index 7509392..6662568 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py @@ -36,7 +36,7 @@ def sample_delete_authorized_certificate(): ) # Make the request - response = client.delete_authorized_certificate(request=request) + client.delete_authorized_certificate(request=request) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py index e70c0e1..b617455 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py @@ -38,7 +38,7 @@ async def sample_get_authorized_certificate(): # Make the request response = await client.get_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py index 5f8a833..a8422a3 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py @@ -38,7 +38,7 @@ def sample_get_authorized_certificate(): # Make the request response = client.get_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py index 3ac7df3..85ab298 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py @@ -37,6 +37,8 @@ async def sample_list_authorized_certificates(): # Make the request page_result = client.list_authorized_certificates(request=request) + + # Handle the response async for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py index 96e4ea9..7abfea5 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py @@ -37,6 +37,8 @@ def sample_list_authorized_certificates(): # Make the request page_result = client.list_authorized_certificates(request=request) + + # Handle the response for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py index be1b229..112d041 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py @@ -38,7 +38,7 @@ async def sample_update_authorized_certificate(): # Make the request response = await client.update_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py index 312a568..5eea12d 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py @@ -38,7 +38,7 @@ def sample_update_authorized_certificate(): # Make the request response = client.update_authorized_certificate(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py index 51d3f9a..b041f1b 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py @@ -37,6 +37,8 @@ async def sample_list_authorized_domains(): # Make the request page_result = client.list_authorized_domains(request=request) + + # Handle the response async for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py index bc71523..ea09e6f 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py @@ -37,6 +37,8 @@ def sample_list_authorized_domains(): # Make the request page_result = client.list_authorized_domains(request=request) + + # Handle the response for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py index 7f34ef2..fa88438 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py @@ -41,6 +41,8 @@ async def sample_create_domain_mapping(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py index fa05ce7..4894e98 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py @@ -41,6 +41,8 @@ def sample_create_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py index 135d256..6997ebf 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py @@ -41,6 +41,8 @@ async def sample_delete_domain_mapping(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py index df31ec1..357c309 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py @@ -41,6 +41,8 @@ def sample_delete_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py index c0925c1..7f5db9b 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py @@ -38,7 +38,7 @@ async def sample_get_domain_mapping(): # Make the request response = await client.get_domain_mapping(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py index ddb713b..33f8d48 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py @@ -38,7 +38,7 @@ def sample_get_domain_mapping(): # Make the request response = client.get_domain_mapping(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py index db6685f..b849046 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py @@ -37,6 +37,8 @@ async def sample_list_domain_mappings(): # Make the request page_result = client.list_domain_mappings(request=request) + + # Handle the response async for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py index e1f469d..7c79bd5 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py @@ -37,6 +37,8 @@ def sample_list_domain_mappings(): # Make the request page_result = client.list_domain_mappings(request=request) + + # Handle the response for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py index 882c1d9..2308454 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py @@ -41,6 +41,8 @@ async def sample_update_domain_mapping(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py index 2acab93..56509fb 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py @@ -41,6 +41,8 @@ def sample_update_domain_mapping(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py index f76f06d..540475c 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py @@ -38,7 +38,7 @@ async def sample_batch_update_ingress_rules(): # Make the request response = await client.batch_update_ingress_rules(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py index 1fce269..39b894b 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py @@ -38,7 +38,7 @@ def sample_batch_update_ingress_rules(): # Make the request response = client.batch_update_ingress_rules(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py index 762149b..536efe1 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py @@ -38,7 +38,7 @@ async def sample_create_ingress_rule(): # Make the request response = await client.create_ingress_rule(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py index 16a5a1a..ec53255 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py @@ -38,7 +38,7 @@ def sample_create_ingress_rule(): # Make the request response = client.create_ingress_rule(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py index ebd7306..01c5686 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py @@ -36,7 +36,7 @@ async def sample_delete_ingress_rule(): ) # Make the request - response = await client.delete_ingress_rule(request=request) + await client.delete_ingress_rule(request=request) # [END appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py index be2cf11..1b2135f 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py @@ -36,7 +36,7 @@ def sample_delete_ingress_rule(): ) # Make the request - response = client.delete_ingress_rule(request=request) + client.delete_ingress_rule(request=request) # [END appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py index 646591a..63a6964 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py @@ -38,7 +38,7 @@ async def sample_get_ingress_rule(): # Make the request response = await client.get_ingress_rule(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py index c564d74..b2f08ee 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py @@ -38,7 +38,7 @@ def sample_get_ingress_rule(): # Make the request response = client.get_ingress_rule(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py index dc43797..3de7fd6 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py @@ -37,6 +37,8 @@ async def sample_list_ingress_rules(): # Make the request page_result = client.list_ingress_rules(request=request) + + # Handle the response async for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py index e8f39e3..1420685 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py @@ -37,6 +37,8 @@ def sample_list_ingress_rules(): # Make the request page_result = client.list_ingress_rules(request=request) + + # Handle the response for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py index 148f247..9bdd21e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py @@ -38,7 +38,7 @@ async def sample_update_ingress_rule(): # Make the request response = await client.update_ingress_rule(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py index d268644..3999824 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py @@ -38,7 +38,7 @@ def sample_update_ingress_rule(): # Make the request response = client.update_ingress_rule(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py index 49451b2..27d01dd 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py @@ -41,6 +41,8 @@ async def sample_debug_instance(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Instances_DebugInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py index ef4c6de..ce235f5 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py @@ -41,6 +41,8 @@ def sample_debug_instance(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Instances_DebugInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py index a529766..136e0bf 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py @@ -41,6 +41,8 @@ async def sample_delete_instance(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Instances_DeleteInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py index 3fab3d9..0f8da37 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py @@ -41,6 +41,8 @@ def sample_delete_instance(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Instances_DeleteInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py index fca870f..2878e91 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py @@ -38,7 +38,7 @@ async def sample_get_instance(): # Make the request response = await client.get_instance(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Instances_GetInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py index b09de0f..f5ffb81 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py @@ -38,7 +38,7 @@ def sample_get_instance(): # Make the request response = client.get_instance(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Instances_GetInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py index 509fe07..7ff6406 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py @@ -37,6 +37,8 @@ async def sample_list_instances(): # Make the request page_result = client.list_instances(request=request) + + # Handle the response async for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py index be8017d..6696bbf 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py @@ -37,6 +37,8 @@ def sample_list_instances(): # Make the request page_result = client.list_instances(request=request) + + # Handle the response for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py index d7cfb69..b925671 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py @@ -41,6 +41,8 @@ async def sample_delete_service(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Services_DeleteService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py index 84cf4ed..bcac49a 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py @@ -41,6 +41,8 @@ def sample_delete_service(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Services_DeleteService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py index b813c19..0661298 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py @@ -38,7 +38,7 @@ async def sample_get_service(): # Make the request response = await client.get_service(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Services_GetService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py index 7a8d499..317c153 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py @@ -38,7 +38,7 @@ def sample_get_service(): # Make the request response = client.get_service(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Services_GetService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py index d6b9285..015baad 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py @@ -37,6 +37,8 @@ async def sample_list_services(): # Make the request page_result = client.list_services(request=request) + + # Handle the response async for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py index 1e780b6..db2aa51 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py @@ -37,6 +37,8 @@ def sample_list_services(): # Make the request page_result = client.list_services(request=request) + + # Handle the response for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py index 4586000..525ddb5 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py @@ -41,6 +41,8 @@ async def sample_update_service(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Services_UpdateService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py index 2d4b34a..71003cc 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py @@ -41,6 +41,8 @@ def sample_update_service(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Services_UpdateService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py index 3581a16..3cbbb46 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py @@ -41,6 +41,8 @@ async def sample_create_version(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_CreateVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py index da9d3ee..11b4039 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py @@ -41,6 +41,8 @@ def sample_create_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_CreateVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py index b1d3cec..e4de769 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py @@ -41,6 +41,8 @@ async def sample_delete_version(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_DeleteVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py index ba4f4f5..9026697 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py @@ -41,6 +41,8 @@ def sample_delete_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_DeleteVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py index f7deb61..79b8514 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py @@ -38,7 +38,7 @@ async def sample_get_version(): # Make the request response = await client.get_version(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_GetVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py index eeb9c7d..df30676 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py @@ -38,7 +38,7 @@ def sample_get_version(): # Make the request response = client.get_version(request=request) - # Handle response + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_GetVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py index 2d5b0e6..01380eb 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py @@ -37,6 +37,8 @@ async def sample_list_versions(): # Make the request page_result = client.list_versions(request=request) + + # Handle the response async for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py index c7979bc..d2e1523 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py @@ -37,6 +37,8 @@ def sample_list_versions(): # Make the request page_result = client.list_versions(request=request) + + # Handle the response for response in page_result: print(response) diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py index 11537b1..187e020 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py @@ -41,6 +41,8 @@ async def sample_update_version(): print("Waiting for operation to complete...") response = await operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_UpdateVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py index 50cff1c..0429636 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py +++ b/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py @@ -41,6 +41,8 @@ def sample_update_version(): print("Waiting for operation to complete...") response = operation.result() + + # Handle the response print(response) # [END appengine_generated_appengine_admin_v1_Versions_UpdateVersion_sync] diff --git a/samples/generated_samples/snippet_metadata_appengine admin_v1.json b/samples/generated_samples/snippet_metadata_appengine admin_v1.json index 401edb9..14f8968 100644 --- a/samples/generated_samples/snippet_metadata_appengine admin_v1.json +++ b/samples/generated_samples/snippet_metadata_appengine admin_v1.json @@ -14,12 +14,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Applications_CreateApplication_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -34,11 +34,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -56,12 +58,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Applications_CreateApplication_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -76,11 +78,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -188,12 +192,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Applications_RepairApplication_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -208,11 +212,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -230,12 +236,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Applications_RepairApplication_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -250,11 +256,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -273,12 +281,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Applications_UpdateApplication_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -293,11 +301,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -315,12 +325,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Applications_UpdateApplication_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -335,11 +345,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -621,12 +633,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_async", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -641,11 +653,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -663,12 +677,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_sync", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -683,11 +697,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -795,12 +811,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_async", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -815,11 +831,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -837,12 +855,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_sync", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -857,11 +875,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -880,12 +900,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -900,11 +920,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -922,12 +944,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -942,11 +964,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -965,12 +989,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -985,11 +1009,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -1007,12 +1033,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -1027,11 +1053,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -1139,12 +1167,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_async", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -1159,11 +1187,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -1181,12 +1211,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_sync", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -1201,11 +1231,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -1224,12 +1256,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -1244,11 +1276,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -1266,12 +1300,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -1286,11 +1320,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -1661,12 +1697,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_async", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -1681,11 +1717,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -1703,12 +1741,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_sync", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -1723,11 +1761,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -1835,12 +1875,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Instances_DebugInstance_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -1855,11 +1895,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -1877,12 +1919,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Instances_DebugInstance_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -1897,11 +1939,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -1920,12 +1964,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Instances_DeleteInstance_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -1940,11 +1984,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -1962,12 +2008,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Instances_DeleteInstance_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -1982,11 +2028,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2094,12 +2142,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Instances_ListInstances_async", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -2114,11 +2162,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -2136,12 +2186,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Instances_ListInstances_sync", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -2156,11 +2206,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -2179,12 +2231,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Services_DeleteService_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2199,11 +2251,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2221,12 +2275,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Services_DeleteService_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2241,11 +2295,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2353,12 +2409,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Services_ListServices_async", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -2373,11 +2429,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -2395,12 +2453,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Services_ListServices_sync", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -2415,11 +2473,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -2438,12 +2498,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Services_UpdateService_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2458,11 +2518,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2480,12 +2542,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Services_UpdateService_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2500,11 +2562,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2523,12 +2587,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_CreateVersion_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2543,11 +2607,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2565,12 +2631,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_CreateVersion_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2585,11 +2651,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2608,12 +2676,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_DeleteVersion_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2628,11 +2696,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2650,12 +2720,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_DeleteVersion_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2670,11 +2740,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2782,12 +2854,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_ListVersions_async", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -2802,11 +2874,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -2824,12 +2898,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_ListVersions_sync", "segments": [ { - "end": 42, + "end": 44, "start": 27, "type": "FULL" }, { - "end": 42, + "end": 44, "start": 27, "type": "SHORT" }, @@ -2844,11 +2918,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 40, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 43, + "end": 45, + "start": 41, "type": "RESPONSE_HANDLING" } ] @@ -2867,12 +2943,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_UpdateVersion_async", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2887,11 +2963,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] @@ -2909,12 +2987,12 @@ "regionTag": "appengine_generated_appengine_admin_v1_Versions_UpdateVersion_sync", "segments": [ { - "end": 45, + "end": 47, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 47, "start": 27, "type": "SHORT" }, @@ -2929,11 +3007,13 @@ "type": "REQUEST_INITIALIZATION" }, { + "end": 44, "start": 38, "type": "REQUEST_EXECUTION" }, { - "end": 46, + "end": 48, + "start": 45, "type": "RESPONSE_HANDLING" } ] From 2123628323c8fce665c32b24209646b46d1140cb Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 23 Feb 2022 08:57:20 -0700 Subject: [PATCH 082/185] chore(main): release 1.3.1 (#104) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0b6a28..0b31632 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 7b42be9..150c2f6 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.3.0" +version = "1.3.1" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 5f570fef96001ed8dd8fe893e3c06de03908a99b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 25 Feb 2022 09:04:34 -0500 Subject: [PATCH 083/185] chore: use gapic-generator-python 0.63.4 (#107) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.4 chore: fix snippet region tag format chore: fix docstring code block formatting PiperOrigin-RevId: 430730865 Source-Link: https://github.com/googleapis/googleapis/commit/ea5800229f73f94fd7204915a86ed09dcddf429a Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca893ff8af25fc7fe001de1405a517d80446ecca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9 * 🦉 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 * remove redundant samples Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../services/applications/async_client.py | 8 +- .../services/applications/client.py | 12 +- .../authorized_certificates/async_client.py | 10 +- .../authorized_certificates/client.py | 15 +- .../authorized_domains/async_client.py | 2 +- .../services/authorized_domains/client.py | 3 +- .../services/domain_mappings/async_client.py | 10 +- .../services/domain_mappings/client.py | 15 +- .../services/firewall/async_client.py | 12 +- .../services/firewall/client.py | 18 +- .../services/instances/async_client.py | 8 +- .../services/instances/client.py | 12 +- .../services/services/async_client.py | 8 +- .../services/services/client.py | 12 +- .../services/versions/async_client.py | 10 +- .../services/versions/client.py | 15 +- ..._applications_create_application_async.py} | 4 +- ...d_applications_create_application_sync.py} | 4 +- ...ted_applications_get_application_async.py} | 4 +- ...ated_applications_get_application_sync.py} | 4 +- ..._applications_repair_application_async.py} | 4 +- ...d_applications_repair_application_sync.py} | 4 +- ..._applications_update_application_async.py} | 4 +- ...d_applications_update_application_sync.py} | 4 +- ...es_create_authorized_certificate_async.py} | 4 +- ...tes_create_authorized_certificate_sync.py} | 4 +- ...es_delete_authorized_certificate_async.py} | 4 +- ...tes_delete_authorized_certificate_sync.py} | 4 +- ...cates_get_authorized_certificate_async.py} | 4 +- ...icates_get_authorized_certificate_sync.py} | 4 +- ...tes_list_authorized_certificates_async.py} | 4 +- ...ates_list_authorized_certificates_sync.py} | 4 +- ...es_update_authorized_certificate_async.py} | 4 +- ...tes_update_authorized_certificate_sync.py} | 4 +- ..._domains_list_authorized_domains_async.py} | 4 +- ...d_domains_list_authorized_domains_sync.py} | 4 +- ...n_mappings_create_domain_mapping_async.py} | 4 +- ...in_mappings_create_domain_mapping_sync.py} | 4 +- ...n_mappings_delete_domain_mapping_async.py} | 4 +- ...in_mappings_delete_domain_mapping_sync.py} | 4 +- ...main_mappings_get_domain_mapping_async.py} | 4 +- ...omain_mappings_get_domain_mapping_sync.py} | 4 +- ...in_mappings_list_domain_mappings_async.py} | 4 +- ...ain_mappings_list_domain_mappings_sync.py} | 4 +- ...n_mappings_update_domain_mapping_async.py} | 4 +- ...in_mappings_update_domain_mapping_sync.py} | 4 +- ...ewall_batch_update_ingress_rules_async.py} | 4 +- ...rewall_batch_update_ingress_rules_sync.py} | 4 +- ...ted_firewall_create_ingress_rule_async.py} | 4 +- ...ated_firewall_create_ingress_rule_sync.py} | 4 +- ...ted_firewall_delete_ingress_rule_async.py} | 4 +- ...ated_firewall_delete_ingress_rule_sync.py} | 4 +- ...erated_firewall_get_ingress_rule_async.py} | 4 +- ...nerated_firewall_get_ingress_rule_sync.py} | 4 +- ...ated_firewall_list_ingress_rules_async.py} | 4 +- ...rated_firewall_list_ingress_rules_sync.py} | 4 +- ...ted_firewall_update_ingress_rule_async.py} | 4 +- ...ated_firewall_update_ingress_rule_sync.py} | 4 +- ...nerated_instances_debug_instance_async.py} | 4 +- ...enerated_instances_debug_instance_sync.py} | 4 +- ...erated_instances_delete_instance_async.py} | 4 +- ...nerated_instances_delete_instance_sync.py} | 4 +- ...generated_instances_get_instance_async.py} | 4 +- ..._generated_instances_get_instance_sync.py} | 4 +- ...nerated_instances_list_instances_async.py} | 4 +- ...enerated_instances_list_instances_sync.py} | 4 +- ...enerated_services_delete_service_async.py} | 4 +- ...generated_services_delete_service_sync.py} | 4 +- ...1_generated_services_get_service_async.py} | 4 +- ...v1_generated_services_get_service_sync.py} | 4 +- ...generated_services_list_services_async.py} | 4 +- ..._generated_services_list_services_sync.py} | 4 +- ...enerated_services_update_service_async.py} | 4 +- ...generated_services_update_service_sync.py} | 4 +- ...enerated_versions_create_version_async.py} | 4 +- ...generated_versions_create_version_sync.py} | 4 +- ...enerated_versions_delete_version_async.py} | 4 +- ...generated_versions_delete_version_sync.py} | 4 +- ...1_generated_versions_get_version_async.py} | 4 +- ...v1_generated_versions_get_version_sync.py} | 4 +- ...generated_versions_list_versions_async.py} | 4 +- ..._generated_versions_list_versions_sync.py} | 4 +- ...enerated_versions_update_version_async.py} | 4 +- ...generated_versions_update_version_sync.py} | 4 +- .../snippet_metadata_appengine admin_v1.json | 272 +++++++++--------- 85 files changed, 340 insertions(+), 374 deletions(-) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_create_application_async.py => appengine_v1_generated_applications_create_application_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_create_application_sync.py => appengine_v1_generated_applications_create_application_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_get_application_async.py => appengine_v1_generated_applications_get_application_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_get_application_sync.py => appengine_v1_generated_applications_get_application_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_repair_application_async.py => appengine_v1_generated_applications_repair_application_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_repair_application_sync.py => appengine_v1_generated_applications_repair_application_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_update_application_async.py => appengine_v1_generated_applications_update_application_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_applications_update_application_sync.py => appengine_v1_generated_applications_update_application_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py => appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py} (86%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py => appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py} (86%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py => appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py} (86%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py => appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py} (86%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py => appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py} (87%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py => appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py} (87%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py => appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py} (87%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py => appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py} (87%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py => appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py} (86%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py => appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py} (86%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py => appengine_v1_generated_authorized_domains_list_authorized_domains_async.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py => appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py => appengine_v1_generated_domain_mappings_create_domain_mapping_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py => appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py => appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py => appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py => appengine_v1_generated_domain_mappings_get_domain_mapping_async.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py => appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py => appengine_v1_generated_domain_mappings_list_domain_mappings_async.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py => appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py => appengine_v1_generated_domain_mappings_update_domain_mapping_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py => appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py => appengine_v1_generated_firewall_batch_update_ingress_rules_async.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py => appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py => appengine_v1_generated_firewall_create_ingress_rule_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py => appengine_v1_generated_firewall_create_ingress_rule_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py => appengine_v1_generated_firewall_delete_ingress_rule_async.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py => appengine_v1_generated_firewall_delete_ingress_rule_sync.py} (88%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py => appengine_v1_generated_firewall_get_ingress_rule_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py => appengine_v1_generated_firewall_get_ingress_rule_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py => appengine_v1_generated_firewall_list_ingress_rules_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py => appengine_v1_generated_firewall_list_ingress_rules_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py => appengine_v1_generated_firewall_update_ingress_rule_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py => appengine_v1_generated_firewall_update_ingress_rule_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_debug_instance_async.py => appengine_v1_generated_instances_debug_instance_async.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py => appengine_v1_generated_instances_debug_instance_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_delete_instance_async.py => appengine_v1_generated_instances_delete_instance_async.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py => appengine_v1_generated_instances_delete_instance_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_get_instance_async.py => appengine_v1_generated_instances_get_instance_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_get_instance_sync.py => appengine_v1_generated_instances_get_instance_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_list_instances_async.py => appengine_v1_generated_instances_list_instances_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_instances_list_instances_sync.py => appengine_v1_generated_instances_list_instances_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_delete_service_async.py => appengine_v1_generated_services_delete_service_async.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_delete_service_sync.py => appengine_v1_generated_services_delete_service_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_get_service_async.py => appengine_v1_generated_services_get_service_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_get_service_sync.py => appengine_v1_generated_services_get_service_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_list_services_async.py => appengine_v1_generated_services_list_services_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_list_services_sync.py => appengine_v1_generated_services_list_services_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_update_service_async.py => appengine_v1_generated_services_update_service_async.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_services_update_service_sync.py => appengine_v1_generated_services_update_service_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_create_version_async.py => appengine_v1_generated_versions_create_version_async.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_create_version_sync.py => appengine_v1_generated_versions_create_version_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_delete_version_async.py => appengine_v1_generated_versions_delete_version_async.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_delete_version_sync.py => appengine_v1_generated_versions_delete_version_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_get_version_async.py => appengine_v1_generated_versions_get_version_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_get_version_sync.py => appengine_v1_generated_versions_get_version_sync.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_list_versions_async.py => appengine_v1_generated_versions_list_versions_async.py} (89%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_list_versions_sync.py => appengine_v1_generated_versions_list_versions_sync.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_update_version_async.py => appengine_v1_generated_versions_update_version_async.py} (90%) rename samples/generated_samples/{appengine_generated_appengine_admin_v1_versions_update_version_sync.py => appengine_v1_generated_versions_update_version_sync.py} (90%) 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 c69e9dc..5f0b764 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -210,7 +210,7 @@ async def get_application( ) -> application.Application: r"""Gets information about an application. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -289,7 +289,7 @@ async def create_application( Billing `__. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -371,7 +371,7 @@ async def update_application( the application. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -463,7 +463,7 @@ async def repair_application( Cloud Console Activity Log. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index ecbe0ae..8d2f6e9 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -395,8 +395,7 @@ def get_application( ) -> application.Application: r"""Gets information about an application. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -476,8 +475,7 @@ def create_application( Billing `__. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -560,8 +558,7 @@ def update_application( the application. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -654,8 +651,7 @@ def repair_application( Cloud Console Activity Log. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 13a510a..b988e62 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 @@ -220,7 +220,7 @@ async def list_authorized_certificates( administer. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -297,7 +297,7 @@ async def get_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -367,7 +367,7 @@ async def create_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -443,7 +443,7 @@ async def update_authorized_certificate( updated. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -513,7 +513,7 @@ async def delete_authorized_certificate( ) -> None: r"""Deletes the specified SSL certificate. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 8da7809..792e5e9 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -402,8 +402,7 @@ def list_authorized_certificates( administer. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -483,8 +482,7 @@ def get_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Gets the specified SSL certificate. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -557,8 +555,7 @@ def create_authorized_certificate( ) -> certificate.AuthorizedCertificate: r"""Uploads the specified SSL certificate. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -637,8 +634,7 @@ def update_authorized_certificate( updated. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -711,8 +707,7 @@ def delete_authorized_certificate( ) -> None: r"""Deletes the specified SSL certificate. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 80eba40..c5a48bc 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 @@ -216,7 +216,7 @@ async def list_authorized_domains( administer. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 b6180de..4e2d185 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -401,8 +401,7 @@ def list_authorized_domains( administer. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 eb1f00d..1624f89 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 @@ -215,7 +215,7 @@ async def list_domain_mappings( ) -> pagers.ListDomainMappingsAsyncPager: r"""Lists the domain mappings on an application. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -291,7 +291,7 @@ async def get_domain_mapping( ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -362,7 +362,7 @@ async def create_domain_mapping( ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -449,7 +449,7 @@ async def update_domain_mapping( ``DomainMapping`` resource. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -534,7 +534,7 @@ async def delete_domain_mapping( ``DomainMapping`` resource. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 d1910b8..7d1163d 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -398,8 +398,7 @@ def list_domain_mappings( ) -> pagers.ListDomainMappingsPager: r"""Lists the domain mappings on an application. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -476,8 +475,7 @@ def get_domain_mapping( ) -> domain_mapping.DomainMapping: r"""Gets the specified domain mapping. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -549,8 +547,7 @@ def create_domain_mapping( ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -638,8 +635,7 @@ def update_domain_mapping( ``DomainMapping`` resource. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -725,8 +721,7 @@ def delete_domain_mapping( ``DomainMapping`` resource. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 8064078..1df9565 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -214,7 +214,7 @@ async def list_ingress_rules( ) -> pagers.ListIngressRulesAsyncPager: r"""Lists the firewall rules of an application. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -297,7 +297,7 @@ async def batch_update_ingress_rules( end of the list. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -362,7 +362,7 @@ async def create_ingress_rule( ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -431,7 +431,7 @@ async def get_ingress_rule( ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -500,7 +500,7 @@ async def update_ingress_rule( ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -569,7 +569,7 @@ async def delete_ingress_rule( ) -> None: r"""Deletes the specified firewall rule. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index aa26f0a..63c9262 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -403,8 +403,7 @@ def list_ingress_rules( ) -> pagers.ListIngressRulesPager: r"""Lists the firewall rules of an application. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -488,8 +487,7 @@ def batch_update_ingress_rules( end of the list. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -557,8 +555,7 @@ def create_ingress_rule( ) -> firewall.FirewallRule: r"""Creates a firewall rule for the application. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -628,8 +625,7 @@ def get_ingress_rule( ) -> firewall.FirewallRule: r"""Gets the specified firewall rule. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -699,8 +695,7 @@ def update_ingress_rule( ) -> firewall.FirewallRule: r"""Updates the specified firewall rule. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -770,8 +765,7 @@ def delete_ingress_rule( ) -> None: r"""Deletes the specified firewall rule. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 b3d2332..8e5b77a 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -217,7 +217,7 @@ async def list_instances( API `__. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -293,7 +293,7 @@ async def get_instance( ) -> instance.Instance: r"""Gets instance information. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -376,7 +376,7 @@ async def delete_instance( method. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -478,7 +478,7 @@ async def debug_instance( environment. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index ea87ee9..85f1dad 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -418,8 +418,7 @@ def list_instances( API `__. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -496,8 +495,7 @@ def get_instance( ) -> instance.Instance: r"""Gets instance information. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -581,8 +579,7 @@ def delete_instance( method. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -685,8 +682,7 @@ def debug_instance( environment. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 59ffd28..941c58d 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -208,7 +208,7 @@ async def list_services( ) -> pagers.ListServicesAsyncPager: r"""Lists all the services in the application. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -286,7 +286,7 @@ async def get_service( service. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -363,7 +363,7 @@ async def update_service( ) -> operation_async.AsyncOperation: r"""Updates the configuration of the specified service. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -453,7 +453,7 @@ async def delete_service( versions. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 8bf21ea..e85c971 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -397,8 +397,7 @@ def list_services( ) -> pagers.ListServicesPager: r"""Lists all the services in the application. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -477,8 +476,7 @@ def get_service( service. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -556,8 +554,7 @@ def update_service( ) -> gac_operation.Operation: r"""Updates the configuration of the specified service. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -648,8 +645,7 @@ def delete_service( versions. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 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 a868123..af8fd33 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -211,7 +211,7 @@ async def list_versions( ) -> pagers.ListVersionsAsyncPager: r"""Lists the versions of a service. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -290,7 +290,7 @@ async def get_version( parameter to get the full resource. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -358,7 +358,7 @@ async def create_version( ) -> operation_async.AsyncOperation: r"""Deploys code and resource files to a new version. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -475,7 +475,7 @@ async def update_version( - ```manual_scaling.instances`` `__ - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -556,7 +556,7 @@ async def delete_version( ) -> operation_async.AsyncOperation: r"""Deletes an existing Version resource. - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 9ba60bf..59838c1 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -400,8 +400,7 @@ def list_versions( ) -> pagers.ListVersionsPager: r"""Lists the versions of a service. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -481,8 +480,7 @@ def get_version( parameter to get the full resource. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -551,8 +549,7 @@ def create_version( ) -> gac_operation.Operation: r"""Deploys code and resource files to a new version. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -670,8 +667,7 @@ def update_version( - ```manual_scaling.instances`` `__ - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 @@ -753,8 +749,7 @@ def delete_version( ) -> gac_operation.Operation: r"""Deletes an existing Version resource. - - .. code-block:: + .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py rename to samples/generated_samples/appengine_v1_generated_applications_create_application_async.py index c34a123..d0f760e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_create_application_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_CreateApplication_async] +# [START appengine_v1_generated_Applications_CreateApplication_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_create_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_CreateApplication_async] +# [END appengine_v1_generated_Applications_CreateApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py rename to samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py index 0d67311..b60a6fd 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_create_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_create_application_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_CreateApplication_sync] +# [START appengine_v1_generated_Applications_CreateApplication_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_create_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_CreateApplication_sync] +# [END appengine_v1_generated_Applications_CreateApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py rename to samples/generated_samples/appengine_v1_generated_applications_get_application_async.py index 21ca165..e40c960 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_get_application_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_GetApplication_async] +# [START appengine_v1_generated_Applications_GetApplication_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_get_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_GetApplication_async] +# [END appengine_v1_generated_Applications_GetApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py rename to samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py index 7312932..94c7ea0 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_get_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_get_application_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_GetApplication_sync] +# [START appengine_v1_generated_Applications_GetApplication_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_get_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_GetApplication_sync] +# [END appengine_v1_generated_Applications_GetApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py rename to samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py index 7bfcdab..704c729 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_repair_application_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_RepairApplication_async] +# [START appengine_v1_generated_Applications_RepairApplication_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_repair_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_RepairApplication_async] +# [END appengine_v1_generated_Applications_RepairApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py rename to samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py index c895045..a6c31c6 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_repair_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_repair_application_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_RepairApplication_sync] +# [START appengine_v1_generated_Applications_RepairApplication_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_repair_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_RepairApplication_sync] +# [END appengine_v1_generated_Applications_RepairApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py rename to samples/generated_samples/appengine_v1_generated_applications_update_application_async.py index 0dd71ed..ca1dc21 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_async.py +++ b/samples/generated_samples/appengine_v1_generated_applications_update_application_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_UpdateApplication_async] +# [START appengine_v1_generated_Applications_UpdateApplication_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_update_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_UpdateApplication_async] +# [END appengine_v1_generated_Applications_UpdateApplication_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py b/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py rename to samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py index deb4c69..6ed86cc 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_applications_update_application_sync.py +++ b/samples/generated_samples/appengine_v1_generated_applications_update_application_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Applications_UpdateApplication_sync] +# [START appengine_v1_generated_Applications_UpdateApplication_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_update_application(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Applications_UpdateApplication_sync] +# [END appengine_v1_generated_Applications_UpdateApplication_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py similarity index 86% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py index 1e38324..d4640e3 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_async] +# [START appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_create_authorized_certificate(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_async] +# [END appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py similarity index 86% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py index 4d181c9..c9c69fa 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_sync] +# [START appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_create_authorized_certificate(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_sync] +# [END appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py similarity index 86% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py index ec01c88..cfd6c11 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_async] +# [START appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async] from google.cloud import appengine_admin_v1 @@ -39,4 +39,4 @@ async def sample_delete_authorized_certificate(): await client.delete_authorized_certificate(request=request) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_async] +# [END appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py similarity index 86% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py index 6662568..ecb664d 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] +# [START appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] from google.cloud import appengine_admin_v1 @@ -39,4 +39,4 @@ def sample_delete_authorized_certificate(): client.delete_authorized_certificate(request=request) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] +# [END appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py similarity index 87% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py index b617455..049dfe2 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_async] +# [START appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_get_authorized_certificate(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_async] +# [END appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py similarity index 87% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py index a8422a3..8935630 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_sync] +# [START appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_get_authorized_certificate(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_sync] +# [END appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py similarity index 87% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py index 85ab298..affcb77 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_async] +# [START appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ async def sample_list_authorized_certificates(): async for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_async] +# [END appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py similarity index 87% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py index 7abfea5..6e16941 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_sync] +# [START appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ def sample_list_authorized_certificates(): for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_sync] +# [END appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py similarity index 86% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py index 112d041..7ca930f 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_async] +# [START appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_update_authorized_certificate(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_async] +# [END appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py similarity index 86% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py rename to samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py index 5eea12d..56e1e91 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] +# [START appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_update_authorized_certificate(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] +# [END appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py rename to samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py index b041f1b..a44bd6d 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_async] +# [START appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ async def sample_list_authorized_domains(): async for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_async] +# [END appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py rename to samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py index ea09e6f..eef1946 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py +++ b/samples/generated_samples/appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_sync] +# [START appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ def sample_list_authorized_domains(): for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_sync] +# [END appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py index fa88438..0e2eccb 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async] +# [START appengine_v1_generated_DomainMappings_CreateDomainMapping_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_create_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async] +# [END appengine_v1_generated_DomainMappings_CreateDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py index 4894e98..9e17fff 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync] +# [START appengine_v1_generated_DomainMappings_CreateDomainMapping_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_create_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync] +# [END appengine_v1_generated_DomainMappings_CreateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py index 6997ebf..556f14b 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async] +# [START appengine_v1_generated_DomainMappings_DeleteDomainMapping_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_delete_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async] +# [END appengine_v1_generated_DomainMappings_DeleteDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py index 357c309..c72cfff 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync] +# [START appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_delete_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync] +# [END appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py index 7f5db9b..bf0f67c 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_async] +# [START appengine_v1_generated_DomainMappings_GetDomainMapping_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_get_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_async] +# [END appengine_v1_generated_DomainMappings_GetDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py index 33f8d48..76073eb 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_sync] +# [START appengine_v1_generated_DomainMappings_GetDomainMapping_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_get_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_sync] +# [END appengine_v1_generated_DomainMappings_GetDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py index b849046..d634f39 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_async] +# [START appengine_v1_generated_DomainMappings_ListDomainMappings_async] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ async def sample_list_domain_mappings(): async for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_async] +# [END appengine_v1_generated_DomainMappings_ListDomainMappings_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py index 7c79bd5..8aed508 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_sync] +# [START appengine_v1_generated_DomainMappings_ListDomainMappings_sync] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ def sample_list_domain_mappings(): for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_sync] +# [END appengine_v1_generated_DomainMappings_ListDomainMappings_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py index 2308454..8f6609e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async] +# [START appengine_v1_generated_DomainMappings_UpdateDomainMapping_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_update_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async] +# [END appengine_v1_generated_DomainMappings_UpdateDomainMapping_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py rename to samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py index 56509fb..002d435 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py +++ b/samples/generated_samples/appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync] +# [START appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_update_domain_mapping(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync] +# [END appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py rename to samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py index 540475c..02b2747 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_async] +# [START appengine_v1_generated_Firewall_BatchUpdateIngressRules_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_batch_update_ingress_rules(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_async] +# [END appengine_v1_generated_Firewall_BatchUpdateIngressRules_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py rename to samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py index 39b894b..2c65b80 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_sync] +# [START appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_batch_update_ingress_rules(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_sync] +# [END appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py rename to samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py index 536efe1..9cd8700 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_async] +# [START appengine_v1_generated_Firewall_CreateIngressRule_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_create_ingress_rule(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_async] +# [END appengine_v1_generated_Firewall_CreateIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py rename to samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py index ec53255..ca1d21f 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_create_ingress_rule_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_sync] +# [START appengine_v1_generated_Firewall_CreateIngressRule_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_create_ingress_rule(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_sync] +# [END appengine_v1_generated_Firewall_CreateIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py rename to samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py index 01c5686..f3e4255 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_async] +# [START appengine_v1_generated_Firewall_DeleteIngressRule_async] from google.cloud import appengine_admin_v1 @@ -39,4 +39,4 @@ async def sample_delete_ingress_rule(): await client.delete_ingress_rule(request=request) -# [END appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_async] +# [END appengine_v1_generated_Firewall_DeleteIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py similarity index 88% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py rename to samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py index 1b2135f..998420e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_delete_ingress_rule_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_sync] +# [START appengine_v1_generated_Firewall_DeleteIngressRule_sync] from google.cloud import appengine_admin_v1 @@ -39,4 +39,4 @@ def sample_delete_ingress_rule(): client.delete_ingress_rule(request=request) -# [END appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_sync] +# [END appengine_v1_generated_Firewall_DeleteIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py rename to samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py index 63a6964..9b38c85 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_async] +# [START appengine_v1_generated_Firewall_GetIngressRule_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_get_ingress_rule(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_async] +# [END appengine_v1_generated_Firewall_GetIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py rename to samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py index b2f08ee..b4807d7 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_get_ingress_rule_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_sync] +# [START appengine_v1_generated_Firewall_GetIngressRule_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_get_ingress_rule(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_sync] +# [END appengine_v1_generated_Firewall_GetIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py rename to samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py index 3de7fd6..6dec65a 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_async] +# [START appengine_v1_generated_Firewall_ListIngressRules_async] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ async def sample_list_ingress_rules(): async for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_async] +# [END appengine_v1_generated_Firewall_ListIngressRules_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py rename to samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py index 1420685..e2eb755 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_list_ingress_rules_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_sync] +# [START appengine_v1_generated_Firewall_ListIngressRules_sync] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ def sample_list_ingress_rules(): for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_sync] +# [END appengine_v1_generated_Firewall_ListIngressRules_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py rename to samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py index 9bdd21e..b7d8fa6 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_async] +# [START appengine_v1_generated_Firewall_UpdateIngressRule_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_update_ingress_rule(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_async] +# [END appengine_v1_generated_Firewall_UpdateIngressRule_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py rename to samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py index 3999824..e3a2c7b 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py +++ b/samples/generated_samples/appengine_v1_generated_firewall_update_ingress_rule_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_sync] +# [START appengine_v1_generated_Firewall_UpdateIngressRule_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_update_ingress_rule(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_sync] +# [END appengine_v1_generated_Firewall_UpdateIngressRule_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py rename to samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py index 27d01dd..256075f 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_DebugInstance_async] +# [START appengine_v1_generated_Instances_DebugInstance_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_debug_instance(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Instances_DebugInstance_async] +# [END appengine_v1_generated_Instances_DebugInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py rename to samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py index ce235f5..da3035d 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_debug_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_DebugInstance_sync] +# [START appengine_v1_generated_Instances_DebugInstance_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_debug_instance(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Instances_DebugInstance_sync] +# [END appengine_v1_generated_Instances_DebugInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py rename to samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py index 136e0bf..eadc14e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_DeleteInstance_async] +# [START appengine_v1_generated_Instances_DeleteInstance_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_delete_instance(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Instances_DeleteInstance_async] +# [END appengine_v1_generated_Instances_DeleteInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py rename to samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py index 0f8da37..615f32e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_DeleteInstance_sync] +# [START appengine_v1_generated_Instances_DeleteInstance_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_delete_instance(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Instances_DeleteInstance_sync] +# [END appengine_v1_generated_Instances_DeleteInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py rename to samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py index 2878e91..c68dea1 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_get_instance_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_GetInstance_async] +# [START appengine_v1_generated_Instances_GetInstance_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_get_instance(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Instances_GetInstance_async] +# [END appengine_v1_generated_Instances_GetInstance_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py b/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py rename to samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py index f5ffb81..84f3c97 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_get_instance_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_get_instance_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_GetInstance_sync] +# [START appengine_v1_generated_Instances_GetInstance_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_get_instance(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Instances_GetInstance_sync] +# [END appengine_v1_generated_Instances_GetInstance_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py rename to samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py index 7ff6406..053e5a5 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_async.py +++ b/samples/generated_samples/appengine_v1_generated_instances_list_instances_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_ListInstances_async] +# [START appengine_v1_generated_Instances_ListInstances_async] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ async def sample_list_instances(): async for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Instances_ListInstances_async] +# [END appengine_v1_generated_Instances_ListInstances_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py b/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py rename to samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py index 6696bbf..807338f 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_instances_list_instances_sync.py +++ b/samples/generated_samples/appengine_v1_generated_instances_list_instances_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Instances_ListInstances_sync] +# [START appengine_v1_generated_Instances_ListInstances_sync] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ def sample_list_instances(): for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Instances_ListInstances_sync] +# [END appengine_v1_generated_Instances_ListInstances_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py rename to samples/generated_samples/appengine_v1_generated_services_delete_service_async.py index b925671..ab0519e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_delete_service_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_DeleteService_async] +# [START appengine_v1_generated_Services_DeleteService_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_delete_service(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Services_DeleteService_async] +# [END appengine_v1_generated_Services_DeleteService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py rename to samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py index bcac49a..73d53a2 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_delete_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_delete_service_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_DeleteService_sync] +# [START appengine_v1_generated_Services_DeleteService_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_delete_service(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Services_DeleteService_sync] +# [END appengine_v1_generated_Services_DeleteService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py b/samples/generated_samples/appengine_v1_generated_services_get_service_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py rename to samples/generated_samples/appengine_v1_generated_services_get_service_async.py index 0661298..40bac59 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_get_service_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_GetService_async] +# [START appengine_v1_generated_Services_GetService_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_get_service(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Services_GetService_async] +# [END appengine_v1_generated_Services_GetService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py rename to samples/generated_samples/appengine_v1_generated_services_get_service_sync.py index 317c153..7fd0ee9 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_get_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_get_service_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_GetService_sync] +# [START appengine_v1_generated_Services_GetService_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_get_service(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Services_GetService_sync] +# [END appengine_v1_generated_Services_GetService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py b/samples/generated_samples/appengine_v1_generated_services_list_services_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py rename to samples/generated_samples/appengine_v1_generated_services_list_services_async.py index 015baad..495ffaf 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_list_services_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_ListServices_async] +# [START appengine_v1_generated_Services_ListServices_async] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ async def sample_list_services(): async for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Services_ListServices_async] +# [END appengine_v1_generated_Services_ListServices_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py b/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py rename to samples/generated_samples/appengine_v1_generated_services_list_services_sync.py index db2aa51..c9722ae 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_list_services_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_list_services_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_ListServices_sync] +# [START appengine_v1_generated_Services_ListServices_sync] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ def sample_list_services(): for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Services_ListServices_sync] +# [END appengine_v1_generated_Services_ListServices_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py rename to samples/generated_samples/appengine_v1_generated_services_update_service_async.py index 525ddb5..c95c243 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_async.py +++ b/samples/generated_samples/appengine_v1_generated_services_update_service_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_UpdateService_async] +# [START appengine_v1_generated_Services_UpdateService_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_update_service(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Services_UpdateService_async] +# [END appengine_v1_generated_Services_UpdateService_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py b/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py rename to samples/generated_samples/appengine_v1_generated_services_update_service_sync.py index 71003cc..0d43d22 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_services_update_service_sync.py +++ b/samples/generated_samples/appengine_v1_generated_services_update_service_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Services_UpdateService_sync] +# [START appengine_v1_generated_Services_UpdateService_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_update_service(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Services_UpdateService_sync] +# [END appengine_v1_generated_Services_UpdateService_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py rename to samples/generated_samples/appengine_v1_generated_versions_create_version_async.py index 3cbbb46..ee8c199 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_create_version_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_CreateVersion_async] +# [START appengine_v1_generated_Versions_CreateVersion_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_create_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_CreateVersion_async] +# [END appengine_v1_generated_Versions_CreateVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py rename to samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py index 11b4039..7775b0e 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_create_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_create_version_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_CreateVersion_sync] +# [START appengine_v1_generated_Versions_CreateVersion_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_create_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_CreateVersion_sync] +# [END appengine_v1_generated_Versions_CreateVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py rename to samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py index e4de769..4cf224f 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_delete_version_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_DeleteVersion_async] +# [START appengine_v1_generated_Versions_DeleteVersion_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_delete_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_DeleteVersion_async] +# [END appengine_v1_generated_Versions_DeleteVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py rename to samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py index 9026697..0996bf9 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_delete_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_delete_version_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_DeleteVersion_sync] +# [START appengine_v1_generated_Versions_DeleteVersion_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_delete_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_DeleteVersion_sync] +# [END appengine_v1_generated_Versions_DeleteVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py rename to samples/generated_samples/appengine_v1_generated_versions_get_version_async.py index 79b8514..33363a7 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_get_version_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_GetVersion_async] +# [START appengine_v1_generated_Versions_GetVersion_async] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ async def sample_get_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_GetVersion_async] +# [END appengine_v1_generated_Versions_GetVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py rename to samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py index df30676..606bd24 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_get_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_get_version_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_GetVersion_sync] +# [START appengine_v1_generated_Versions_GetVersion_sync] from google.cloud import appengine_admin_v1 @@ -41,4 +41,4 @@ def sample_get_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_GetVersion_sync] +# [END appengine_v1_generated_Versions_GetVersion_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py similarity index 89% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py rename to samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py index 01380eb..83a56ef 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_list_versions_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_ListVersions_async] +# [START appengine_v1_generated_Versions_ListVersions_async] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ async def sample_list_versions(): async for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Versions_ListVersions_async] +# [END appengine_v1_generated_Versions_ListVersions_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py b/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py rename to samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py index d2e1523..a5055b7 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_list_versions_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_list_versions_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_ListVersions_sync] +# [START appengine_v1_generated_Versions_ListVersions_sync] from google.cloud import appengine_admin_v1 @@ -42,4 +42,4 @@ def sample_list_versions(): for response in page_result: print(response) -# [END appengine_generated_appengine_admin_v1_Versions_ListVersions_sync] +# [END appengine_v1_generated_Versions_ListVersions_sync] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py rename to samples/generated_samples/appengine_v1_generated_versions_update_version_async.py index 187e020..d27a7f4 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_async.py +++ b/samples/generated_samples/appengine_v1_generated_versions_update_version_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_UpdateVersion_async] +# [START appengine_v1_generated_Versions_UpdateVersion_async] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ async def sample_update_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_UpdateVersion_async] +# [END appengine_v1_generated_Versions_UpdateVersion_async] diff --git a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py b/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py similarity index 90% rename from samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py rename to samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py index 0429636..4368c55 100644 --- a/samples/generated_samples/appengine_generated_appengine_admin_v1_versions_update_version_sync.py +++ b/samples/generated_samples/appengine_v1_generated_versions_update_version_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-appengine-admin -# [START appengine_generated_appengine_admin_v1_Versions_UpdateVersion_sync] +# [START appengine_v1_generated_Versions_UpdateVersion_sync] from google.cloud import appengine_admin_v1 @@ -45,4 +45,4 @@ def sample_update_version(): # Handle the response print(response) -# [END appengine_generated_appengine_admin_v1_Versions_UpdateVersion_sync] +# [END appengine_v1_generated_Versions_UpdateVersion_sync] diff --git a/samples/generated_samples/snippet_metadata_appengine admin_v1.json b/samples/generated_samples/snippet_metadata_appengine admin_v1.json index 14f8968..445ed92 100644 --- a/samples/generated_samples/snippet_metadata_appengine admin_v1.json +++ b/samples/generated_samples/snippet_metadata_appengine admin_v1.json @@ -10,8 +10,8 @@ "shortName": "CreateApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_create_application_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_CreateApplication_async", + "file": "appengine_v1_generated_applications_create_application_async.py", + "regionTag": "appengine_v1_generated_Applications_CreateApplication_async", "segments": [ { "end": 47, @@ -54,8 +54,8 @@ "shortName": "CreateApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_create_application_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_CreateApplication_sync", + "file": "appengine_v1_generated_applications_create_application_sync.py", + "regionTag": "appengine_v1_generated_Applications_CreateApplication_sync", "segments": [ { "end": 47, @@ -99,8 +99,8 @@ "shortName": "GetApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_get_application_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_GetApplication_async", + "file": "appengine_v1_generated_applications_get_application_async.py", + "regionTag": "appengine_v1_generated_Applications_GetApplication_async", "segments": [ { "end": 43, @@ -143,8 +143,8 @@ "shortName": "GetApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_get_application_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_GetApplication_sync", + "file": "appengine_v1_generated_applications_get_application_sync.py", + "regionTag": "appengine_v1_generated_Applications_GetApplication_sync", "segments": [ { "end": 43, @@ -188,8 +188,8 @@ "shortName": "RepairApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_repair_application_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_RepairApplication_async", + "file": "appengine_v1_generated_applications_repair_application_async.py", + "regionTag": "appengine_v1_generated_Applications_RepairApplication_async", "segments": [ { "end": 47, @@ -232,8 +232,8 @@ "shortName": "RepairApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_repair_application_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_RepairApplication_sync", + "file": "appengine_v1_generated_applications_repair_application_sync.py", + "regionTag": "appengine_v1_generated_Applications_RepairApplication_sync", "segments": [ { "end": 47, @@ -277,8 +277,8 @@ "shortName": "UpdateApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_update_application_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_UpdateApplication_async", + "file": "appengine_v1_generated_applications_update_application_async.py", + "regionTag": "appengine_v1_generated_Applications_UpdateApplication_async", "segments": [ { "end": 47, @@ -321,8 +321,8 @@ "shortName": "UpdateApplication" } }, - "file": "appengine_generated_appengine_admin_v1_applications_update_application_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Applications_UpdateApplication_sync", + "file": "appengine_v1_generated_applications_update_application_sync.py", + "regionTag": "appengine_v1_generated_Applications_UpdateApplication_sync", "segments": [ { "end": 47, @@ -366,8 +366,8 @@ "shortName": "CreateAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_async", + "file": "appengine_v1_generated_authorized_certificates_create_authorized_certificate_async.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_async", "segments": [ { "end": 43, @@ -410,8 +410,8 @@ "shortName": "CreateAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_create_authorized_certificate_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_CreateAuthorizedCertificate_sync", + "file": "appengine_v1_generated_authorized_certificates_create_authorized_certificate_sync.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_CreateAuthorizedCertificate_sync", "segments": [ { "end": 43, @@ -455,8 +455,8 @@ "shortName": "DeleteAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_async", + "file": "appengine_v1_generated_authorized_certificates_delete_authorized_certificate_async.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_async", "segments": [ { "end": 41, @@ -497,8 +497,8 @@ "shortName": "DeleteAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_delete_authorized_certificate_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_DeleteAuthorizedCertificate_sync", + "file": "appengine_v1_generated_authorized_certificates_delete_authorized_certificate_sync.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_DeleteAuthorizedCertificate_sync", "segments": [ { "end": 41, @@ -540,8 +540,8 @@ "shortName": "GetAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_async", + "file": "appengine_v1_generated_authorized_certificates_get_authorized_certificate_async.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async", "segments": [ { "end": 43, @@ -584,8 +584,8 @@ "shortName": "GetAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_get_authorized_certificate_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_GetAuthorizedCertificate_sync", + "file": "appengine_v1_generated_authorized_certificates_get_authorized_certificate_sync.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_sync", "segments": [ { "end": 43, @@ -629,8 +629,8 @@ "shortName": "ListAuthorizedCertificates" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_async", + "file": "appengine_v1_generated_authorized_certificates_list_authorized_certificates_async.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_async", "segments": [ { "end": 44, @@ -673,8 +673,8 @@ "shortName": "ListAuthorizedCertificates" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_list_authorized_certificates_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_ListAuthorizedCertificates_sync", + "file": "appengine_v1_generated_authorized_certificates_list_authorized_certificates_sync.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_ListAuthorizedCertificates_sync", "segments": [ { "end": 44, @@ -718,8 +718,8 @@ "shortName": "UpdateAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_async", + "file": "appengine_v1_generated_authorized_certificates_update_authorized_certificate_async.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_async", "segments": [ { "end": 43, @@ -762,8 +762,8 @@ "shortName": "UpdateAuthorizedCertificate" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_certificates_update_authorized_certificate_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedCertificates_UpdateAuthorizedCertificate_sync", + "file": "appengine_v1_generated_authorized_certificates_update_authorized_certificate_sync.py", + "regionTag": "appengine_v1_generated_AuthorizedCertificates_UpdateAuthorizedCertificate_sync", "segments": [ { "end": 43, @@ -807,8 +807,8 @@ "shortName": "ListAuthorizedDomains" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_async", + "file": "appengine_v1_generated_authorized_domains_list_authorized_domains_async.py", + "regionTag": "appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_async", "segments": [ { "end": 44, @@ -851,8 +851,8 @@ "shortName": "ListAuthorizedDomains" } }, - "file": "appengine_generated_appengine_admin_v1_authorized_domains_list_authorized_domains_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_AuthorizedDomains_ListAuthorizedDomains_sync", + "file": "appengine_v1_generated_authorized_domains_list_authorized_domains_sync.py", + "regionTag": "appengine_v1_generated_AuthorizedDomains_ListAuthorizedDomains_sync", "segments": [ { "end": 44, @@ -896,8 +896,8 @@ "shortName": "CreateDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_async", + "file": "appengine_v1_generated_domain_mappings_create_domain_mapping_async.py", + "regionTag": "appengine_v1_generated_DomainMappings_CreateDomainMapping_async", "segments": [ { "end": 47, @@ -940,8 +940,8 @@ "shortName": "CreateDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_create_domain_mapping_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_CreateDomainMapping_sync", + "file": "appengine_v1_generated_domain_mappings_create_domain_mapping_sync.py", + "regionTag": "appengine_v1_generated_DomainMappings_CreateDomainMapping_sync", "segments": [ { "end": 47, @@ -985,8 +985,8 @@ "shortName": "DeleteDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_async", + "file": "appengine_v1_generated_domain_mappings_delete_domain_mapping_async.py", + "regionTag": "appengine_v1_generated_DomainMappings_DeleteDomainMapping_async", "segments": [ { "end": 47, @@ -1029,8 +1029,8 @@ "shortName": "DeleteDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_delete_domain_mapping_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_DeleteDomainMapping_sync", + "file": "appengine_v1_generated_domain_mappings_delete_domain_mapping_sync.py", + "regionTag": "appengine_v1_generated_DomainMappings_DeleteDomainMapping_sync", "segments": [ { "end": 47, @@ -1074,8 +1074,8 @@ "shortName": "GetDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_async", + "file": "appengine_v1_generated_domain_mappings_get_domain_mapping_async.py", + "regionTag": "appengine_v1_generated_DomainMappings_GetDomainMapping_async", "segments": [ { "end": 43, @@ -1118,8 +1118,8 @@ "shortName": "GetDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_get_domain_mapping_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_GetDomainMapping_sync", + "file": "appengine_v1_generated_domain_mappings_get_domain_mapping_sync.py", + "regionTag": "appengine_v1_generated_DomainMappings_GetDomainMapping_sync", "segments": [ { "end": 43, @@ -1163,8 +1163,8 @@ "shortName": "ListDomainMappings" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_async", + "file": "appengine_v1_generated_domain_mappings_list_domain_mappings_async.py", + "regionTag": "appengine_v1_generated_DomainMappings_ListDomainMappings_async", "segments": [ { "end": 44, @@ -1207,8 +1207,8 @@ "shortName": "ListDomainMappings" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_list_domain_mappings_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_ListDomainMappings_sync", + "file": "appengine_v1_generated_domain_mappings_list_domain_mappings_sync.py", + "regionTag": "appengine_v1_generated_DomainMappings_ListDomainMappings_sync", "segments": [ { "end": 44, @@ -1252,8 +1252,8 @@ "shortName": "UpdateDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_async", + "file": "appengine_v1_generated_domain_mappings_update_domain_mapping_async.py", + "regionTag": "appengine_v1_generated_DomainMappings_UpdateDomainMapping_async", "segments": [ { "end": 47, @@ -1296,8 +1296,8 @@ "shortName": "UpdateDomainMapping" } }, - "file": "appengine_generated_appengine_admin_v1_domain_mappings_update_domain_mapping_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_DomainMappings_UpdateDomainMapping_sync", + "file": "appengine_v1_generated_domain_mappings_update_domain_mapping_sync.py", + "regionTag": "appengine_v1_generated_DomainMappings_UpdateDomainMapping_sync", "segments": [ { "end": 47, @@ -1341,8 +1341,8 @@ "shortName": "BatchUpdateIngressRules" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_async", + "file": "appengine_v1_generated_firewall_batch_update_ingress_rules_async.py", + "regionTag": "appengine_v1_generated_Firewall_BatchUpdateIngressRules_async", "segments": [ { "end": 43, @@ -1385,8 +1385,8 @@ "shortName": "BatchUpdateIngressRules" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_batch_update_ingress_rules_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_BatchUpdateIngressRules_sync", + "file": "appengine_v1_generated_firewall_batch_update_ingress_rules_sync.py", + "regionTag": "appengine_v1_generated_Firewall_BatchUpdateIngressRules_sync", "segments": [ { "end": 43, @@ -1430,8 +1430,8 @@ "shortName": "CreateIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_async", + "file": "appengine_v1_generated_firewall_create_ingress_rule_async.py", + "regionTag": "appengine_v1_generated_Firewall_CreateIngressRule_async", "segments": [ { "end": 43, @@ -1474,8 +1474,8 @@ "shortName": "CreateIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_create_ingress_rule_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_CreateIngressRule_sync", + "file": "appengine_v1_generated_firewall_create_ingress_rule_sync.py", + "regionTag": "appengine_v1_generated_Firewall_CreateIngressRule_sync", "segments": [ { "end": 43, @@ -1519,8 +1519,8 @@ "shortName": "DeleteIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_async", + "file": "appengine_v1_generated_firewall_delete_ingress_rule_async.py", + "regionTag": "appengine_v1_generated_Firewall_DeleteIngressRule_async", "segments": [ { "end": 41, @@ -1561,8 +1561,8 @@ "shortName": "DeleteIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_delete_ingress_rule_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_DeleteIngressRule_sync", + "file": "appengine_v1_generated_firewall_delete_ingress_rule_sync.py", + "regionTag": "appengine_v1_generated_Firewall_DeleteIngressRule_sync", "segments": [ { "end": 41, @@ -1604,8 +1604,8 @@ "shortName": "GetIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_async", + "file": "appengine_v1_generated_firewall_get_ingress_rule_async.py", + "regionTag": "appengine_v1_generated_Firewall_GetIngressRule_async", "segments": [ { "end": 43, @@ -1648,8 +1648,8 @@ "shortName": "GetIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_get_ingress_rule_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_GetIngressRule_sync", + "file": "appengine_v1_generated_firewall_get_ingress_rule_sync.py", + "regionTag": "appengine_v1_generated_Firewall_GetIngressRule_sync", "segments": [ { "end": 43, @@ -1693,8 +1693,8 @@ "shortName": "ListIngressRules" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_async", + "file": "appengine_v1_generated_firewall_list_ingress_rules_async.py", + "regionTag": "appengine_v1_generated_Firewall_ListIngressRules_async", "segments": [ { "end": 44, @@ -1737,8 +1737,8 @@ "shortName": "ListIngressRules" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_list_ingress_rules_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_ListIngressRules_sync", + "file": "appengine_v1_generated_firewall_list_ingress_rules_sync.py", + "regionTag": "appengine_v1_generated_Firewall_ListIngressRules_sync", "segments": [ { "end": 44, @@ -1782,8 +1782,8 @@ "shortName": "UpdateIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_async", + "file": "appengine_v1_generated_firewall_update_ingress_rule_async.py", + "regionTag": "appengine_v1_generated_Firewall_UpdateIngressRule_async", "segments": [ { "end": 43, @@ -1826,8 +1826,8 @@ "shortName": "UpdateIngressRule" } }, - "file": "appengine_generated_appengine_admin_v1_firewall_update_ingress_rule_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Firewall_UpdateIngressRule_sync", + "file": "appengine_v1_generated_firewall_update_ingress_rule_sync.py", + "regionTag": "appengine_v1_generated_Firewall_UpdateIngressRule_sync", "segments": [ { "end": 43, @@ -1871,8 +1871,8 @@ "shortName": "DebugInstance" } }, - "file": "appengine_generated_appengine_admin_v1_instances_debug_instance_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_DebugInstance_async", + "file": "appengine_v1_generated_instances_debug_instance_async.py", + "regionTag": "appengine_v1_generated_Instances_DebugInstance_async", "segments": [ { "end": 47, @@ -1915,8 +1915,8 @@ "shortName": "DebugInstance" } }, - "file": "appengine_generated_appengine_admin_v1_instances_debug_instance_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_DebugInstance_sync", + "file": "appengine_v1_generated_instances_debug_instance_sync.py", + "regionTag": "appengine_v1_generated_Instances_DebugInstance_sync", "segments": [ { "end": 47, @@ -1960,8 +1960,8 @@ "shortName": "DeleteInstance" } }, - "file": "appengine_generated_appengine_admin_v1_instances_delete_instance_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_DeleteInstance_async", + "file": "appengine_v1_generated_instances_delete_instance_async.py", + "regionTag": "appengine_v1_generated_Instances_DeleteInstance_async", "segments": [ { "end": 47, @@ -2004,8 +2004,8 @@ "shortName": "DeleteInstance" } }, - "file": "appengine_generated_appengine_admin_v1_instances_delete_instance_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_DeleteInstance_sync", + "file": "appengine_v1_generated_instances_delete_instance_sync.py", + "regionTag": "appengine_v1_generated_Instances_DeleteInstance_sync", "segments": [ { "end": 47, @@ -2049,8 +2049,8 @@ "shortName": "GetInstance" } }, - "file": "appengine_generated_appengine_admin_v1_instances_get_instance_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_GetInstance_async", + "file": "appengine_v1_generated_instances_get_instance_async.py", + "regionTag": "appengine_v1_generated_Instances_GetInstance_async", "segments": [ { "end": 43, @@ -2093,8 +2093,8 @@ "shortName": "GetInstance" } }, - "file": "appengine_generated_appengine_admin_v1_instances_get_instance_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_GetInstance_sync", + "file": "appengine_v1_generated_instances_get_instance_sync.py", + "regionTag": "appengine_v1_generated_Instances_GetInstance_sync", "segments": [ { "end": 43, @@ -2138,8 +2138,8 @@ "shortName": "ListInstances" } }, - "file": "appengine_generated_appengine_admin_v1_instances_list_instances_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_ListInstances_async", + "file": "appengine_v1_generated_instances_list_instances_async.py", + "regionTag": "appengine_v1_generated_Instances_ListInstances_async", "segments": [ { "end": 44, @@ -2182,8 +2182,8 @@ "shortName": "ListInstances" } }, - "file": "appengine_generated_appengine_admin_v1_instances_list_instances_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Instances_ListInstances_sync", + "file": "appengine_v1_generated_instances_list_instances_sync.py", + "regionTag": "appengine_v1_generated_Instances_ListInstances_sync", "segments": [ { "end": 44, @@ -2227,8 +2227,8 @@ "shortName": "DeleteService" } }, - "file": "appengine_generated_appengine_admin_v1_services_delete_service_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_DeleteService_async", + "file": "appengine_v1_generated_services_delete_service_async.py", + "regionTag": "appengine_v1_generated_Services_DeleteService_async", "segments": [ { "end": 47, @@ -2271,8 +2271,8 @@ "shortName": "DeleteService" } }, - "file": "appengine_generated_appengine_admin_v1_services_delete_service_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_DeleteService_sync", + "file": "appengine_v1_generated_services_delete_service_sync.py", + "regionTag": "appengine_v1_generated_Services_DeleteService_sync", "segments": [ { "end": 47, @@ -2316,8 +2316,8 @@ "shortName": "GetService" } }, - "file": "appengine_generated_appengine_admin_v1_services_get_service_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_GetService_async", + "file": "appengine_v1_generated_services_get_service_async.py", + "regionTag": "appengine_v1_generated_Services_GetService_async", "segments": [ { "end": 43, @@ -2360,8 +2360,8 @@ "shortName": "GetService" } }, - "file": "appengine_generated_appengine_admin_v1_services_get_service_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_GetService_sync", + "file": "appengine_v1_generated_services_get_service_sync.py", + "regionTag": "appengine_v1_generated_Services_GetService_sync", "segments": [ { "end": 43, @@ -2405,8 +2405,8 @@ "shortName": "ListServices" } }, - "file": "appengine_generated_appengine_admin_v1_services_list_services_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_ListServices_async", + "file": "appengine_v1_generated_services_list_services_async.py", + "regionTag": "appengine_v1_generated_Services_ListServices_async", "segments": [ { "end": 44, @@ -2449,8 +2449,8 @@ "shortName": "ListServices" } }, - "file": "appengine_generated_appengine_admin_v1_services_list_services_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_ListServices_sync", + "file": "appengine_v1_generated_services_list_services_sync.py", + "regionTag": "appengine_v1_generated_Services_ListServices_sync", "segments": [ { "end": 44, @@ -2494,8 +2494,8 @@ "shortName": "UpdateService" } }, - "file": "appengine_generated_appengine_admin_v1_services_update_service_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_UpdateService_async", + "file": "appengine_v1_generated_services_update_service_async.py", + "regionTag": "appengine_v1_generated_Services_UpdateService_async", "segments": [ { "end": 47, @@ -2538,8 +2538,8 @@ "shortName": "UpdateService" } }, - "file": "appengine_generated_appengine_admin_v1_services_update_service_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Services_UpdateService_sync", + "file": "appengine_v1_generated_services_update_service_sync.py", + "regionTag": "appengine_v1_generated_Services_UpdateService_sync", "segments": [ { "end": 47, @@ -2583,8 +2583,8 @@ "shortName": "CreateVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_create_version_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_CreateVersion_async", + "file": "appengine_v1_generated_versions_create_version_async.py", + "regionTag": "appengine_v1_generated_Versions_CreateVersion_async", "segments": [ { "end": 47, @@ -2627,8 +2627,8 @@ "shortName": "CreateVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_create_version_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_CreateVersion_sync", + "file": "appengine_v1_generated_versions_create_version_sync.py", + "regionTag": "appengine_v1_generated_Versions_CreateVersion_sync", "segments": [ { "end": 47, @@ -2672,8 +2672,8 @@ "shortName": "DeleteVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_delete_version_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_DeleteVersion_async", + "file": "appengine_v1_generated_versions_delete_version_async.py", + "regionTag": "appengine_v1_generated_Versions_DeleteVersion_async", "segments": [ { "end": 47, @@ -2716,8 +2716,8 @@ "shortName": "DeleteVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_delete_version_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_DeleteVersion_sync", + "file": "appengine_v1_generated_versions_delete_version_sync.py", + "regionTag": "appengine_v1_generated_Versions_DeleteVersion_sync", "segments": [ { "end": 47, @@ -2761,8 +2761,8 @@ "shortName": "GetVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_get_version_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_GetVersion_async", + "file": "appengine_v1_generated_versions_get_version_async.py", + "regionTag": "appengine_v1_generated_Versions_GetVersion_async", "segments": [ { "end": 43, @@ -2805,8 +2805,8 @@ "shortName": "GetVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_get_version_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_GetVersion_sync", + "file": "appengine_v1_generated_versions_get_version_sync.py", + "regionTag": "appengine_v1_generated_Versions_GetVersion_sync", "segments": [ { "end": 43, @@ -2850,8 +2850,8 @@ "shortName": "ListVersions" } }, - "file": "appengine_generated_appengine_admin_v1_versions_list_versions_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_ListVersions_async", + "file": "appengine_v1_generated_versions_list_versions_async.py", + "regionTag": "appengine_v1_generated_Versions_ListVersions_async", "segments": [ { "end": 44, @@ -2894,8 +2894,8 @@ "shortName": "ListVersions" } }, - "file": "appengine_generated_appengine_admin_v1_versions_list_versions_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_ListVersions_sync", + "file": "appengine_v1_generated_versions_list_versions_sync.py", + "regionTag": "appengine_v1_generated_Versions_ListVersions_sync", "segments": [ { "end": 44, @@ -2939,8 +2939,8 @@ "shortName": "UpdateVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_update_version_async.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_UpdateVersion_async", + "file": "appengine_v1_generated_versions_update_version_async.py", + "regionTag": "appengine_v1_generated_Versions_UpdateVersion_async", "segments": [ { "end": 47, @@ -2983,8 +2983,8 @@ "shortName": "UpdateVersion" } }, - "file": "appengine_generated_appengine_admin_v1_versions_update_version_sync.py", - "regionTag": "appengine_generated_appengine_admin_v1_Versions_UpdateVersion_sync", + "file": "appengine_v1_generated_versions_update_version_sync.py", + "regionTag": "appengine_v1_generated_Versions_UpdateVersion_sync", "segments": [ { "end": 47, From bf10b13db5da48a81a761bd72308ac19de64a5b0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 26 Feb 2022 05:12:45 -0500 Subject: [PATCH 084/185] chore: update copyright year to 2022 (#108) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update copyright year to 2022 PiperOrigin-RevId: 431037888 Source-Link: https://github.com/googleapis/googleapis/commit/b3397f5febbf21dfc69b875ddabaf76bee765058 Source-Link: https://github.com/googleapis/googleapis-gen/commit/510b54e1cdefd53173984df16645081308fe897e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTEwYjU0ZTFjZGVmZDUzMTczOTg0ZGYxNjY0NTA4MTMwOGZlODk3ZSJ9 * 🦉 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 --- 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 +- .../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 +- .../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 +- .../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 +- 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 +- 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 +- 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 +- 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 +- 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 +- scripts/fixup_appengine_admin_v1_keywords.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 +- 164 files changed, 164 insertions(+), 164 deletions(-) diff --git a/google/cloud/appengine_admin/__init__.py b/google/cloud/appengine_admin/__init__.py index 579693b..0dc3839 100644 --- a/google/cloud/appengine_admin/__init__.py +++ b/google/cloud/appengine_admin/__init__.py @@ -1,5 +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. diff --git a/google/cloud/appengine_admin_v1/__init__.py b/google/cloud/appengine_admin_v1/__init__.py index 9bb498e..d67f02d 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 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. diff --git a/google/cloud/appengine_admin_v1/services/__init__.py b/google/cloud/appengine_admin_v1/services/__init__.py index 4de6597..e8e1c38 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 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. diff --git a/google/cloud/appengine_admin_v1/services/applications/__init__.py b/google/cloud/appengine_admin_v1/services/applications/__init__.py index 77403bc..5a89ba0 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 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. 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 5f0b764..26e842b 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 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. diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 8d2f6e9..f5cd4cc 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 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. 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 0acb98c..27d1aad 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 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. 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 61624e0..943e943 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 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. 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 2c18276..0ceb1a5 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 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. 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 6f3b544..f93b2ba 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 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. 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 2fc9832..9f07aa4 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 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. 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 b988e62..b56f780 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 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. 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 792e5e9..329bae4 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 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. 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 77d8f0e..8b6797c 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 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. 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 c273e23..8b42e99 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 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. 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 5009315..425e0e5 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 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. 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 03fc5e7..a03c4b2 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 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. 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 748ce16..2e16bdc 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 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. 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 f8ce19e..caf4e2e 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 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. 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 c5a48bc..810256e 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 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. 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 4e2d185..052b6ac 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 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. 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 70911d5..f250a7a 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 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. 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 e602ae6..09deb66 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 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. 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 c9bc5fd..c6b4408 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 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. 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 4beceb3..b3aa2d5 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 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. 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 01ff7ed..56763fe 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 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. 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 a05b43b..c900f1f 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 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. 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 1624f89..0d7bd05 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 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. 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 7d1163d..66624e5 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 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. 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 24559ba..9eef25f 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 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. 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 aa6671d..f4abef8 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 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. 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 5b88674..1c3cf92 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 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. 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 15a8db9..bac6281 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 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. 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 9cc4ec1..7749c25 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 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. diff --git a/google/cloud/appengine_admin_v1/services/firewall/__init__.py b/google/cloud/appengine_admin_v1/services/firewall/__init__.py index a240af0..2a1dc5a 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 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. 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 1df9565..5f617a6 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 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. diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 63c9262..391c84f 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 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. diff --git a/google/cloud/appengine_admin_v1/services/firewall/pagers.py b/google/cloud/appengine_admin_v1/services/firewall/pagers.py index 9765510..1e3aa6f 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 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. 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 dc4aacd..8fe35b5 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 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. 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 3dbbafe..20c50f9 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 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. 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 f402df4..ee5d9fd 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 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. 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 6c73eb4..ff660d4 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 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. diff --git a/google/cloud/appengine_admin_v1/services/instances/__init__.py b/google/cloud/appengine_admin_v1/services/instances/__init__.py index 9e55542..a655183 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 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. 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 8e5b77a..0cf56c8 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 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. diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index 85f1dad..e79fa4c 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 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. diff --git a/google/cloud/appengine_admin_v1/services/instances/pagers.py b/google/cloud/appengine_admin_v1/services/instances/pagers.py index 7ae59f3..da63e00 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 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. 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 7ff9ef5..a977af3 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 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. 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 14c52fb..d323957 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 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. 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 705fff4..5813009 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 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. 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 d4624f3..aae1f75 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 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. diff --git a/google/cloud/appengine_admin_v1/services/services/__init__.py b/google/cloud/appengine_admin_v1/services/services/__init__.py index b902b99..f8e9062 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 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. 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 941c58d..43daaa3 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 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. diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index e85c971..ce1c133 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 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. diff --git a/google/cloud/appengine_admin_v1/services/services/pagers.py b/google/cloud/appengine_admin_v1/services/services/pagers.py index 7754d18..fa99c03 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 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. 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 6e8aa5c..7597c5d 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 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. 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 f92d7cd..db2a930 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 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. 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 c4cfb5a..6cbbd1e 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 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. 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 a6f14f7..4f3d79c 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 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. diff --git a/google/cloud/appengine_admin_v1/services/versions/__init__.py b/google/cloud/appengine_admin_v1/services/versions/__init__.py index 586be18..78f73aa 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 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. 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 af8fd33..55194ca 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 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. diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 59838c1..9b2fae9 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 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. diff --git a/google/cloud/appengine_admin_v1/services/versions/pagers.py b/google/cloud/appengine_admin_v1/services/versions/pagers.py index 3417dbc..35654e9 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 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. 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 c5a42a0..ab80b3b 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 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. 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 41bf091..ad363b9 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 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. 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 7aca34e..0ed6ce9 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 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. 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 48735ea..d187eca 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 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. diff --git a/google/cloud/appengine_admin_v1/types/__init__.py b/google/cloud/appengine_admin_v1/types/__init__.py index dfe79d6..0af6953 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 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. diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 0240b81..2d4fbc3 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 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. diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index 3c04ecd..1b67aaf 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 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. diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index 47022cf..c8a00f3 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 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. diff --git a/google/cloud/appengine_admin_v1/types/audit_data.py b/google/cloud/appengine_admin_v1/types/audit_data.py index 525dacd..c511e4f 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 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. diff --git a/google/cloud/appengine_admin_v1/types/certificate.py b/google/cloud/appengine_admin_v1/types/certificate.py index cd20a74..cce73e9 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 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. diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index 57515dd..5faf790 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 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. diff --git a/google/cloud/appengine_admin_v1/types/deployed_files.py b/google/cloud/appengine_admin_v1/types/deployed_files.py index 3b05140..06128b6 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 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. diff --git a/google/cloud/appengine_admin_v1/types/domain.py b/google/cloud/appengine_admin_v1/types/domain.py index ea6c8f4..e8a38de 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 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. diff --git a/google/cloud/appengine_admin_v1/types/domain_mapping.py b/google/cloud/appengine_admin_v1/types/domain_mapping.py index 68f1188..c94e986 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 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. diff --git a/google/cloud/appengine_admin_v1/types/firewall.py b/google/cloud/appengine_admin_v1/types/firewall.py index 175346e..9c053fc 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 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. diff --git a/google/cloud/appengine_admin_v1/types/instance.py b/google/cloud/appengine_admin_v1/types/instance.py index 2c7c779..c34449a 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 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. diff --git a/google/cloud/appengine_admin_v1/types/location.py b/google/cloud/appengine_admin_v1/types/location.py index 28543e7..380bc37 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 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. diff --git a/google/cloud/appengine_admin_v1/types/network_settings.py b/google/cloud/appengine_admin_v1/types/network_settings.py index 09f2289..f47b470 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 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. diff --git a/google/cloud/appengine_admin_v1/types/operation.py b/google/cloud/appengine_admin_v1/types/operation.py index f5b89c4..d373c7b 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 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. diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index 318f195..a124123 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 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. diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 5dcc841..1c3b4b8 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 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. 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 d0f760e..c7bcd43 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 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. 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 b60a6fd..a34076e 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 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. 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 e40c960..75bf03a 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 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. 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 94c7ea0..091e29c 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 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. 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 704c729..b8b2e88 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 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. 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 a6c31c6..84f89dc 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 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. 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 ca1dc21..8581b19 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 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. 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 6ed86cc..d313fbd 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 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. 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 d4640e3..d2f8dd1 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 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. 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 c9c69fa..c685f50 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 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. 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 cfd6c11..a368196 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 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. 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 ecb664d..4b09487 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 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. 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 049dfe2..fca440b 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 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. 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 8935630..eb6ff84 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 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. 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 affcb77..78a7e96 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 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. 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 6e16941..36050f0 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 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. 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 7ca930f..7628188 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 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. 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 56e1e91..73070a4 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 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. 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 a44bd6d..c553401 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 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. 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 eef1946..a5d8ca2 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 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. 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 0e2eccb..9112c71 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 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. 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 9e17fff..edb7470 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 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. 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 556f14b..5ecc6b2 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 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. 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 c72cfff..2509620 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 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. 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 bf0f67c..f41b68c 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 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. 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 76073eb..c6db15d 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 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. 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 d634f39..f3f8548 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 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. 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 8aed508..3deec84 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 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. 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 8f6609e..f27e7a3 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 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. 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 002d435..e5afe73 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 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. 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 02b2747..ee660d9 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 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. 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 2c65b80..ecca58f 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 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. 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 9cd8700..85922e4 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 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. 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 ca1d21f..e88bdbe 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 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. 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 f3e4255..d6153f6 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 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. 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 998420e..5684297 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 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. 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 9b38c85..d2434d8 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 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. 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 b4807d7..846afa6 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 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. 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 6dec65a..7e29704 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 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. 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 e2eb755..c4496e5 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 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. 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 b7d8fa6..90475f3 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 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. 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 e3a2c7b..b091b83 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 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. 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 256075f..6872a7b 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 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. 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 da3035d..5c4aab3 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 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. 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 eadc14e..44cd5ea 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 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. 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 615f32e..e7f554e 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 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. 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 c68dea1..68d2cc7 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 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. 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 84f3c97..624a6c2 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 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. 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 053e5a5..e783112 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 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. 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 807338f..5db0e21 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 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. 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 ab0519e..a820bd0 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 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. 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 73d53a2..412d12d 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 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. 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 40bac59..86e01db 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 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. 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 7fd0ee9..11461b8 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 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. 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 495ffaf..b34dce6 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 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. 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 c9722ae..f845c93 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 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. 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 c95c243..159082c 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 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. 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 0d43d22..2f98cd1 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 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. 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 ee8c199..0b7167b 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 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. 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 7775b0e..3fe3b85 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 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. 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 4cf224f..d62e1cf 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 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. 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 0996bf9..33ee0b5 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 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. 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 33363a7..af77bf5 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 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. 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 606bd24..50614fc 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 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. 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 83a56ef..2af4092 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 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. 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 a5055b7..e70220c 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 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. 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 d27a7f4..7a9546d 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 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. 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 4368c55..08eb2f8 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 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. diff --git a/scripts/fixup_appengine_admin_v1_keywords.py b/scripts/fixup_appengine_admin_v1_keywords.py index d8d9f5c..576b666 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 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. diff --git a/tests/__init__.py b/tests/__init__.py index 4de6597..e8e1c38 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +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. diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index 4de6597..e8e1c38 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,5 +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. diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py index 4de6597..e8e1c38 100644 --- a/tests/unit/gapic/__init__.py +++ b/tests/unit/gapic/__init__.py @@ -1,5 +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. diff --git a/tests/unit/gapic/appengine_admin_v1/__init__.py b/tests/unit/gapic/appengine_admin_v1/__init__.py index 4de6597..e8e1c38 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 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. diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index eec9aaa..c2bd823 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 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. 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 8f65a27..9966789 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 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. 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 273410a..7ca50da 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 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. 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 03d713c..d46c61a 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 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. diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 377b54f..49e3343 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 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. diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 0fd4808..4935b8d 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 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. diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 28875a6..d5f34de 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 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. diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index e20860a..77d13a3 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 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. From 3a25a8f2786aca3d7a01abf4f46872e41d8128af Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 14:54:12 +0000 Subject: [PATCH 085/185] chore(deps): update actions/setup-python action to v3 (#110) Source-Link: https://github.com/googleapis/synthtool/commit/571ee2c3b26182429eddcf115122ee545d7d3787 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:660abdf857d3ab9aabcd967c163c70e657fcc5653595c709263af5f3fa23ef67 --- .github/.OwlBot.lock.yaml | 2 +- .github/workflows/docs.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/unittest.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 39ad3ce..d9a55fa 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:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0 + digest: sha256:660abdf857d3ab9aabcd967c163c70e657fcc5653595c709263af5f3fa23ef67 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f7b8344..cca4e98 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install nox @@ -26,7 +26,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install nox diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1e8b05c..f687324 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install nox diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 074ee25..d3003e0 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} - name: Install nox @@ -39,7 +39,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install coverage From 18ab2ca0553bcd0ca76dd8fc67fc5246eab269c7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 19:41:08 -0500 Subject: [PATCH 086/185] chore(deps): update actions/checkout action to v3 (#112) Source-Link: https://github.com/googleapis/synthtool/commit/ca879097772aeec2cbb971c3cea8ecc81522b68a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/workflows/docs.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/unittest.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d9a55fa..480226a 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:660abdf857d3ab9aabcd967c163c70e657fcc5653595c709263af5f3fa23ef67 + digest: sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cca4e98..b46d730 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f687324..f512a49 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index d3003e0..e87fe5b 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -11,7 +11,7 @@ jobs: python: ['3.6', '3.7', '3.8', '3.9', '3.10'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: @@ -37,7 +37,7 @@ jobs: - unit steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v3 with: From a4b36244e2e566770f3cca84aac9bb003ca47f56 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 4 Mar 2022 11:32:13 -0500 Subject: [PATCH 087/185] fix(deps): require google-api-core>=1.31.5, >=2.3.2 (#115) --- setup.py | 2 +- testing/constraints-3.6.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 150c2f6..73a82cf 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ # 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.28.0, <3.0.0dev", + "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", "proto-plus >= 1.18.1", "grpc-google-iam-v1", "six", diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index f4ff370..64d95bb 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.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.28.0 +google-api-core==1.31.5 proto-plus==1.18.1 grpc-google-iam-v1==0.12.3 six==1.13.0 From d645ed67d6d7851afbde1932b91105ec33f971ef Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 19:31:59 -0500 Subject: [PATCH 088/185] chore(deps): update actions/download-artifact action to v3 (#117) Source-Link: https://github.com/googleapis/synthtool/commit/38e11ad1104dcc1e63b52691ddf2fe4015d06955 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/workflows/unittest.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 480226a..44c78f7 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:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392 + digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e87fe5b..e5be6ed 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -26,7 +26,7 @@ jobs: run: | nox -s unit-${{ matrix.python }} - name: Upload coverage results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: coverage-artifacts path: .coverage-${{ matrix.python }} @@ -47,7 +47,7 @@ jobs: python -m pip install --upgrade setuptools pip wheel python -m pip install coverage - name: Download coverage results - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: coverage-artifacts path: .coverage-results/ From 1d21907450dba92f4b7c4e934e22781403b4480f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 7 Mar 2022 11:35:45 -0500 Subject: [PATCH 089/185] chore(main): release 1.3.2 (#116) 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 0b31632..0db5d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 73a82cf..4dcb351 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.3.1" +version = "1.3.2" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 00858bbc5abeb37da8585c7d1026e9cf24b22432 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 00:00:14 +0000 Subject: [PATCH 090/185] chore(python): use black==22.3.0 (#118) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 5 +- .../services/applications/async_client.py | 28 +- .../services/applications/client.py | 69 ++- .../services/applications/transports/base.py | 22 +- .../services/applications/transports/grpc.py | 3 +- .../authorized_certificates/async_client.py | 38 +- .../authorized_certificates/client.py | 77 ++- .../transports/base.py | 6 +- .../transports/grpc.py | 3 +- .../authorized_domains/async_client.py | 12 +- .../services/authorized_domains/client.py | 51 +- .../authorized_domains/transports/base.py | 6 +- .../authorized_domains/transports/grpc.py | 3 +- .../services/domain_mappings/async_client.py | 40 +- .../services/domain_mappings/client.py | 81 +++- .../domain_mappings/transports/base.py | 10 +- .../domain_mappings/transports/grpc.py | 3 +- .../services/firewall/async_client.py | 45 +- .../services/firewall/client.py | 86 +++- .../services/firewall/transports/base.py | 26 +- .../services/firewall/transports/grpc.py | 3 +- .../services/instances/async_client.py | 33 +- .../services/instances/client.py | 86 +++- .../services/instances/transports/base.py | 22 +- .../services/instances/transports/grpc.py | 3 +- .../services/services/async_client.py | 33 +- .../services/services/client.py | 74 ++- .../services/services/transports/base.py | 22 +- .../services/services/transports/grpc.py | 3 +- .../services/versions/async_client.py | 40 +- .../services/versions/client.py | 81 +++- .../services/versions/transports/base.py | 26 +- .../services/versions/transports/grpc.py | 3 +- .../appengine_admin_v1/types/app_yaml.py | 248 ++++++++-- .../appengine_admin_v1/types/appengine.py | 433 +++++++++++++---- .../appengine_admin_v1/types/application.py | 123 ++++- .../appengine_admin_v1/types/audit_data.py | 24 +- .../appengine_admin_v1/types/certificate.py | 64 ++- .../cloud/appengine_admin_v1/types/deploy.py | 62 ++- .../types/deployed_files.py | 5 +- .../cloud/appengine_admin_v1/types/domain.py | 15 +- .../types/domain_mapping.py | 58 ++- .../appengine_admin_v1/types/firewall.py | 28 +- .../appengine_admin_v1/types/instance.py | 98 +++- .../appengine_admin_v1/types/location.py | 20 +- .../types/network_settings.py | 9 +- .../appengine_admin_v1/types/operation.py | 47 +- .../cloud/appengine_admin_v1/types/service.py | 38 +- .../cloud/appengine_admin_v1/types/version.py | 451 ++++++++++++++---- noxfile.py | 9 +- .../appengine_admin_v1/test_applications.py | 211 ++++++-- .../test_authorized_certificates.py | 226 ++++++--- .../test_authorized_domains.py | 168 +++++-- .../test_domain_mappings.py | 294 +++++++++--- .../gapic/appengine_admin_v1/test_firewall.py | 365 ++++++++++---- .../appengine_admin_v1/test_instances.py | 330 ++++++++++--- .../gapic/appengine_admin_v1/test_services.py | 355 ++++++++++---- .../gapic/appengine_admin_v1/test_versions.py | 380 +++++++++++---- 59 files changed, 3983 insertions(+), 1123 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..87dd006 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:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/docs/conf.py b/docs/conf.py index 4b413e4..0d9d28a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -361,7 +361,10 @@ 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,), + "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), 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 26e842b..2c7219d 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -263,7 +263,12 @@ def sample_get_application(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -341,7 +346,12 @@ def sample_create_application(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -429,7 +439,12 @@ def sample_update_application(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -521,7 +536,12 @@ def sample_repair_application(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index f5cd4cc..783cf86 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -57,7 +57,10 @@ class ApplicationsClientMeta(type): _transport_registry["grpc"] = ApplicationsGrpcTransport _transport_registry["grpc_asyncio"] = ApplicationsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ApplicationsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ApplicationsTransport]: """Returns an appropriate transport class. Args: @@ -162,7 +165,9 @@ def transport(self) -> ApplicationsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -175,9 +180,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -186,9 +195,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -197,9 +210,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -208,10 +225,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -449,7 +470,12 @@ def sample_get_application(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -528,7 +554,12 @@ def sample_create_application(): rpc = self._transport._wrapped_methods[self._transport.create_application] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -617,7 +648,12 @@ def sample_update_application(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -710,7 +746,12 @@ def sample_repair_application(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( 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 943e943..b1d4942 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -128,25 +128,33 @@ 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.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.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.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, + 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 0ceb1a5..3ce9450 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property 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 b56f780..38b1e00 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 @@ -276,12 +276,20 @@ def sample_list_authorized_certificates(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -352,7 +360,12 @@ def sample_get_authorized_certificate(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -422,7 +435,12 @@ def sample_create_authorized_certificate(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -498,7 +516,12 @@ def sample_update_authorized_certificate(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -557,7 +580,10 @@ def sample_delete_authorized_certificate(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): 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 329bae4..b9e92c6 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_certificates/client.py @@ -58,7 +58,8 @@ class AuthorizedCertificatesClientMeta(type): _transport_registry["grpc_asyncio"] = AuthorizedCertificatesGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[AuthorizedCertificatesTransport]: """Returns an appropriate transport class. @@ -167,7 +168,9 @@ def transport(self) -> AuthorizedCertificatesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -180,9 +183,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -191,9 +198,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -202,9 +213,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -213,10 +228,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -461,12 +480,20 @@ def sample_list_authorized_certificates(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -540,7 +567,12 @@ def sample_get_authorized_certificate(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -613,7 +645,12 @@ def sample_create_authorized_certificate(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -692,7 +729,12 @@ def sample_update_authorized_certificate(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -754,7 +796,10 @@ def sample_delete_authorized_certificate(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): 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 425e0e5..7a59eca 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 @@ -156,9 +156,9 @@ def _prep_wrapped_messages(self, 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 a03c4b2..3bc13d2 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 @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property 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 810256e..5a89294 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 @@ -272,12 +272,20 @@ def sample_list_authorized_domains(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. 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 052b6ac..dd02522 100644 --- a/google/cloud/appengine_admin_v1/services/authorized_domains/client.py +++ b/google/cloud/appengine_admin_v1/services/authorized_domains/client.py @@ -57,7 +57,8 @@ class AuthorizedDomainsClientMeta(type): _transport_registry["grpc_asyncio"] = AuthorizedDomainsGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[AuthorizedDomainsTransport]: """Returns an appropriate transport class. @@ -166,7 +167,9 @@ def transport(self) -> AuthorizedDomainsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -179,9 +182,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -190,9 +197,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -201,9 +212,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -212,10 +227,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -458,12 +477,20 @@ def sample_list_authorized_domains(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. 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 c6b4408..fc9c28f 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 @@ -134,9 +134,9 @@ def _prep_wrapped_messages(self, 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 b3aa2d5..d4b381f 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 @@ -226,8 +226,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property 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 0d7bd05..65786df 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 @@ -270,12 +270,20 @@ def sample_list_domain_mappings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -343,7 +351,12 @@ def sample_get_domain_mapping(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -421,7 +434,12 @@ def sample_create_domain_mapping(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -508,7 +526,12 @@ def sample_update_domain_mapping(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -603,7 +626,12 @@ def sample_delete_domain_mapping(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( 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 66624e5..8a4f006 100644 --- a/google/cloud/appengine_admin_v1/services/domain_mappings/client.py +++ b/google/cloud/appengine_admin_v1/services/domain_mappings/client.py @@ -60,7 +60,10 @@ class DomainMappingsClientMeta(type): _transport_registry["grpc"] = DomainMappingsGrpcTransport _transport_registry["grpc_asyncio"] = DomainMappingsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[DomainMappingsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DomainMappingsTransport]: """Returns an appropriate transport class. Args: @@ -165,7 +168,9 @@ def transport(self) -> DomainMappingsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -178,9 +183,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -189,9 +198,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -200,9 +213,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -211,10 +228,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -454,12 +475,20 @@ def sample_list_domain_mappings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -528,7 +557,12 @@ def sample_get_domain_mapping(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -607,7 +641,12 @@ def sample_create_domain_mapping(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -695,7 +734,12 @@ def sample_update_domain_mapping(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -791,7 +835,12 @@ def sample_delete_domain_mapping(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( 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 1c3cf92..6df59f0 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 @@ -133,7 +133,9 @@ def _prep_wrapped_messages(self, client_info): 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.get_domain_mapping, + default_timeout=None, + client_info=client_info, ), self.create_domain_mapping: gapic_v1.method.wrap_method( self.create_domain_mapping, @@ -155,9 +157,9 @@ def _prep_wrapped_messages(self, 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 bac6281..aaaba25 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 @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property 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 5f617a6..a0ef328 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -269,12 +269,20 @@ def sample_list_ingress_rules(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -347,7 +355,12 @@ def sample_batch_update_ingress_rules(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -416,7 +429,12 @@ def sample_create_ingress_rule(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -485,7 +503,12 @@ def sample_get_ingress_rule(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -554,7 +577,12 @@ def sample_update_ingress_rule(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -613,7 +641,10 @@ def sample_delete_ingress_rule(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 391c84f..98b409b 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -54,7 +54,10 @@ class FirewallClientMeta(type): _transport_registry["grpc"] = FirewallGrpcTransport _transport_registry["grpc_asyncio"] = FirewallGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[FirewallTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[FirewallTransport]: """Returns an appropriate transport class. Args: @@ -170,7 +173,9 @@ def transport(self) -> FirewallTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -183,9 +188,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -194,9 +203,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -205,9 +218,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -216,10 +233,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -459,12 +480,20 @@ def sample_list_ingress_rules(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -540,7 +569,12 @@ def sample_batch_update_ingress_rules(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -610,7 +644,12 @@ def sample_create_ingress_rule(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -680,7 +719,12 @@ def sample_get_ingress_rule(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -750,7 +794,12 @@ def sample_update_ingress_rule(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -810,7 +859,10 @@ def sample_delete_ingress_rule(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): 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 20c50f9..b1507ae 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -127,7 +127,9 @@ 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.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, @@ -135,25 +137,33 @@ def _prep_wrapped_messages(self, client_info): 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.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.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.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, + 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 ee5d9fd..6670bd6 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -236,8 +236,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property 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 0cf56c8..6f4d0cd 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -272,12 +272,20 @@ def sample_list_instances(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -346,7 +354,12 @@ def sample_get_instance(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -445,7 +458,12 @@ def sample_delete_instance(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -536,7 +554,12 @@ def sample_debug_instance(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index e79fa4c..e462f2a 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -59,7 +59,10 @@ class InstancesClientMeta(type): _transport_registry["grpc"] = InstancesGrpcTransport _transport_registry["grpc_asyncio"] = InstancesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[InstancesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[InstancesTransport]: """Returns an appropriate transport class. Args: @@ -164,10 +167,18 @@ def transport(self) -> InstancesTransport: return self._transport @staticmethod - def instance_path(app: str, service: str, version: str, instance: str,) -> str: + 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, + app=app, + service=service, + version=version, + instance=instance, ) @staticmethod @@ -180,7 +191,9 @@ def parse_instance_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -193,9 +206,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -204,9 +221,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -215,9 +236,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -226,10 +251,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -474,12 +503,20 @@ def sample_list_instances(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -549,7 +586,12 @@ def sample_get_instance(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -649,7 +691,12 @@ def sample_delete_instance(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -741,7 +788,12 @@ def sample_debug_instance(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( 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 d323957..fd37b2b 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -128,25 +128,33 @@ 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.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.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.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, + 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 5813009..3449a91 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property 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 43daaa3..6109f9d 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -263,12 +263,20 @@ def sample_list_services(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -348,7 +356,12 @@ def sample_get_service(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -428,7 +441,12 @@ def sample_update_service(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -522,7 +540,12 @@ def sample_delete_service(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index ce1c133..036ec01 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -59,7 +59,10 @@ class ServicesClientMeta(type): _transport_registry["grpc"] = ServicesGrpcTransport _transport_registry["grpc_asyncio"] = ServicesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ServicesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ServicesTransport]: """Returns an appropriate transport class. Args: @@ -164,7 +167,9 @@ def transport(self) -> ServicesTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -177,9 +182,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -188,9 +197,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -199,9 +212,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -210,10 +227,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -453,12 +474,20 @@ def sample_list_services(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -539,7 +568,12 @@ def sample_get_service(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -620,7 +654,12 @@ def sample_update_service(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -715,7 +754,12 @@ def sample_delete_service(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( 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 db2a930..2f8893a 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -128,25 +128,33 @@ 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.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.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.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, + 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 6cbbd1e..c10664e 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property 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 55194ca..ec8ed93 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -266,12 +266,20 @@ def sample_list_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -343,7 +351,12 @@ def sample_get_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -416,7 +429,12 @@ def sample_create_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -533,7 +551,12 @@ def sample_update_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -625,7 +648,12 @@ def sample_delete_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 9b2fae9..3c77a02 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -62,7 +62,10 @@ class VersionsClientMeta(type): _transport_registry["grpc"] = VersionsGrpcTransport _transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[VersionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[VersionsTransport]: """Returns an appropriate transport class. Args: @@ -167,7 +170,9 @@ def transport(self) -> VersionsTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + 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, @@ -180,9 +185,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -191,9 +200,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -202,9 +215,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -213,10 +230,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + 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, + project=project, + location=location, ) @staticmethod @@ -456,12 +477,20 @@ def sample_list_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + 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, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -534,7 +563,12 @@ def sample_get_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -608,7 +642,12 @@ def sample_create_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -726,7 +765,12 @@ def sample_update_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( @@ -819,7 +863,12 @@ def sample_delete_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = gac_operation.from_gapic( 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 ad363b9..0b17c61 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -128,28 +128,38 @@ 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.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.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.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.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, + 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! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() 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 0ed6ce9..10b8ba4 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 2d4fbc3..619e12e 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -84,11 +84,29 @@ class ApiConfigHandler(proto.Message): URL to serve the endpoint at. """ - auth_fail_action = proto.Field(proto.ENUM, number=1, enum="AuthFailAction",) - login = proto.Field(proto.ENUM, number=2, enum="LoginRequirement",) - script = proto.Field(proto.STRING, number=3,) - security_level = proto.Field(proto.ENUM, number=4, enum="SecurityLevel",) - url = proto.Field(proto.STRING, number=5,) + auth_fail_action = proto.Field( + proto.ENUM, + number=1, + enum="AuthFailAction", + ) + login = proto.Field( + proto.ENUM, + number=2, + enum="LoginRequirement", + ) + script = proto.Field( + proto.STRING, + number=3, + ) + security_level = proto.Field( + proto.ENUM, + number=4, + enum="SecurityLevel", + ) + url = proto.Field( + proto.STRING, + number=5, + ) class ErrorHandler(proto.Message): @@ -113,9 +131,19 @@ class ErrorCode(proto.Enum): ERROR_CODE_DOS_API_DENIAL = 2 ERROR_CODE_TIMEOUT = 3 - error_code = proto.Field(proto.ENUM, number=1, enum=ErrorCode,) - static_file = proto.Field(proto.STRING, number=2,) - mime_type = proto.Field(proto.STRING, number=3,) + error_code = proto.Field( + proto.ENUM, + number=1, + enum=ErrorCode, + ) + static_file = proto.Field( + proto.STRING, + number=2, + ) + mime_type = proto.Field( + proto.STRING, + number=3, + ) class UrlMap(proto.Message): @@ -177,21 +205,47 @@ class RedirectHttpResponseCode(proto.Enum): REDIRECT_HTTP_RESPONSE_CODE_303 = 3 REDIRECT_HTTP_RESPONSE_CODE_307 = 4 - url_regex = proto.Field(proto.STRING, number=1,) + url_regex = proto.Field( + proto.STRING, + number=1, + ) static_files = proto.Field( - proto.MESSAGE, number=2, oneof="handler_type", message="StaticFilesHandler", + proto.MESSAGE, + number=2, + oneof="handler_type", + message="StaticFilesHandler", ) script = proto.Field( - proto.MESSAGE, number=3, oneof="handler_type", message="ScriptHandler", + proto.MESSAGE, + number=3, + oneof="handler_type", + message="ScriptHandler", ) api_endpoint = proto.Field( - proto.MESSAGE, number=4, oneof="handler_type", message="ApiEndpointHandler", + proto.MESSAGE, + number=4, + oneof="handler_type", + message="ApiEndpointHandler", + ) + security_level = proto.Field( + proto.ENUM, + number=5, + enum="SecurityLevel", + ) + login = proto.Field( + proto.ENUM, + number=6, + enum="LoginRequirement", + ) + auth_fail_action = proto.Field( + proto.ENUM, + number=7, + enum="AuthFailAction", ) - security_level = proto.Field(proto.ENUM, number=5, enum="SecurityLevel",) - login = proto.Field(proto.ENUM, number=6, enum="LoginRequirement",) - auth_fail_action = proto.Field(proto.ENUM, number=7, enum="AuthFailAction",) redirect_http_response_code = proto.Field( - proto.ENUM, number=8, enum=RedirectHttpResponseCode, + proto.ENUM, + number=8, + enum=RedirectHttpResponseCode, ) @@ -236,13 +290,36 @@ class StaticFilesHandler(proto.Message): resource quotas. """ - path = proto.Field(proto.STRING, number=1,) - upload_path_regex = proto.Field(proto.STRING, number=2,) - http_headers = proto.MapField(proto.STRING, proto.STRING, number=3,) - mime_type = proto.Field(proto.STRING, number=4,) - expiration = proto.Field(proto.MESSAGE, number=5, message=duration_pb2.Duration,) - require_matching_file = proto.Field(proto.BOOL, number=6,) - application_readable = proto.Field(proto.BOOL, number=7,) + path = proto.Field( + proto.STRING, + number=1, + ) + upload_path_regex = proto.Field( + proto.STRING, + number=2, + ) + http_headers = proto.MapField( + proto.STRING, + proto.STRING, + number=3, + ) + mime_type = proto.Field( + proto.STRING, + number=4, + ) + expiration = proto.Field( + proto.MESSAGE, + number=5, + message=duration_pb2.Duration, + ) + require_matching_file = proto.Field( + proto.BOOL, + number=6, + ) + application_readable = proto.Field( + proto.BOOL, + number=7, + ) class ScriptHandler(proto.Message): @@ -255,7 +332,10 @@ class ScriptHandler(proto.Message): directory. """ - script_path = proto.Field(proto.STRING, number=1,) + script_path = proto.Field( + proto.STRING, + number=1, + ) class ApiEndpointHandler(proto.Message): @@ -267,7 +347,10 @@ class ApiEndpointHandler(proto.Message): directory. """ - script_path = proto.Field(proto.STRING, number=1,) + script_path = proto.Field( + proto.STRING, + number=1, + ) class HealthCheck(proto.Message): @@ -298,15 +381,36 @@ class HealthCheck(proto.Message): failed. """ - disable_health_check = proto.Field(proto.BOOL, number=1,) - host = proto.Field(proto.STRING, number=2,) - healthy_threshold = proto.Field(proto.UINT32, number=3,) - unhealthy_threshold = proto.Field(proto.UINT32, number=4,) - restart_threshold = proto.Field(proto.UINT32, number=5,) + disable_health_check = proto.Field( + proto.BOOL, + number=1, + ) + host = proto.Field( + proto.STRING, + number=2, + ) + healthy_threshold = proto.Field( + proto.UINT32, + number=3, + ) + unhealthy_threshold = proto.Field( + proto.UINT32, + number=4, + ) + restart_threshold = proto.Field( + proto.UINT32, + number=5, + ) check_interval = proto.Field( - proto.MESSAGE, number=6, message=duration_pb2.Duration, + proto.MESSAGE, + number=6, + message=duration_pb2.Duration, + ) + timeout = proto.Field( + proto.MESSAGE, + number=7, + message=duration_pb2.Duration, ) - timeout = proto.Field(proto.MESSAGE, number=7, message=duration_pb2.Duration,) class ReadinessCheck(proto.Message): @@ -336,16 +440,36 @@ class ReadinessCheck(proto.Message): healthcheck until it is ready to serve traffic. """ - path = proto.Field(proto.STRING, number=1,) - host = proto.Field(proto.STRING, number=2,) - failure_threshold = proto.Field(proto.UINT32, number=3,) - success_threshold = proto.Field(proto.UINT32, number=4,) + path = proto.Field( + proto.STRING, + number=1, + ) + host = proto.Field( + proto.STRING, + number=2, + ) + failure_threshold = proto.Field( + proto.UINT32, + number=3, + ) + success_threshold = proto.Field( + proto.UINT32, + number=4, + ) check_interval = proto.Field( - proto.MESSAGE, number=5, message=duration_pb2.Duration, + proto.MESSAGE, + number=5, + message=duration_pb2.Duration, + ) + timeout = proto.Field( + proto.MESSAGE, + number=6, + message=duration_pb2.Duration, ) - timeout = proto.Field(proto.MESSAGE, number=6, message=duration_pb2.Duration,) app_start_timeout = proto.Field( - proto.MESSAGE, number=7, message=duration_pb2.Duration, + proto.MESSAGE, + number=7, + message=duration_pb2.Duration, ) @@ -374,15 +498,37 @@ class LivenessCheck(proto.Message): the checks. """ - path = proto.Field(proto.STRING, number=1,) - host = proto.Field(proto.STRING, number=2,) - failure_threshold = proto.Field(proto.UINT32, number=3,) - success_threshold = proto.Field(proto.UINT32, number=4,) + path = proto.Field( + proto.STRING, + number=1, + ) + host = proto.Field( + proto.STRING, + number=2, + ) + failure_threshold = proto.Field( + proto.UINT32, + number=3, + ) + success_threshold = proto.Field( + proto.UINT32, + number=4, + ) check_interval = proto.Field( - proto.MESSAGE, number=5, message=duration_pb2.Duration, + proto.MESSAGE, + number=5, + message=duration_pb2.Duration, + ) + timeout = proto.Field( + proto.MESSAGE, + number=6, + message=duration_pb2.Duration, + ) + initial_delay = proto.Field( + proto.MESSAGE, + number=7, + message=duration_pb2.Duration, ) - timeout = proto.Field(proto.MESSAGE, number=6, message=duration_pb2.Duration,) - initial_delay = proto.Field(proto.MESSAGE, number=7, message=duration_pb2.Duration,) class Library(proto.Message): @@ -397,8 +543,14 @@ class Library(proto.Message): "latest". """ - name = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + version = 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 index 1b67aaf..be12296 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -110,7 +110,10 @@ class GetApplicationRequest(proto.Message): ``apps/myapp``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateApplicationRequest(proto.Message): @@ -122,7 +125,9 @@ class CreateApplicationRequest(proto.Message): """ application = proto.Field( - proto.MESSAGE, number=2, message=ga_application.Application, + proto.MESSAGE, + number=2, + message=ga_application.Application, ) @@ -141,12 +146,19 @@ class UpdateApplicationRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) application = proto.Field( - proto.MESSAGE, number=2, message=ga_application.Application, + proto.MESSAGE, + number=2, + message=ga_application.Application, ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -158,7 +170,10 @@ class RepairApplicationRequest(proto.Message): Name of the application to repair. Example: ``apps/myapp`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListServicesRequest(proto.Message): @@ -175,9 +190,18 @@ class ListServicesRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListServicesResponse(proto.Message): @@ -196,8 +220,15 @@ class ListServicesResponse(proto.Message): def raw_page(self): return self - services = proto.RepeatedField(proto.MESSAGE, number=1, message=ga_service.Service,) - next_page_token = proto.Field(proto.STRING, number=2,) + services = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=ga_service.Service, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetServiceRequest(proto.Message): @@ -209,7 +240,10 @@ class GetServiceRequest(proto.Message): ``apps/myapp/services/default``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateServiceRequest(proto.Message): @@ -243,12 +277,24 @@ class UpdateServiceRequest(proto.Message): Traffic `__. """ - name = proto.Field(proto.STRING, number=1,) - service = proto.Field(proto.MESSAGE, number=2, message=ga_service.Service,) + name = proto.Field( + proto.STRING, + number=1, + ) + service = proto.Field( + proto.MESSAGE, + number=2, + message=ga_service.Service, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, + ) + migrate_traffic = proto.Field( + proto.BOOL, + number=4, ) - migrate_traffic = proto.Field(proto.BOOL, number=4,) class DeleteServiceRequest(proto.Message): @@ -260,7 +306,10 @@ class DeleteServiceRequest(proto.Message): ``apps/myapp/services/default``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListVersionsRequest(proto.Message): @@ -280,10 +329,23 @@ class ListVersionsRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum="VersionView",) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum="VersionView", + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListVersionsResponse(proto.Message): @@ -302,8 +364,15 @@ class ListVersionsResponse(proto.Message): def raw_page(self): return self - versions = proto.RepeatedField(proto.MESSAGE, number=1, message=ga_version.Version,) - next_page_token = proto.Field(proto.STRING, number=2,) + versions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=ga_version.Version, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetVersionRequest(proto.Message): @@ -317,8 +386,15 @@ class GetVersionRequest(proto.Message): Controls the set of fields returned in the ``Get`` response. """ - name = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum="VersionView",) + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum="VersionView", + ) class CreateVersionRequest(proto.Message): @@ -332,8 +408,15 @@ class CreateVersionRequest(proto.Message): Application deployment configuration. """ - parent = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.MESSAGE, number=2, message=ga_version.Version,) + parent = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.MESSAGE, + number=2, + message=ga_version.Version, + ) class UpdateVersionRequest(proto.Message): @@ -352,10 +435,19 @@ class UpdateVersionRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.MESSAGE, number=2, message=ga_version.Version,) + name = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.MESSAGE, + number=2, + message=ga_version.Version, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -368,7 +460,10 @@ class DeleteVersionRequest(proto.Message): ``apps/myapp/services/default/versions/v1``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListInstancesRequest(proto.Message): @@ -385,9 +480,18 @@ class ListInstancesRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListInstancesResponse(proto.Message): @@ -406,8 +510,15 @@ class ListInstancesResponse(proto.Message): def raw_page(self): return self - instances = proto.RepeatedField(proto.MESSAGE, number=1, message=instance.Instance,) - next_page_token = proto.Field(proto.STRING, number=2,) + instances = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=instance.Instance, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetInstanceRequest(proto.Message): @@ -419,7 +530,10 @@ class GetInstanceRequest(proto.Message): ``apps/myapp/services/default/versions/v1/instances/instance-1``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeleteInstanceRequest(proto.Message): @@ -431,7 +545,10 @@ class DeleteInstanceRequest(proto.Message): ``apps/myapp/services/default/versions/v1/instances/instance-1``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DebugInstanceRequest(proto.Message): @@ -451,8 +568,14 @@ class DebugInstanceRequest(proto.Message): Keys `__. """ - name = proto.Field(proto.STRING, number=1,) - ssh_key = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + ssh_key = proto.Field( + proto.STRING, + number=2, + ) class ListIngressRulesRequest(proto.Message): @@ -474,10 +597,22 @@ class ListIngressRulesRequest(proto.Message): on requests from this IP. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - matching_address = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + matching_address = proto.Field( + proto.STRING, + number=4, + ) class ListIngressRulesResponse(proto.Message): @@ -497,9 +632,14 @@ def raw_page(self): return self ingress_rules = proto.RepeatedField( - proto.MESSAGE, number=1, message=firewall.FirewallRule, + proto.MESSAGE, + number=1, + message=firewall.FirewallRule, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class BatchUpdateIngressRulesRequest(proto.Message): @@ -514,9 +654,14 @@ class BatchUpdateIngressRulesRequest(proto.Message): existing set. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) ingress_rules = proto.RepeatedField( - proto.MESSAGE, number=2, message=firewall.FirewallRule, + proto.MESSAGE, + number=2, + message=firewall.FirewallRule, ) @@ -530,7 +675,9 @@ class BatchUpdateIngressRulesResponse(proto.Message): """ ingress_rules = proto.RepeatedField( - proto.MESSAGE, number=1, message=firewall.FirewallRule, + proto.MESSAGE, + number=1, + message=firewall.FirewallRule, ) @@ -556,8 +703,15 @@ class CreateIngressRuleRequest(proto.Message): or deny-all rule. """ - parent = proto.Field(proto.STRING, number=1,) - rule = proto.Field(proto.MESSAGE, number=2, message=firewall.FirewallRule,) + parent = proto.Field( + proto.STRING, + number=1, + ) + rule = proto.Field( + proto.MESSAGE, + number=2, + message=firewall.FirewallRule, + ) class GetIngressRuleRequest(proto.Message): @@ -569,7 +723,10 @@ class GetIngressRuleRequest(proto.Message): ``apps/myapp/firewall/ingressRules/100``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateIngressRuleRequest(proto.Message): @@ -587,10 +744,19 @@ class UpdateIngressRuleRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1,) - rule = proto.Field(proto.MESSAGE, number=2, message=firewall.FirewallRule,) + name = proto.Field( + proto.STRING, + number=1, + ) + rule = proto.Field( + proto.MESSAGE, + number=2, + message=firewall.FirewallRule, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -603,7 +769,10 @@ class DeleteIngressRuleRequest(proto.Message): ``apps/myapp/firewall/ingressRules/100``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListAuthorizedDomainsRequest(proto.Message): @@ -620,9 +789,18 @@ class ListAuthorizedDomainsRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAuthorizedDomainsResponse(proto.Message): @@ -641,9 +819,14 @@ def raw_page(self): return self domains = proto.RepeatedField( - proto.MESSAGE, number=1, message=domain.AuthorizedDomain, + proto.MESSAGE, + number=1, + message=domain.AuthorizedDomain, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class ListAuthorizedCertificatesRequest(proto.Message): @@ -664,10 +847,23 @@ class ListAuthorizedCertificatesRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=4, enum="AuthorizedCertificateView",) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum="AuthorizedCertificateView", + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAuthorizedCertificatesResponse(proto.Message): @@ -688,9 +884,14 @@ def raw_page(self): return self certificates = proto.RepeatedField( - proto.MESSAGE, number=1, message=ga_certificate.AuthorizedCertificate, + proto.MESSAGE, + number=1, + message=ga_certificate.AuthorizedCertificate, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetAuthorizedCertificateRequest(proto.Message): @@ -705,8 +906,15 @@ class GetAuthorizedCertificateRequest(proto.Message): Controls the set of fields returned in the ``GET`` response. """ - name = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum="AuthorizedCertificateView",) + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum="AuthorizedCertificateView", + ) class CreateAuthorizedCertificateRequest(proto.Message): @@ -721,9 +929,14 @@ class CreateAuthorizedCertificateRequest(proto.Message): SSL certificate data. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) certificate = proto.Field( - proto.MESSAGE, number=2, message=ga_certificate.AuthorizedCertificate, + proto.MESSAGE, + number=2, + message=ga_certificate.AuthorizedCertificate, ) @@ -744,12 +957,19 @@ class UpdateAuthorizedCertificateRequest(proto.Message): and ``display_name`` fields. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) certificate = proto.Field( - proto.MESSAGE, number=2, message=ga_certificate.AuthorizedCertificate, + proto.MESSAGE, + number=2, + message=ga_certificate.AuthorizedCertificate, ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -763,7 +983,10 @@ class DeleteAuthorizedCertificateRequest(proto.Message): ``apps/myapp/authorizedCertificates/12345``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListDomainMappingsRequest(proto.Message): @@ -780,9 +1003,18 @@ class ListDomainMappingsRequest(proto.Message): of results. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListDomainMappingsResponse(proto.Message): @@ -801,9 +1033,14 @@ def raw_page(self): return self domain_mappings = proto.RepeatedField( - proto.MESSAGE, number=1, message=ga_domain_mapping.DomainMapping, + proto.MESSAGE, + number=1, + message=ga_domain_mapping.DomainMapping, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetDomainMappingRequest(proto.Message): @@ -815,7 +1052,10 @@ class GetDomainMappingRequest(proto.Message): ``apps/myapp/domainMappings/example.com``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateDomainMappingRequest(proto.Message): @@ -833,12 +1073,19 @@ class CreateDomainMappingRequest(proto.Message): default, overrides are rejected. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) domain_mapping = proto.Field( - proto.MESSAGE, number=2, message=ga_domain_mapping.DomainMapping, + proto.MESSAGE, + number=2, + message=ga_domain_mapping.DomainMapping, ) override_strategy = proto.Field( - proto.ENUM, number=4, enum="DomainOverrideStrategy", + proto.ENUM, + number=4, + enum="DomainOverrideStrategy", ) @@ -858,12 +1105,19 @@ class UpdateDomainMappingRequest(proto.Message): be updated. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) domain_mapping = proto.Field( - proto.MESSAGE, number=2, message=ga_domain_mapping.DomainMapping, + proto.MESSAGE, + number=2, + message=ga_domain_mapping.DomainMapping, ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -876,7 +1130,10 @@ class DeleteDomainMappingRequest(proto.Message): ``apps/myapp/domainMappings/example.com``. """ - name = proto.Field(proto.STRING, number=1,) + name = 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 index c8a00f3..263562d 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -19,7 +19,11 @@ __protobuf__ = proto.module( - package="google.appengine.v1", manifest={"Application", "UrlDispatchRule",}, + package="google.appengine.v1", + manifest={ + "Application", + "UrlDispatchRule", + }, ) @@ -135,10 +139,22 @@ class IdentityAwareProxy(proto.Message): @OutputOnly """ - enabled = proto.Field(proto.BOOL, number=1,) - oauth2_client_id = proto.Field(proto.STRING, number=2,) - oauth2_client_secret = proto.Field(proto.STRING, number=3,) - oauth2_client_secret_sha256 = proto.Field(proto.STRING, number=4,) + enabled = proto.Field( + proto.BOOL, + number=1, + ) + oauth2_client_id = proto.Field( + proto.STRING, + number=2, + ) + oauth2_client_secret = proto.Field( + proto.STRING, + number=3, + ) + oauth2_client_secret_sha256 = proto.Field( + proto.STRING, + number=4, + ) class FeatureSettings(proto.Message): r"""The feature specific settings to be used in the application. @@ -158,27 +174,77 @@ class FeatureSettings(proto.Message): base image for VMs, rather than a base Debian image. """ - split_health_checks = proto.Field(proto.BOOL, number=1,) - use_container_optimized_os = proto.Field(proto.BOOL, number=2,) + split_health_checks = proto.Field( + proto.BOOL, + number=1, + ) + use_container_optimized_os = proto.Field( + proto.BOOL, + number=2, + ) - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) dispatch_rules = proto.RepeatedField( - proto.MESSAGE, number=3, message="UrlDispatchRule", + proto.MESSAGE, + number=3, + message="UrlDispatchRule", + ) + auth_domain = proto.Field( + proto.STRING, + number=6, + ) + location_id = proto.Field( + proto.STRING, + number=7, + ) + code_bucket = proto.Field( + proto.STRING, + number=8, ) - auth_domain = proto.Field(proto.STRING, number=6,) - location_id = proto.Field(proto.STRING, number=7,) - code_bucket = proto.Field(proto.STRING, number=8,) default_cookie_expiration = proto.Field( - proto.MESSAGE, number=9, message=duration_pb2.Duration, + proto.MESSAGE, + number=9, + message=duration_pb2.Duration, + ) + serving_status = proto.Field( + proto.ENUM, + number=10, + enum=ServingStatus, + ) + default_hostname = proto.Field( + proto.STRING, + number=11, + ) + default_bucket = proto.Field( + proto.STRING, + number=12, + ) + iap = proto.Field( + proto.MESSAGE, + number=14, + message=IdentityAwareProxy, + ) + gcr_domain = proto.Field( + proto.STRING, + number=16, + ) + database_type = proto.Field( + proto.ENUM, + number=17, + enum=DatabaseType, + ) + feature_settings = proto.Field( + proto.MESSAGE, + number=18, + message=FeatureSettings, ) - serving_status = proto.Field(proto.ENUM, number=10, enum=ServingStatus,) - default_hostname = proto.Field(proto.STRING, number=11,) - default_bucket = proto.Field(proto.STRING, number=12,) - iap = proto.Field(proto.MESSAGE, number=14, message=IdentityAwareProxy,) - gcr_domain = proto.Field(proto.STRING, number=16,) - database_type = proto.Field(proto.ENUM, number=17, enum=DatabaseType,) - feature_settings = proto.Field(proto.MESSAGE, number=18, message=FeatureSettings,) class UrlDispatchRule(proto.Message): @@ -203,9 +269,18 @@ class UrlDispatchRule(proto.Message): Example: ``default``. """ - domain = proto.Field(proto.STRING, number=1,) - path = proto.Field(proto.STRING, number=2,) - service = proto.Field(proto.STRING, number=3,) + domain = proto.Field( + proto.STRING, + number=1, + ) + path = proto.Field( + proto.STRING, + number=2, + ) + service = 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 index c511e4f..69de0cf 100644 --- a/google/cloud/appengine_admin_v1/types/audit_data.py +++ b/google/cloud/appengine_admin_v1/types/audit_data.py @@ -20,7 +20,11 @@ __protobuf__ = proto.module( package="google.appengine.v1", - manifest={"AuditData", "UpdateServiceMethod", "CreateVersionMethod",}, + manifest={ + "AuditData", + "UpdateServiceMethod", + "CreateVersionMethod", + }, ) @@ -48,10 +52,16 @@ class AuditData(proto.Message): """ update_service = proto.Field( - proto.MESSAGE, number=1, oneof="method", message="UpdateServiceMethod", + proto.MESSAGE, + number=1, + oneof="method", + message="UpdateServiceMethod", ) create_version = proto.Field( - proto.MESSAGE, number=2, oneof="method", message="CreateVersionMethod", + proto.MESSAGE, + number=2, + oneof="method", + message="CreateVersionMethod", ) @@ -64,7 +74,9 @@ class UpdateServiceMethod(proto.Message): """ request = proto.Field( - proto.MESSAGE, number=1, message=appengine.UpdateServiceRequest, + proto.MESSAGE, + number=1, + message=appengine.UpdateServiceRequest, ) @@ -77,7 +89,9 @@ class CreateVersionMethod(proto.Message): """ request = proto.Field( - proto.MESSAGE, number=1, message=appengine.CreateVersionRequest, + 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 cce73e9..5288637 100644 --- a/google/cloud/appengine_admin_v1/types/certificate.py +++ b/google/cloud/appengine_admin_v1/types/certificate.py @@ -114,19 +114,45 @@ class AuthorizedCertificate(proto.Message): @OutputOnly """ - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) - display_name = proto.Field(proto.STRING, number=3,) - domain_names = proto.RepeatedField(proto.STRING, number=4,) - expire_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) + display_name = proto.Field( + proto.STRING, + number=3, + ) + domain_names = proto.RepeatedField( + proto.STRING, + number=4, + ) + expire_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) certificate_raw_data = proto.Field( - proto.MESSAGE, number=6, message="CertificateRawData", + proto.MESSAGE, + number=6, + message="CertificateRawData", ) managed_certificate = proto.Field( - proto.MESSAGE, number=7, message="ManagedCertificate", + proto.MESSAGE, + number=7, + message="ManagedCertificate", + ) + visible_domain_mappings = proto.RepeatedField( + proto.STRING, + number=8, + ) + domain_mappings_count = proto.Field( + proto.INT32, + number=9, ) - visible_domain_mappings = proto.RepeatedField(proto.STRING, number=8,) - domain_mappings_count = proto.Field(proto.INT32, number=9,) class CertificateRawData(proto.Message): @@ -162,8 +188,14 @@ class CertificateRawData(proto.Message): @InputOnly """ - public_certificate = proto.Field(proto.STRING, number=1,) - private_key = proto.Field(proto.STRING, number=2,) + public_certificate = proto.Field( + proto.STRING, + number=1, + ) + private_key = proto.Field( + proto.STRING, + number=2, + ) class ManagedCertificate(proto.Message): @@ -185,9 +217,15 @@ class ManagedCertificate(proto.Message): """ last_renewal_time = proto.Field( - proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + status = proto.Field( + proto.ENUM, + number=2, + enum="ManagementStatus", ) - status = 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 index 5faf790..e195347 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -56,11 +56,26 @@ class Deployment(proto.Message): Engine flexible environment using files or zip. """ - files = proto.MapField(proto.STRING, proto.MESSAGE, number=1, message="FileInfo",) - container = proto.Field(proto.MESSAGE, number=2, message="ContainerInfo",) - zip_ = proto.Field(proto.MESSAGE, number=3, message="ZipInfo",) + files = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=1, + message="FileInfo", + ) + container = proto.Field( + proto.MESSAGE, + number=2, + message="ContainerInfo", + ) + zip_ = proto.Field( + proto.MESSAGE, + number=3, + message="ZipInfo", + ) cloud_build_options = proto.Field( - proto.MESSAGE, number=6, message="CloudBuildOptions", + proto.MESSAGE, + number=6, + message="CloudBuildOptions", ) @@ -82,9 +97,18 @@ class FileInfo(proto.Message): Defaults to the value from Google Cloud Storage. """ - source_url = proto.Field(proto.STRING, number=1,) - sha1_sum = proto.Field(proto.STRING, number=2,) - mime_type = proto.Field(proto.STRING, number=3,) + source_url = proto.Field( + proto.STRING, + number=1, + ) + sha1_sum = proto.Field( + proto.STRING, + number=2, + ) + mime_type = proto.Field( + proto.STRING, + number=3, + ) class ContainerInfo(proto.Message): @@ -101,7 +125,10 @@ class ContainerInfo(proto.Message): "gcr.io/my-project/image@digest". """ - image = proto.Field(proto.STRING, number=1,) + image = proto.Field( + proto.STRING, + number=1, + ) class CloudBuildOptions(proto.Message): @@ -124,9 +151,14 @@ class CloudBuildOptions(proto.Message): Defaults to 10 minutes. """ - app_yaml_path = proto.Field(proto.STRING, number=1,) + app_yaml_path = proto.Field( + proto.STRING, + number=1, + ) cloud_build_timeout = proto.Field( - proto.MESSAGE, number=2, message=duration_pb2.Duration, + proto.MESSAGE, + number=2, + message=duration_pb2.Duration, ) @@ -147,8 +179,14 @@ class ZipInfo(proto.Message): provided, deployment may be slow. """ - source_url = proto.Field(proto.STRING, number=3,) - files_count = proto.Field(proto.INT32, number=4,) + source_url = proto.Field( + proto.STRING, + number=3, + ) + files_count = 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 index 06128b6..e127548 100644 --- a/google/cloud/appengine_admin_v1/types/deployed_files.py +++ b/google/cloud/appengine_admin_v1/types/deployed_files.py @@ -15,7 +15,10 @@ # -__protobuf__ = proto.module(package="google.appengine.v1", manifest={},) +__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 index e8a38de..92c3b53 100644 --- a/google/cloud/appengine_admin_v1/types/domain.py +++ b/google/cloud/appengine_admin_v1/types/domain.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.appengine.v1", manifest={"AuthorizedDomain",}, + package="google.appengine.v1", + manifest={ + "AuthorizedDomain", + }, ) @@ -37,8 +40,14 @@ class AuthorizedDomain(proto.Message): use. Example: ``example.com``. """ - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + id = 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 index c94e986..ba055ab 100644 --- a/google/cloud/appengine_admin_v1/types/domain_mapping.py +++ b/google/cloud/appengine_admin_v1/types/domain_mapping.py @@ -18,7 +18,11 @@ __protobuf__ = proto.module( package="google.appengine.v1", - manifest={"DomainMapping", "SslSettings", "ResourceRecord",}, + manifest={ + "DomainMapping", + "SslSettings", + "ResourceRecord", + }, ) @@ -46,11 +50,23 @@ class DomainMapping(proto.Message): @OutputOnly """ - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) - ssl_settings = proto.Field(proto.MESSAGE, number=3, message="SslSettings",) + name = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) + ssl_settings = proto.Field( + proto.MESSAGE, + number=3, + message="SslSettings", + ) resource_records = proto.RepeatedField( - proto.MESSAGE, number=4, message="ResourceRecord", + proto.MESSAGE, + number=4, + message="ResourceRecord", ) @@ -95,9 +111,19 @@ class SslManagementType(proto.Enum): AUTOMATIC = 1 MANUAL = 2 - certificate_id = proto.Field(proto.STRING, number=1,) - ssl_management_type = proto.Field(proto.ENUM, number=3, enum=SslManagementType,) - pending_managed_certificate_id = proto.Field(proto.STRING, number=4,) + certificate_id = proto.Field( + proto.STRING, + number=1, + ) + ssl_management_type = proto.Field( + proto.ENUM, + number=3, + enum=SslManagementType, + ) + pending_managed_certificate_id = proto.Field( + proto.STRING, + number=4, + ) class ResourceRecord(proto.Message): @@ -122,9 +148,19 @@ class RecordType(proto.Enum): AAAA = 2 CNAME = 3 - name = proto.Field(proto.STRING, number=1,) - rrdata = proto.Field(proto.STRING, number=2,) - type_ = proto.Field(proto.ENUM, number=3, enum=RecordType,) + name = proto.Field( + proto.STRING, + number=1, + ) + rrdata = proto.Field( + proto.STRING, + number=2, + ) + type_ = 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 index 9c053fc..4c35c94 100644 --- a/google/cloud/appengine_admin_v1/types/firewall.py +++ b/google/cloud/appengine_admin_v1/types/firewall.py @@ -16,7 +16,12 @@ import proto # type: ignore -__protobuf__ = proto.module(package="google.appengine.v1", manifest={"FirewallRule",},) +__protobuf__ = proto.module( + package="google.appengine.v1", + manifest={ + "FirewallRule", + }, +) class FirewallRule(proto.Message): @@ -60,10 +65,23 @@ class Action(proto.Enum): ALLOW = 1 DENY = 2 - priority = proto.Field(proto.INT32, number=1,) - action = proto.Field(proto.ENUM, number=2, enum=Action,) - source_range = proto.Field(proto.STRING, number=3,) - description = proto.Field(proto.STRING, number=4,) + priority = proto.Field( + proto.INT32, + number=1, + ) + action = proto.Field( + proto.ENUM, + number=2, + enum=Action, + ) + source_range = proto.Field( + proto.STRING, + number=3, + ) + description = 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 index c34449a..29ec859 100644 --- a/google/cloud/appengine_admin_v1/types/instance.py +++ b/google/cloud/appengine_admin_v1/types/instance.py @@ -18,7 +18,12 @@ from google.protobuf import timestamp_pb2 # type: ignore -__protobuf__ = proto.module(package="google.appengine.v1", manifest={"Instance",},) +__protobuf__ = proto.module( + package="google.appengine.v1", + manifest={ + "Instance", + }, +) class Instance(proto.Message): @@ -93,8 +98,7 @@ class Availability(proto.Enum): DYNAMIC = 2 class Liveness(proto.Message): - r"""Wrapper for LivenessState enum. - """ + r"""Wrapper for LivenessState enum.""" class LivenessState(proto.Enum): r"""Liveness health check status for Flex instances.""" @@ -105,23 +109,77 @@ class LivenessState(proto.Enum): DRAINING = 4 TIMEOUT = 5 - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) - app_engine_release = proto.Field(proto.STRING, number=3,) - availability = proto.Field(proto.ENUM, number=4, enum=Availability,) - vm_name = proto.Field(proto.STRING, number=5,) - vm_zone_name = proto.Field(proto.STRING, number=6,) - vm_id = proto.Field(proto.STRING, number=7,) - start_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) - requests = proto.Field(proto.INT32, number=9,) - errors = proto.Field(proto.INT32, number=10,) - qps = proto.Field(proto.FLOAT, number=11,) - average_latency = proto.Field(proto.INT32, number=12,) - memory_usage = proto.Field(proto.INT64, number=13,) - vm_status = proto.Field(proto.STRING, number=14,) - vm_debug_enabled = proto.Field(proto.BOOL, number=15,) - vm_ip = proto.Field(proto.STRING, number=16,) - vm_liveness = proto.Field(proto.ENUM, number=17, enum=Liveness.LivenessState,) + name = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) + app_engine_release = proto.Field( + proto.STRING, + number=3, + ) + availability = proto.Field( + proto.ENUM, + number=4, + enum=Availability, + ) + vm_name = proto.Field( + proto.STRING, + number=5, + ) + vm_zone_name = proto.Field( + proto.STRING, + number=6, + ) + vm_id = proto.Field( + proto.STRING, + number=7, + ) + start_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + requests = proto.Field( + proto.INT32, + number=9, + ) + errors = proto.Field( + proto.INT32, + number=10, + ) + qps = proto.Field( + proto.FLOAT, + number=11, + ) + average_latency = proto.Field( + proto.INT32, + number=12, + ) + memory_usage = proto.Field( + proto.INT64, + number=13, + ) + vm_status = proto.Field( + proto.STRING, + number=14, + ) + vm_debug_enabled = proto.Field( + proto.BOOL, + number=15, + ) + vm_ip = proto.Field( + proto.STRING, + number=16, + ) + vm_liveness = 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 index 380bc37..2d333a6 100644 --- a/google/cloud/appengine_admin_v1/types/location.py +++ b/google/cloud/appengine_admin_v1/types/location.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.appengine.v1", manifest={"LocationMetadata",}, + package="google.appengine.v1", + manifest={ + "LocationMetadata", + }, ) @@ -40,9 +43,18 @@ class LocationMetadata(proto.Message): is available in the given location. """ - standard_environment_available = proto.Field(proto.BOOL, number=2,) - flexible_environment_available = proto.Field(proto.BOOL, number=4,) - search_api_available = proto.Field(proto.BOOL, number=6,) + standard_environment_available = proto.Field( + proto.BOOL, + number=2, + ) + flexible_environment_available = proto.Field( + proto.BOOL, + number=4, + ) + search_api_available = 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 index f47b470..f931b83 100644 --- a/google/cloud/appengine_admin_v1/types/network_settings.py +++ b/google/cloud/appengine_admin_v1/types/network_settings.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.appengine.v1", manifest={"NetworkSettings",}, + package="google.appengine.v1", + manifest={ + "NetworkSettings", + }, ) @@ -38,7 +41,9 @@ class IngressTrafficAllowed(proto.Enum): INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB = 3 ingress_traffic_allowed = proto.Field( - proto.ENUM, number=1, enum=IngressTrafficAllowed, + 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 d373c7b..873d2f5 100644 --- a/google/cloud/appengine_admin_v1/types/operation.py +++ b/google/cloud/appengine_admin_v1/types/operation.py @@ -20,7 +20,10 @@ __protobuf__ = proto.module( package="google.appengine.v1", - manifest={"OperationMetadataV1", "CreateVersionMetadataV1",}, + manifest={ + "OperationMetadataV1", + "CreateVersionMetadataV1", + }, ) @@ -62,13 +65,36 @@ class OperationMetadataV1(proto.Message): This field is a member of `oneof`_ ``method_metadata``. """ - method = proto.Field(proto.STRING, number=1,) - insert_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - user = proto.Field(proto.STRING, number=4,) - target = proto.Field(proto.STRING, number=5,) - ephemeral_message = proto.Field(proto.STRING, number=6,) - warning = proto.RepeatedField(proto.STRING, number=7,) + method = proto.Field( + proto.STRING, + number=1, + ) + insert_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + user = proto.Field( + proto.STRING, + number=4, + ) + target = proto.Field( + proto.STRING, + number=5, + ) + ephemeral_message = proto.Field( + proto.STRING, + number=6, + ) + warning = proto.RepeatedField( + proto.STRING, + number=7, + ) create_version_metadata = proto.Field( proto.MESSAGE, number=8, @@ -89,7 +115,10 @@ class CreateVersionMetadataV1(proto.Message): of the version create. @OutputOnly """ - cloud_build_id = proto.Field(proto.STRING, number=1,) + cloud_build_id = 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 index a124123..0b273ac 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -21,7 +21,11 @@ __protobuf__ = proto.module( - package="google.appengine.v1", manifest={"Service", "TrafficSplit",}, + package="google.appengine.v1", + manifest={ + "Service", + "TrafficSplit", + }, ) @@ -55,11 +59,23 @@ class Service(proto.Message): to all versions. """ - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) - split = proto.Field(proto.MESSAGE, number=3, message="TrafficSplit",) + name = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) + split = proto.Field( + proto.MESSAGE, + number=3, + message="TrafficSplit", + ) network_settings = proto.Field( - proto.MESSAGE, number=6, message=ga_network_settings.NetworkSettings, + proto.MESSAGE, + number=6, + message=ga_network_settings.NetworkSettings, ) @@ -93,8 +109,16 @@ class ShardBy(proto.Enum): IP = 2 RANDOM = 3 - shard_by = proto.Field(proto.ENUM, number=1, enum=ShardBy,) - allocations = proto.MapField(proto.STRING, proto.DOUBLE, number=2,) + shard_by = proto.Field( + proto.ENUM, + number=1, + enum=ShardBy, + ) + allocations = 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 index 1c3b4b8..19070f1 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -265,70 +265,187 @@ class Version(proto.Message): Enables VPC connectivity for standard apps. """ - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) automatic_scaling = proto.Field( - proto.MESSAGE, number=3, oneof="scaling", message="AutomaticScaling", + proto.MESSAGE, + number=3, + oneof="scaling", + message="AutomaticScaling", ) basic_scaling = proto.Field( - proto.MESSAGE, number=4, oneof="scaling", message="BasicScaling", + proto.MESSAGE, + number=4, + oneof="scaling", + message="BasicScaling", ) manual_scaling = proto.Field( - proto.MESSAGE, number=5, oneof="scaling", message="ManualScaling", + proto.MESSAGE, + number=5, + oneof="scaling", + message="ManualScaling", ) inbound_services = proto.RepeatedField( - proto.ENUM, number=6, enum="InboundServiceType", - ) - instance_class = proto.Field(proto.STRING, number=7,) - network = proto.Field(proto.MESSAGE, number=8, message="Network",) - zones = proto.RepeatedField(proto.STRING, number=118,) - resources = proto.Field(proto.MESSAGE, number=9, message="Resources",) - runtime = proto.Field(proto.STRING, number=10,) - runtime_channel = proto.Field(proto.STRING, number=117,) - threadsafe = proto.Field(proto.BOOL, number=11,) - vm = proto.Field(proto.BOOL, number=12,) - beta_settings = proto.MapField(proto.STRING, proto.STRING, number=13,) - env = proto.Field(proto.STRING, number=14,) - serving_status = proto.Field(proto.ENUM, number=15, enum="ServingStatus",) - created_by = proto.Field(proto.STRING, number=16,) + proto.ENUM, + number=6, + enum="InboundServiceType", + ) + instance_class = proto.Field( + proto.STRING, + number=7, + ) + network = proto.Field( + proto.MESSAGE, + number=8, + message="Network", + ) + zones = proto.RepeatedField( + proto.STRING, + number=118, + ) + resources = proto.Field( + proto.MESSAGE, + number=9, + message="Resources", + ) + runtime = proto.Field( + proto.STRING, + number=10, + ) + runtime_channel = proto.Field( + proto.STRING, + number=117, + ) + threadsafe = proto.Field( + proto.BOOL, + number=11, + ) + vm = proto.Field( + proto.BOOL, + number=12, + ) + beta_settings = proto.MapField( + proto.STRING, + proto.STRING, + number=13, + ) + env = proto.Field( + proto.STRING, + number=14, + ) + serving_status = proto.Field( + proto.ENUM, + number=15, + enum="ServingStatus", + ) + created_by = proto.Field( + proto.STRING, + number=16, + ) create_time = proto.Field( - proto.MESSAGE, number=17, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=17, + message=timestamp_pb2.Timestamp, + ) + disk_usage_bytes = proto.Field( + proto.INT64, + number=18, + ) + runtime_api_version = proto.Field( + proto.STRING, + number=21, + ) + runtime_main_executable_path = proto.Field( + proto.STRING, + number=22, + ) + service_account = proto.Field( + proto.STRING, + number=127, + ) + handlers = proto.RepeatedField( + proto.MESSAGE, + number=100, + message=app_yaml.UrlMap, ) - disk_usage_bytes = proto.Field(proto.INT64, number=18,) - runtime_api_version = proto.Field(proto.STRING, number=21,) - runtime_main_executable_path = proto.Field(proto.STRING, number=22,) - service_account = proto.Field(proto.STRING, number=127,) - handlers = proto.RepeatedField(proto.MESSAGE, number=100, message=app_yaml.UrlMap,) error_handlers = proto.RepeatedField( - proto.MESSAGE, number=101, message=app_yaml.ErrorHandler, + proto.MESSAGE, + number=101, + message=app_yaml.ErrorHandler, ) libraries = proto.RepeatedField( - proto.MESSAGE, number=102, message=app_yaml.Library, + proto.MESSAGE, + number=102, + message=app_yaml.Library, ) api_config = proto.Field( - proto.MESSAGE, number=103, message=app_yaml.ApiConfigHandler, + proto.MESSAGE, + number=103, + message=app_yaml.ApiConfigHandler, + ) + env_variables = proto.MapField( + proto.STRING, + proto.STRING, + number=104, + ) + build_env_variables = proto.MapField( + proto.STRING, + proto.STRING, + number=125, ) - env_variables = proto.MapField(proto.STRING, proto.STRING, number=104,) - build_env_variables = proto.MapField(proto.STRING, proto.STRING, number=125,) default_expiration = proto.Field( - proto.MESSAGE, number=105, message=duration_pb2.Duration, + proto.MESSAGE, + number=105, + message=duration_pb2.Duration, + ) + health_check = proto.Field( + proto.MESSAGE, + number=106, + message=app_yaml.HealthCheck, ) - health_check = proto.Field(proto.MESSAGE, number=106, message=app_yaml.HealthCheck,) readiness_check = proto.Field( - proto.MESSAGE, number=112, message=app_yaml.ReadinessCheck, + proto.MESSAGE, + number=112, + message=app_yaml.ReadinessCheck, ) liveness_check = proto.Field( - proto.MESSAGE, number=113, message=app_yaml.LivenessCheck, + proto.MESSAGE, + number=113, + message=app_yaml.LivenessCheck, + ) + nobuild_files_regex = proto.Field( + proto.STRING, + number=107, + ) + deployment = proto.Field( + proto.MESSAGE, + number=108, + message=deploy.Deployment, + ) + version_url = proto.Field( + proto.STRING, + number=109, ) - nobuild_files_regex = proto.Field(proto.STRING, number=107,) - deployment = proto.Field(proto.MESSAGE, number=108, message=deploy.Deployment,) - version_url = proto.Field(proto.STRING, number=109,) endpoints_api_service = proto.Field( - proto.MESSAGE, number=110, message="EndpointsApiService", + proto.MESSAGE, + number=110, + message="EndpointsApiService", + ) + entrypoint = proto.Field( + proto.MESSAGE, + number=122, + message="Entrypoint", ) - entrypoint = proto.Field(proto.MESSAGE, number=122, message="Entrypoint",) vpc_access_connector = proto.Field( - proto.MESSAGE, number=121, message="VpcAccessConnector", + proto.MESSAGE, + number=121, + message="VpcAccessConnector", ) @@ -378,10 +495,23 @@ class RolloutStrategy(proto.Enum): FIXED = 1 MANAGED = 2 - name = proto.Field(proto.STRING, number=1,) - config_id = proto.Field(proto.STRING, number=2,) - rollout_strategy = proto.Field(proto.ENUM, number=3, enum=RolloutStrategy,) - disable_trace_sampling = proto.Field(proto.BOOL, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + config_id = proto.Field( + proto.STRING, + number=2, + ) + rollout_strategy = proto.Field( + proto.ENUM, + number=3, + enum=RolloutStrategy, + ) + disable_trace_sampling = proto.Field( + proto.BOOL, + number=4, + ) class AutomaticScaling(proto.Message): @@ -436,29 +566,64 @@ class AutomaticScaling(proto.Message): """ cool_down_period = proto.Field( - proto.MESSAGE, number=1, message=duration_pb2.Duration, + proto.MESSAGE, + number=1, + message=duration_pb2.Duration, + ) + cpu_utilization = proto.Field( + proto.MESSAGE, + number=2, + message="CpuUtilization", + ) + max_concurrent_requests = proto.Field( + proto.INT32, + number=3, + ) + max_idle_instances = proto.Field( + proto.INT32, + number=4, + ) + max_total_instances = proto.Field( + proto.INT32, + number=5, ) - cpu_utilization = proto.Field(proto.MESSAGE, number=2, message="CpuUtilization",) - max_concurrent_requests = proto.Field(proto.INT32, number=3,) - max_idle_instances = proto.Field(proto.INT32, number=4,) - max_total_instances = proto.Field(proto.INT32, number=5,) max_pending_latency = proto.Field( - proto.MESSAGE, number=6, message=duration_pb2.Duration, + proto.MESSAGE, + number=6, + message=duration_pb2.Duration, + ) + min_idle_instances = proto.Field( + proto.INT32, + number=7, + ) + min_total_instances = proto.Field( + proto.INT32, + number=8, ) - min_idle_instances = proto.Field(proto.INT32, number=7,) - min_total_instances = proto.Field(proto.INT32, number=8,) min_pending_latency = proto.Field( - proto.MESSAGE, number=9, message=duration_pb2.Duration, + proto.MESSAGE, + number=9, + message=duration_pb2.Duration, ) request_utilization = proto.Field( - proto.MESSAGE, number=10, message="RequestUtilization", + proto.MESSAGE, + number=10, + message="RequestUtilization", + ) + disk_utilization = proto.Field( + proto.MESSAGE, + number=11, + message="DiskUtilization", ) - disk_utilization = proto.Field(proto.MESSAGE, number=11, message="DiskUtilization",) network_utilization = proto.Field( - proto.MESSAGE, number=12, message="NetworkUtilization", + proto.MESSAGE, + number=12, + message="NetworkUtilization", ) standard_scheduler_settings = proto.Field( - proto.MESSAGE, number=20, message="StandardSchedulerSettings", + proto.MESSAGE, + number=20, + message="StandardSchedulerSettings", ) @@ -478,8 +643,15 @@ class BasicScaling(proto.Message): this version. """ - idle_timeout = proto.Field(proto.MESSAGE, number=1, message=duration_pb2.Duration,) - max_instances = proto.Field(proto.INT32, number=2,) + idle_timeout = proto.Field( + proto.MESSAGE, + number=1, + message=duration_pb2.Duration, + ) + max_instances = proto.Field( + proto.INT32, + number=2, + ) class ManualScaling(proto.Message): @@ -495,7 +667,10 @@ class ManualScaling(proto.Message): ``set_num_instances()`` function. """ - instances = proto.Field(proto.INT32, number=1,) + instances = proto.Field( + proto.INT32, + number=1, + ) class CpuUtilization(proto.Message): @@ -511,9 +686,14 @@ class CpuUtilization(proto.Message): """ aggregation_window_length = proto.Field( - proto.MESSAGE, number=1, message=duration_pb2.Duration, + proto.MESSAGE, + number=1, + message=duration_pb2.Duration, + ) + target_utilization = proto.Field( + proto.DOUBLE, + number=2, ) - target_utilization = proto.Field(proto.DOUBLE, number=2,) class RequestUtilization(proto.Message): @@ -527,8 +707,14 @@ class RequestUtilization(proto.Message): Target number of concurrent requests. """ - target_request_count_per_second = proto.Field(proto.INT32, number=1,) - target_concurrent_requests = proto.Field(proto.INT32, number=2,) + target_request_count_per_second = proto.Field( + proto.INT32, + number=1, + ) + target_concurrent_requests = proto.Field( + proto.INT32, + number=2, + ) class DiskUtilization(proto.Message): @@ -546,10 +732,22 @@ class DiskUtilization(proto.Message): Target ops read per seconds. """ - target_write_bytes_per_second = proto.Field(proto.INT32, number=14,) - target_write_ops_per_second = proto.Field(proto.INT32, number=15,) - target_read_bytes_per_second = proto.Field(proto.INT32, number=16,) - target_read_ops_per_second = proto.Field(proto.INT32, number=17,) + target_write_bytes_per_second = proto.Field( + proto.INT32, + number=14, + ) + target_write_ops_per_second = proto.Field( + proto.INT32, + number=15, + ) + target_read_bytes_per_second = proto.Field( + proto.INT32, + number=16, + ) + target_read_ops_per_second = proto.Field( + proto.INT32, + number=17, + ) class NetworkUtilization(proto.Message): @@ -567,10 +765,22 @@ class NetworkUtilization(proto.Message): Target packets received per second. """ - target_sent_bytes_per_second = proto.Field(proto.INT32, number=1,) - target_sent_packets_per_second = proto.Field(proto.INT32, number=11,) - target_received_bytes_per_second = proto.Field(proto.INT32, number=12,) - target_received_packets_per_second = proto.Field(proto.INT32, number=13,) + target_sent_bytes_per_second = proto.Field( + proto.INT32, + number=1, + ) + target_sent_packets_per_second = proto.Field( + proto.INT32, + number=11, + ) + target_received_bytes_per_second = proto.Field( + proto.INT32, + number=12, + ) + target_received_packets_per_second = proto.Field( + proto.INT32, + number=13, + ) class StandardSchedulerSettings(proto.Message): @@ -591,10 +801,22 @@ class StandardSchedulerSettings(proto.Message): zero to disable ``max_instances`` configuration. """ - target_cpu_utilization = proto.Field(proto.DOUBLE, number=1,) - target_throughput_utilization = proto.Field(proto.DOUBLE, number=2,) - min_instances = proto.Field(proto.INT32, number=3,) - max_instances = proto.Field(proto.INT32, number=4,) + target_cpu_utilization = proto.Field( + proto.DOUBLE, + number=1, + ) + target_throughput_utilization = proto.Field( + proto.DOUBLE, + number=2, + ) + min_instances = proto.Field( + proto.INT32, + number=3, + ) + max_instances = proto.Field( + proto.INT32, + number=4, + ) class Network(proto.Message): @@ -644,11 +866,26 @@ class Network(proto.Message): environment. """ - forwarded_ports = proto.RepeatedField(proto.STRING, number=1,) - instance_tag = proto.Field(proto.STRING, number=2,) - name = proto.Field(proto.STRING, number=3,) - subnetwork_name = proto.Field(proto.STRING, number=4,) - session_affinity = proto.Field(proto.BOOL, number=5,) + forwarded_ports = proto.RepeatedField( + proto.STRING, + number=1, + ) + instance_tag = proto.Field( + proto.STRING, + number=2, + ) + name = proto.Field( + proto.STRING, + number=3, + ) + subnetwork_name = proto.Field( + proto.STRING, + number=4, + ) + session_affinity = proto.Field( + proto.BOOL, + number=5, + ) class Volume(proto.Message): @@ -664,9 +901,18 @@ class Volume(proto.Message): Volume size in gigabytes. """ - name = proto.Field(proto.STRING, number=1,) - volume_type = proto.Field(proto.STRING, number=2,) - size_gb = proto.Field(proto.DOUBLE, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + volume_type = proto.Field( + proto.STRING, + number=2, + ) + size_gb = proto.Field( + proto.DOUBLE, + number=3, + ) class Resources(proto.Message): @@ -687,11 +933,27 @@ class Resources(proto.Message): Cloud Composer to encrypt the vm disk """ - cpu = proto.Field(proto.DOUBLE, number=1,) - disk_gb = proto.Field(proto.DOUBLE, number=2,) - memory_gb = proto.Field(proto.DOUBLE, number=3,) - volumes = proto.RepeatedField(proto.MESSAGE, number=4, message="Volume",) - kms_key_reference = proto.Field(proto.STRING, number=5,) + cpu = proto.Field( + proto.DOUBLE, + number=1, + ) + disk_gb = proto.Field( + proto.DOUBLE, + number=2, + ) + memory_gb = proto.Field( + proto.DOUBLE, + number=3, + ) + volumes = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Volume", + ) + kms_key_reference = proto.Field( + proto.STRING, + number=5, + ) class VpcAccessConnector(proto.Message): @@ -704,7 +966,10 @@ class VpcAccessConnector(proto.Message): /projects/my-project/locations/us-central1/connectors/c1. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class Entrypoint(proto.Message): @@ -720,7 +985,11 @@ class Entrypoint(proto.Message): This field is a member of `oneof`_ ``command``. """ - shell = proto.Field(proto.STRING, number=1, oneof="command",) + shell = proto.Field( + proto.STRING, + number=1, + oneof="command", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..3addb4e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index c2bd823..4437c0a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -91,7 +91,13 @@ def test__get_default_mtls_endpoint(): assert ApplicationsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ApplicationsClient, + ApplicationsAsyncClient, + ], +) def test_applications_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -131,7 +137,13 @@ def test_applications_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ApplicationsClient, ApplicationsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ApplicationsClient, + ApplicationsAsyncClient, + ], +) def test_applications_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -486,7 +498,9 @@ 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"],) + 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) @@ -628,10 +642,17 @@ def test_applications_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [appengine.GetApplicationRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -680,7 +701,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -696,7 +718,8 @@ async def test_get_application_async( transport: str = "grpc_asyncio", request_type=appengine.GetApplicationRequest ): client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -749,7 +772,9 @@ async def test_get_application_async_from_dict(): def test_get_application_field_headers(): - client = ApplicationsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -769,12 +794,17 @@ def test_get_application_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -796,13 +826,23 @@ async def test_get_application_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.CreateApplicationRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -830,7 +870,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -848,7 +889,8 @@ async def test_create_application_async( transport: str = "grpc_asyncio", request_type=appengine.CreateApplicationRequest ): client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -879,10 +921,17 @@ async def test_create_application_async_from_dict(): await test_create_application_async(request_type=dict) -@pytest.mark.parametrize("request_type", [appengine.UpdateApplicationRequest, 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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -910,7 +959,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -928,7 +978,8 @@ async def test_update_application_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateApplicationRequest ): client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -960,7 +1011,9 @@ async def test_update_application_async_from_dict(): def test_update_application_field_headers(): - client = ApplicationsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -982,12 +1035,17 @@ def test_update_application_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1011,13 +1069,23 @@ async def test_update_application_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.RepairApplicationRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1045,7 +1113,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1063,7 +1132,8 @@ async def test_repair_application_async( transport: str = "grpc_asyncio", request_type=appengine.RepairApplicationRequest ): client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1095,7 +1165,9 @@ async def test_repair_application_async_from_dict(): def test_repair_application_field_headers(): - client = ApplicationsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1117,12 +1189,17 @@ def test_repair_application_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1146,7 +1223,10 @@ async def test_repair_application_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1156,7 +1236,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1176,7 +1257,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ApplicationsClient(client_options=options, transport=transport,) + client = ApplicationsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1192,7 +1276,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ApplicationsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1237,8 +1322,13 @@ def test_transport_adc(transport_class): 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,) + client = ApplicationsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ApplicationsGrpcTransport, + ) def test_applications_base_transport_error(): @@ -1291,7 +1381,8 @@ def test_applications_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ApplicationsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1462,7 +1553,8 @@ def test_applications_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ApplicationsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1474,7 +1566,8 @@ def test_applications_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ApplicationsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1575,12 +1668,16 @@ def test_applications_transport_channel_mtls_with_adc(transport_class): def test_applications_grpc_lro_client(): client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + 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,) + 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 @@ -1588,12 +1685,16 @@ def test_applications_grpc_lro_client(): def test_applications_grpc_lro_async_client(): client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + 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,) + 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 @@ -1621,7 +1722,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ApplicationsClient.common_folder_path(folder) assert expected == actual @@ -1639,7 +1742,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ApplicationsClient.common_organization_path(organization) assert expected == actual @@ -1657,7 +1762,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ApplicationsClient.common_project_path(project) assert expected == actual @@ -1677,7 +1784,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ApplicationsClient.common_location_path(project, location) assert expected == actual @@ -1702,7 +1810,8 @@ def test_client_with_default_client_info(): transports.ApplicationsTransport, "_prep_wrapped_messages" ) as prep: client = ApplicationsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1711,7 +1820,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ApplicationsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1719,7 +1829,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ApplicationsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" 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 9966789..200b8ca 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -93,7 +93,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] + "client_class", + [ + AuthorizedCertificatesClient, + AuthorizedCertificatesAsyncClient, + ], ) def test_authorized_certificates_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -135,7 +139,11 @@ def test_authorized_certificates_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [AuthorizedCertificatesClient, AuthorizedCertificatesAsyncClient,] + "client_class", + [ + AuthorizedCertificatesClient, + AuthorizedCertificatesAsyncClient, + ], ) def test_authorized_certificates_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -517,7 +525,9 @@ 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"],) + 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) @@ -662,11 +672,16 @@ def test_authorized_certificates_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [appengine.ListAuthorizedCertificatesRequest, dict,] + "request_type", + [ + appengine.ListAuthorizedCertificatesRequest, + dict, + ], ) def test_list_authorized_certificates(request_type, transport: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -697,7 +712,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -716,7 +732,8 @@ async def test_list_authorized_certificates_async( request_type=appengine.ListAuthorizedCertificatesRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -775,7 +792,10 @@ def test_list_authorized_certificates_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -806,12 +826,16 @@ async def test_list_authorized_certificates_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -829,10 +853,13 @@ def test_list_authorized_certificates_pager(transport_name: str = "grpc"): next_page_token="abc", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[], next_page_token="def", + certificates=[], + next_page_token="def", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[certificate.AuthorizedCertificate(),], + certificates=[ + certificate.AuthorizedCertificate(), + ], next_page_token="ghi", ), appengine.ListAuthorizedCertificatesResponse( @@ -859,7 +886,8 @@ def test_list_authorized_certificates_pager(transport_name: str = "grpc"): def test_list_authorized_certificates_pages(transport_name: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -877,10 +905,13 @@ def test_list_authorized_certificates_pages(transport_name: str = "grpc"): next_page_token="abc", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[], next_page_token="def", + certificates=[], + next_page_token="def", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[certificate.AuthorizedCertificate(),], + certificates=[ + certificate.AuthorizedCertificate(), + ], next_page_token="ghi", ), appengine.ListAuthorizedCertificatesResponse( @@ -919,10 +950,13 @@ async def test_list_authorized_certificates_async_pager(): next_page_token="abc", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[], next_page_token="def", + certificates=[], + next_page_token="def", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[certificate.AuthorizedCertificate(),], + certificates=[ + certificate.AuthorizedCertificate(), + ], next_page_token="ghi", ), appengine.ListAuthorizedCertificatesResponse( @@ -933,7 +967,9 @@ async def test_list_authorized_certificates_async_pager(): ), RuntimeError, ) - async_pager = await client.list_authorized_certificates(request={},) + async_pager = await client.list_authorized_certificates( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -966,10 +1002,13 @@ async def test_list_authorized_certificates_async_pages(): next_page_token="abc", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[], next_page_token="def", + certificates=[], + next_page_token="def", ), appengine.ListAuthorizedCertificatesResponse( - certificates=[certificate.AuthorizedCertificate(),], + certificates=[ + certificate.AuthorizedCertificate(), + ], next_page_token="ghi", ), appengine.ListAuthorizedCertificatesResponse( @@ -990,11 +1029,16 @@ async def test_list_authorized_certificates_async_pages(): @pytest.mark.parametrize( - "request_type", [appengine.GetAuthorizedCertificateRequest, dict,] + "request_type", + [ + appengine.GetAuthorizedCertificateRequest, + dict, + ], ) def test_get_authorized_certificate(request_type, transport: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1035,7 +1079,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1054,7 +1099,8 @@ async def test_get_authorized_certificate_async( request_type=appengine.GetAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1123,7 +1169,10 @@ def test_get_authorized_certificate_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1154,15 +1203,23 @@ async def test_get_authorized_certificate_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [appengine.CreateAuthorizedCertificateRequest, dict,] + "request_type", + [ + appengine.CreateAuthorizedCertificateRequest, + dict, + ], ) def test_create_authorized_certificate(request_type, transport: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1203,7 +1260,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1222,7 +1280,8 @@ async def test_create_authorized_certificate_async( request_type=appengine.CreateAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1291,7 +1350,10 @@ def test_create_authorized_certificate_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1322,15 +1384,23 @@ async def test_create_authorized_certificate_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [appengine.UpdateAuthorizedCertificateRequest, dict,] + "request_type", + [ + appengine.UpdateAuthorizedCertificateRequest, + dict, + ], ) def test_update_authorized_certificate(request_type, transport: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1371,7 +1441,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1390,7 +1461,8 @@ async def test_update_authorized_certificate_async( request_type=appengine.UpdateAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1459,7 +1531,10 @@ def test_update_authorized_certificate_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1490,15 +1565,23 @@ async def test_update_authorized_certificate_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [appengine.DeleteAuthorizedCertificateRequest, dict,] + "request_type", + [ + appengine.DeleteAuthorizedCertificateRequest, + dict, + ], ) def test_delete_authorized_certificate(request_type, transport: str = "grpc"): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1526,7 +1609,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1545,7 +1629,8 @@ async def test_delete_authorized_certificate_async( request_type=appengine.DeleteAuthorizedCertificateRequest, ): client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1599,7 +1684,10 @@ def test_delete_authorized_certificate_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1628,7 +1716,10 @@ async def test_delete_authorized_certificate_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1638,7 +1729,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1659,7 +1751,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = AuthorizedCertificatesClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1676,7 +1769,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AuthorizedCertificatesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1724,7 +1818,10 @@ def test_transport_grpc_default(): client = AuthorizedCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.AuthorizedCertificatesGrpcTransport,) + assert isinstance( + client.transport, + transports.AuthorizedCertificatesGrpcTransport, + ) def test_authorized_certificates_base_transport_error(): @@ -1773,7 +1870,8 @@ def test_authorized_certificates_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AuthorizedCertificatesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1951,7 +2049,8 @@ def test_authorized_certificates_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AuthorizedCertificatesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1963,7 +2062,8 @@ def test_authorized_certificates_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AuthorizedCertificatesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2092,7 +2192,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AuthorizedCertificatesClient.common_folder_path(folder) assert expected == actual @@ -2110,7 +2212,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AuthorizedCertificatesClient.common_organization_path(organization) assert expected == actual @@ -2128,7 +2232,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AuthorizedCertificatesClient.common_project_path(project) assert expected == actual @@ -2148,7 +2254,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AuthorizedCertificatesClient.common_location_path(project, location) assert expected == actual @@ -2173,7 +2280,8 @@ def test_client_with_default_client_info(): transports.AuthorizedCertificatesTransport, "_prep_wrapped_messages" ) as prep: client = AuthorizedCertificatesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2182,7 +2290,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AuthorizedCertificatesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2190,7 +2299,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AuthorizedCertificatesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" 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 7ca50da..bb5b38a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -91,7 +91,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] + "client_class", + [ + AuthorizedDomainsClient, + AuthorizedDomainsAsyncClient, + ], ) def test_authorized_domains_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -133,7 +137,11 @@ def test_authorized_domains_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [AuthorizedDomainsClient, AuthorizedDomainsAsyncClient,] + "client_class", + [ + AuthorizedDomainsClient, + AuthorizedDomainsAsyncClient, + ], ) def test_authorized_domains_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -507,7 +515,9 @@ 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"],) + 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) @@ -652,11 +662,16 @@ def test_authorized_domains_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [appengine.ListAuthorizedDomainsRequest, dict,] + "request_type", + [ + appengine.ListAuthorizedDomainsRequest, + dict, + ], ) def test_list_authorized_domains(request_type, transport: str = "grpc"): client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -687,7 +702,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -705,7 +721,8 @@ async def test_list_authorized_domains_async( transport: str = "grpc_asyncio", request_type=appengine.ListAuthorizedDomainsRequest ): client = AuthorizedDomainsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -740,7 +757,9 @@ async def test_list_authorized_domains_async_from_dict(): def test_list_authorized_domains_field_headers(): - client = AuthorizedDomainsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -762,7 +781,10 @@ def test_list_authorized_domains_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -793,12 +815,16 @@ async def test_list_authorized_domains_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -815,12 +841,21 @@ def test_list_authorized_domains_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - appengine.ListAuthorizedDomainsResponse(domains=[], next_page_token="def",), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(),], next_page_token="ghi", + domains=[], + next_page_token="def", ), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(), domain.AuthorizedDomain(),], + domains=[ + domain.AuthorizedDomain(), + ], + next_page_token="ghi", + ), + appengine.ListAuthorizedDomainsResponse( + domains=[ + domain.AuthorizedDomain(), + domain.AuthorizedDomain(), + ], ), RuntimeError, ) @@ -840,7 +875,8 @@ def test_list_authorized_domains_pager(transport_name: str = "grpc"): def test_list_authorized_domains_pages(transport_name: str = "grpc"): client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -857,12 +893,21 @@ def test_list_authorized_domains_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - appengine.ListAuthorizedDomainsResponse(domains=[], next_page_token="def",), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(),], next_page_token="ghi", + domains=[], + next_page_token="def", + ), + appengine.ListAuthorizedDomainsResponse( + domains=[ + domain.AuthorizedDomain(), + ], + next_page_token="ghi", ), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(), domain.AuthorizedDomain(),], + domains=[ + domain.AuthorizedDomain(), + domain.AuthorizedDomain(), + ], ), RuntimeError, ) @@ -893,16 +938,27 @@ async def test_list_authorized_domains_async_pager(): ], next_page_token="abc", ), - appengine.ListAuthorizedDomainsResponse(domains=[], next_page_token="def",), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(),], next_page_token="ghi", + domains=[], + next_page_token="def", ), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(), domain.AuthorizedDomain(),], + domains=[ + domain.AuthorizedDomain(), + ], + next_page_token="ghi", + ), + appengine.ListAuthorizedDomainsResponse( + domains=[ + domain.AuthorizedDomain(), + domain.AuthorizedDomain(), + ], ), RuntimeError, ) - async_pager = await client.list_authorized_domains(request={},) + async_pager = await client.list_authorized_domains( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -934,12 +990,21 @@ async def test_list_authorized_domains_async_pages(): ], next_page_token="abc", ), - appengine.ListAuthorizedDomainsResponse(domains=[], next_page_token="def",), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(),], next_page_token="ghi", + domains=[], + next_page_token="def", + ), + appengine.ListAuthorizedDomainsResponse( + domains=[ + domain.AuthorizedDomain(), + ], + next_page_token="ghi", ), appengine.ListAuthorizedDomainsResponse( - domains=[domain.AuthorizedDomain(), domain.AuthorizedDomain(),], + domains=[ + domain.AuthorizedDomain(), + domain.AuthorizedDomain(), + ], ), RuntimeError, ) @@ -957,7 +1022,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -977,7 +1043,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AuthorizedDomainsClient(client_options=options, transport=transport,) + client = AuthorizedDomainsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -993,7 +1062,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AuthorizedDomainsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1038,8 +1108,13 @@ def test_transport_adc(transport_class): 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,) + client = AuthorizedDomainsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AuthorizedDomainsGrpcTransport, + ) def test_authorized_domains_base_transport_error(): @@ -1082,7 +1157,8 @@ def test_authorized_domains_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AuthorizedDomainsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1256,7 +1332,8 @@ def test_authorized_domains_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AuthorizedDomainsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1268,7 +1345,8 @@ def test_authorized_domains_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AuthorizedDomainsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1397,7 +1475,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AuthorizedDomainsClient.common_folder_path(folder) assert expected == actual @@ -1415,7 +1495,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AuthorizedDomainsClient.common_organization_path(organization) assert expected == actual @@ -1433,7 +1515,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AuthorizedDomainsClient.common_project_path(project) assert expected == actual @@ -1453,7 +1537,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AuthorizedDomainsClient.common_location_path(project, location) assert expected == actual @@ -1478,7 +1563,8 @@ def test_client_with_default_client_info(): transports.AuthorizedDomainsTransport, "_prep_wrapped_messages" ) as prep: client = AuthorizedDomainsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1487,7 +1573,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AuthorizedDomainsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1495,7 +1582,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AuthorizedDomainsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" 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 d46c61a..c590dea 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -97,7 +97,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [DomainMappingsClient, DomainMappingsAsyncClient,] + "client_class", + [ + DomainMappingsClient, + DomainMappingsAsyncClient, + ], ) def test_domain_mappings_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -139,7 +143,11 @@ def test_domain_mappings_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [DomainMappingsClient, DomainMappingsAsyncClient,] + "client_class", + [ + DomainMappingsClient, + DomainMappingsAsyncClient, + ], ) def test_domain_mappings_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -503,7 +511,9 @@ 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"],) + 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) @@ -647,10 +657,17 @@ def test_domain_mappings_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [appengine.ListDomainMappingsRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -681,7 +698,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -699,7 +717,8 @@ async def test_list_domain_mappings_async( transport: str = "grpc_asyncio", request_type=appengine.ListDomainMappingsRequest ): client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -734,7 +753,9 @@ async def test_list_domain_mappings_async_from_dict(): def test_list_domain_mappings_field_headers(): - client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -756,7 +777,10 @@ def test_list_domain_mappings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -787,12 +811,16 @@ async def test_list_domain_mappings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -810,10 +838,13 @@ def test_list_domain_mappings_pager(transport_name: str = "grpc"): next_page_token="abc", ), appengine.ListDomainMappingsResponse( - domain_mappings=[], next_page_token="def", + domain_mappings=[], + next_page_token="def", ), appengine.ListDomainMappingsResponse( - domain_mappings=[domain_mapping.DomainMapping(),], + domain_mappings=[ + domain_mapping.DomainMapping(), + ], next_page_token="ghi", ), appengine.ListDomainMappingsResponse( @@ -840,7 +871,8 @@ def test_list_domain_mappings_pager(transport_name: str = "grpc"): def test_list_domain_mappings_pages(transport_name: str = "grpc"): client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -858,10 +890,13 @@ def test_list_domain_mappings_pages(transport_name: str = "grpc"): next_page_token="abc", ), appengine.ListDomainMappingsResponse( - domain_mappings=[], next_page_token="def", + domain_mappings=[], + next_page_token="def", ), appengine.ListDomainMappingsResponse( - domain_mappings=[domain_mapping.DomainMapping(),], + domain_mappings=[ + domain_mapping.DomainMapping(), + ], next_page_token="ghi", ), appengine.ListDomainMappingsResponse( @@ -879,7 +914,9 @@ def test_list_domain_mappings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_domain_mappings_async_pager(): - client = DomainMappingsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DomainMappingsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -898,10 +935,13 @@ async def test_list_domain_mappings_async_pager(): next_page_token="abc", ), appengine.ListDomainMappingsResponse( - domain_mappings=[], next_page_token="def", + domain_mappings=[], + next_page_token="def", ), appengine.ListDomainMappingsResponse( - domain_mappings=[domain_mapping.DomainMapping(),], + domain_mappings=[ + domain_mapping.DomainMapping(), + ], next_page_token="ghi", ), appengine.ListDomainMappingsResponse( @@ -912,7 +952,9 @@ async def test_list_domain_mappings_async_pager(): ), RuntimeError, ) - async_pager = await client.list_domain_mappings(request={},) + async_pager = await client.list_domain_mappings( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -924,7 +966,9 @@ async def test_list_domain_mappings_async_pager(): @pytest.mark.asyncio async def test_list_domain_mappings_async_pages(): - client = DomainMappingsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DomainMappingsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -943,10 +987,13 @@ async def test_list_domain_mappings_async_pages(): next_page_token="abc", ), appengine.ListDomainMappingsResponse( - domain_mappings=[], next_page_token="def", + domain_mappings=[], + next_page_token="def", ), appengine.ListDomainMappingsResponse( - domain_mappings=[domain_mapping.DomainMapping(),], + domain_mappings=[ + domain_mapping.DomainMapping(), + ], next_page_token="ghi", ), appengine.ListDomainMappingsResponse( @@ -964,10 +1011,17 @@ async def test_list_domain_mappings_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [appengine.GetDomainMappingRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -980,7 +1034,8 @@ def test_get_domain_mapping(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = domain_mapping.DomainMapping( - name="name_value", id="id_value", + name="name_value", + id="id_value", ) response = client.get_domain_mapping(request) @@ -999,7 +1054,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1017,7 +1073,8 @@ async def test_get_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.GetDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1030,7 +1087,10 @@ async def test_get_domain_mapping_async( ) 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",) + domain_mapping.DomainMapping( + name="name_value", + id="id_value", + ) ) response = await client.get_domain_mapping(request) @@ -1051,7 +1111,9 @@ async def test_get_domain_mapping_async_from_dict(): def test_get_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1073,7 +1135,10 @@ def test_get_domain_mapping_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1104,13 +1169,23 @@ async def test_get_domain_mapping_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.CreateDomainMappingRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1138,7 +1213,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1156,7 +1232,8 @@ async def test_create_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.CreateDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1188,7 +1265,9 @@ async def test_create_domain_mapping_async_from_dict(): def test_create_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1210,7 +1289,10 @@ def test_create_domain_mapping_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1241,13 +1323,23 @@ async def test_create_domain_mapping_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.UpdateDomainMappingRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1275,7 +1367,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1293,7 +1386,8 @@ async def test_update_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1325,7 +1419,9 @@ async def test_update_domain_mapping_async_from_dict(): def test_update_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1347,7 +1443,10 @@ def test_update_domain_mapping_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1378,13 +1477,23 @@ async def test_update_domain_mapping_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.DeleteDomainMappingRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1412,7 +1521,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1430,7 +1540,8 @@ async def test_delete_domain_mapping_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteDomainMappingRequest ): client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1462,7 +1573,9 @@ async def test_delete_domain_mapping_async_from_dict(): def test_delete_domain_mapping_field_headers(): - client = DomainMappingsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1484,7 +1597,10 @@ def test_delete_domain_mapping_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1515,7 +1631,10 @@ async def test_delete_domain_mapping_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1525,7 +1644,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1545,7 +1665,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DomainMappingsClient(client_options=options, transport=transport,) + client = DomainMappingsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1561,7 +1684,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DomainMappingsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1606,8 +1730,13 @@ def test_transport_adc(transport_class): 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,) + client = DomainMappingsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.DomainMappingsGrpcTransport, + ) def test_domain_mappings_base_transport_error(): @@ -1661,7 +1790,8 @@ def test_domain_mappings_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DomainMappingsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1835,7 +1965,8 @@ def test_domain_mappings_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.DomainMappingsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1847,7 +1978,8 @@ def test_domain_mappings_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.DomainMappingsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1956,12 +2088,16 @@ def test_domain_mappings_transport_channel_mtls_with_adc(transport_class): def test_domain_mappings_grpc_lro_client(): client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + 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,) + 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 @@ -1969,12 +2105,16 @@ def test_domain_mappings_grpc_lro_client(): def test_domain_mappings_grpc_lro_async_client(): client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + 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,) + 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 @@ -2002,7 +2142,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DomainMappingsClient.common_folder_path(folder) assert expected == actual @@ -2020,7 +2162,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DomainMappingsClient.common_organization_path(organization) assert expected == actual @@ -2038,7 +2182,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DomainMappingsClient.common_project_path(project) assert expected == actual @@ -2058,7 +2204,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DomainMappingsClient.common_location_path(project, location) assert expected == actual @@ -2083,7 +2230,8 @@ def test_client_with_default_client_info(): transports.DomainMappingsTransport, "_prep_wrapped_messages" ) as prep: client = DomainMappingsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2092,7 +2240,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = DomainMappingsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2100,7 +2249,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = DomainMappingsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 49e3343..74a2118 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -81,7 +81,13 @@ def test__get_default_mtls_endpoint(): assert FirewallClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + FirewallClient, + FirewallAsyncClient, + ], +) def test_firewall_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -121,7 +127,13 @@ def test_firewall_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [FirewallClient, FirewallAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + FirewallClient, + FirewallAsyncClient, + ], +) def test_firewall_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -466,7 +478,9 @@ 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"],) + 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) @@ -598,10 +612,17 @@ def test_firewall_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [appengine.ListIngressRulesRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -632,7 +653,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -650,7 +672,8 @@ async def test_list_ingress_rules_async( transport: str = "grpc_asyncio", request_type=appengine.ListIngressRulesRequest ): client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -663,7 +686,9 @@ async def test_list_ingress_rules_async( ) 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",) + appengine.ListIngressRulesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_ingress_rules(request) @@ -683,7 +708,9 @@ async def test_list_ingress_rules_async_from_dict(): def test_list_ingress_rules_field_headers(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -705,12 +732,17 @@ def test_list_ingress_rules_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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(),) + 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. @@ -734,12 +766,16 @@ async def test_list_ingress_rules_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -757,13 +793,20 @@ def test_list_ingress_rules_pager(transport_name: str = "grpc"): next_page_token="abc", ), appengine.ListIngressRulesResponse( - ingress_rules=[], next_page_token="def", + ingress_rules=[], + next_page_token="def", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(),], next_page_token="ghi", + ingress_rules=[ + firewall.FirewallRule(), + ], + next_page_token="ghi", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(), firewall.FirewallRule(),], + ingress_rules=[ + firewall.FirewallRule(), + firewall.FirewallRule(), + ], ), RuntimeError, ) @@ -783,7 +826,8 @@ def test_list_ingress_rules_pager(transport_name: str = "grpc"): def test_list_ingress_rules_pages(transport_name: str = "grpc"): client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -801,13 +845,20 @@ def test_list_ingress_rules_pages(transport_name: str = "grpc"): next_page_token="abc", ), appengine.ListIngressRulesResponse( - ingress_rules=[], next_page_token="def", + ingress_rules=[], + next_page_token="def", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(),], next_page_token="ghi", + ingress_rules=[ + firewall.FirewallRule(), + ], + next_page_token="ghi", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(), firewall.FirewallRule(),], + ingress_rules=[ + firewall.FirewallRule(), + firewall.FirewallRule(), + ], ), RuntimeError, ) @@ -818,7 +869,9 @@ def test_list_ingress_rules_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_ingress_rules_async_pager(): - client = FirewallAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = FirewallAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -837,17 +890,26 @@ async def test_list_ingress_rules_async_pager(): next_page_token="abc", ), appengine.ListIngressRulesResponse( - ingress_rules=[], next_page_token="def", + ingress_rules=[], + next_page_token="def", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(),], next_page_token="ghi", + ingress_rules=[ + firewall.FirewallRule(), + ], + next_page_token="ghi", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(), firewall.FirewallRule(),], + ingress_rules=[ + firewall.FirewallRule(), + firewall.FirewallRule(), + ], ), RuntimeError, ) - async_pager = await client.list_ingress_rules(request={},) + async_pager = await client.list_ingress_rules( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -859,7 +921,9 @@ async def test_list_ingress_rules_async_pager(): @pytest.mark.asyncio async def test_list_ingress_rules_async_pages(): - client = FirewallAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = FirewallAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -878,13 +942,20 @@ async def test_list_ingress_rules_async_pages(): next_page_token="abc", ), appengine.ListIngressRulesResponse( - ingress_rules=[], next_page_token="def", + ingress_rules=[], + next_page_token="def", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(),], next_page_token="ghi", + ingress_rules=[ + firewall.FirewallRule(), + ], + next_page_token="ghi", ), appengine.ListIngressRulesResponse( - ingress_rules=[firewall.FirewallRule(), firewall.FirewallRule(),], + ingress_rules=[ + firewall.FirewallRule(), + firewall.FirewallRule(), + ], ), RuntimeError, ) @@ -896,11 +967,16 @@ async def test_list_ingress_rules_async_pages(): @pytest.mark.parametrize( - "request_type", [appengine.BatchUpdateIngressRulesRequest, dict,] + "request_type", + [ + appengine.BatchUpdateIngressRulesRequest, + dict, + ], ) def test_batch_update_ingress_rules(request_type, transport: str = "grpc"): client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -928,7 +1004,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -947,7 +1024,8 @@ async def test_batch_update_ingress_rules_async( request_type=appengine.BatchUpdateIngressRulesRequest, ): client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -979,7 +1057,9 @@ async def test_batch_update_ingress_rules_async_from_dict(): def test_batch_update_ingress_rules_field_headers(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1001,12 +1081,17 @@ def test_batch_update_ingress_rules_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1030,13 +1115,23 @@ async def test_batch_update_ingress_rules_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.CreateIngressRuleRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1073,7 +1168,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1091,7 +1187,8 @@ async def test_create_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.CreateIngressRuleRequest ): client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1132,7 +1229,9 @@ async def test_create_ingress_rule_async_from_dict(): def test_create_ingress_rule_field_headers(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1154,12 +1253,17 @@ def test_create_ingress_rule_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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(),) + 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. @@ -1183,13 +1287,23 @@ async def test_create_ingress_rule_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.GetIngressRuleRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1224,7 +1338,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1240,7 +1355,8 @@ async def test_get_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.GetIngressRuleRequest ): client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1279,7 +1395,9 @@ async def test_get_ingress_rule_async_from_dict(): def test_get_ingress_rule_field_headers(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1299,12 +1417,17 @@ def test_get_ingress_rule_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1326,13 +1449,23 @@ async def test_get_ingress_rule_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.UpdateIngressRuleRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1369,7 +1502,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1387,7 +1521,8 @@ async def test_update_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateIngressRuleRequest ): client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1428,7 +1563,9 @@ async def test_update_ingress_rule_async_from_dict(): def test_update_ingress_rule_field_headers(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1450,12 +1587,17 @@ def test_update_ingress_rule_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1479,13 +1621,23 @@ async def test_update_ingress_rule_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.DeleteIngressRuleRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1513,7 +1665,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1531,7 +1684,8 @@ async def test_delete_ingress_rule_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteIngressRuleRequest ): client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1561,7 +1715,9 @@ async def test_delete_ingress_rule_async_from_dict(): def test_delete_ingress_rule_field_headers(): - client = FirewallClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1583,12 +1739,17 @@ def test_delete_ingress_rule_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1610,7 +1771,10 @@ async def test_delete_ingress_rule_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1620,7 +1784,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1640,7 +1805,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = FirewallClient(client_options=options, transport=transport,) + client = FirewallClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1656,7 +1824,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FirewallClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1686,7 +1855,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport,], + [ + transports.FirewallGrpcTransport, + transports.FirewallGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1698,8 +1870,13 @@ def test_transport_adc(transport_class): 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,) + client = FirewallClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.FirewallGrpcTransport, + ) def test_firewall_base_transport_error(): @@ -1749,7 +1926,8 @@ def test_firewall_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FirewallTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1792,7 +1970,10 @@ def test_firewall_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.FirewallGrpcTransport, transports.FirewallGrpcAsyncIOTransport,], + [ + transports.FirewallGrpcTransport, + transports.FirewallGrpcAsyncIOTransport, + ], ) def test_firewall_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1917,7 +2098,8 @@ def test_firewall_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.FirewallGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1929,7 +2111,8 @@ def test_firewall_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.FirewallGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2050,7 +2233,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = FirewallClient.common_folder_path(folder) assert expected == actual @@ -2068,7 +2253,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = FirewallClient.common_organization_path(organization) assert expected == actual @@ -2086,7 +2273,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = FirewallClient.common_project_path(project) assert expected == actual @@ -2106,7 +2295,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = FirewallClient.common_location_path(project, location) assert expected == actual @@ -2131,7 +2321,8 @@ def test_client_with_default_client_info(): transports.FirewallTransport, "_prep_wrapped_messages" ) as prep: client = FirewallClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2140,7 +2331,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = FirewallClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2148,7 +2340,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = FirewallAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 4935b8d..25e066a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -87,7 +87,13 @@ def test__get_default_mtls_endpoint(): assert InstancesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + InstancesClient, + InstancesAsyncClient, + ], +) def test_instances_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -127,7 +133,13 @@ def test_instances_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [InstancesClient, InstancesAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + InstancesClient, + InstancesAsyncClient, + ], +) def test_instances_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -480,7 +492,9 @@ 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"],) + 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) @@ -612,10 +626,17 @@ def test_instances_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [appengine.ListInstancesRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -644,7 +665,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -660,7 +682,8 @@ async def test_list_instances_async( transport: str = "grpc_asyncio", request_type=appengine.ListInstancesRequest ): client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -671,7 +694,9 @@ async def test_list_instances_async( 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",) + appengine.ListInstancesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_instances(request) @@ -691,7 +716,9 @@ async def test_list_instances_async_from_dict(): def test_list_instances_field_headers(): - client = InstancesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -711,12 +738,17 @@ def test_list_instances_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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(),) + 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. @@ -738,12 +770,16 @@ async def test_list_instances_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -758,12 +794,21 @@ def test_list_instances_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - appengine.ListInstancesResponse(instances=[], next_page_token="def",), appengine.ListInstancesResponse( - instances=[instance.Instance(),], next_page_token="ghi", + instances=[], + next_page_token="def", + ), + appengine.ListInstancesResponse( + instances=[ + instance.Instance(), + ], + next_page_token="ghi", ), appengine.ListInstancesResponse( - instances=[instance.Instance(), instance.Instance(),], + instances=[ + instance.Instance(), + instance.Instance(), + ], ), RuntimeError, ) @@ -783,7 +828,8 @@ def test_list_instances_pager(transport_name: str = "grpc"): def test_list_instances_pages(transport_name: str = "grpc"): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -798,12 +844,21 @@ def test_list_instances_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - appengine.ListInstancesResponse(instances=[], next_page_token="def",), appengine.ListInstancesResponse( - instances=[instance.Instance(),], next_page_token="ghi", + instances=[], + next_page_token="def", ), appengine.ListInstancesResponse( - instances=[instance.Instance(), instance.Instance(),], + instances=[ + instance.Instance(), + ], + next_page_token="ghi", + ), + appengine.ListInstancesResponse( + instances=[ + instance.Instance(), + instance.Instance(), + ], ), RuntimeError, ) @@ -814,7 +869,9 @@ def test_list_instances_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_instances_async_pager(): - client = InstancesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = InstancesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -830,16 +887,27 @@ async def test_list_instances_async_pager(): ], next_page_token="abc", ), - appengine.ListInstancesResponse(instances=[], next_page_token="def",), appengine.ListInstancesResponse( - instances=[instance.Instance(),], next_page_token="ghi", + instances=[], + next_page_token="def", ), appengine.ListInstancesResponse( - instances=[instance.Instance(), instance.Instance(),], + instances=[ + instance.Instance(), + ], + next_page_token="ghi", + ), + appengine.ListInstancesResponse( + instances=[ + instance.Instance(), + instance.Instance(), + ], ), RuntimeError, ) - async_pager = await client.list_instances(request={},) + async_pager = await client.list_instances( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -851,7 +919,9 @@ async def test_list_instances_async_pager(): @pytest.mark.asyncio async def test_list_instances_async_pages(): - client = InstancesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = InstancesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -867,12 +937,21 @@ async def test_list_instances_async_pages(): ], next_page_token="abc", ), - appengine.ListInstancesResponse(instances=[], next_page_token="def",), appengine.ListInstancesResponse( - instances=[instance.Instance(),], next_page_token="ghi", + instances=[], + next_page_token="def", ), appengine.ListInstancesResponse( - instances=[instance.Instance(), instance.Instance(),], + instances=[ + instance.Instance(), + ], + next_page_token="ghi", + ), + appengine.ListInstancesResponse( + instances=[ + instance.Instance(), + instance.Instance(), + ], ), RuntimeError, ) @@ -883,10 +962,17 @@ async def test_list_instances_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [appengine.GetInstanceRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -945,7 +1031,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -961,7 +1048,8 @@ async def test_get_instance_async( transport: str = "grpc_asyncio", request_type=appengine.GetInstanceRequest ): client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1024,7 +1112,9 @@ async def test_get_instance_async_from_dict(): def test_get_instance_field_headers(): - client = InstancesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1044,12 +1134,17 @@ def test_get_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1069,13 +1164,23 @@ async def test_get_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.DeleteInstanceRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1101,7 +1206,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1117,7 +1223,8 @@ async def test_delete_instance_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteInstanceRequest ): client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1147,7 +1254,9 @@ async def test_delete_instance_async_from_dict(): def test_delete_instance_field_headers(): - client = InstancesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1167,12 +1276,17 @@ def test_delete_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1194,13 +1308,23 @@ async def test_delete_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.DebugInstanceRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1226,7 +1350,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1242,7 +1367,8 @@ async def test_debug_instance_async( transport: str = "grpc_asyncio", request_type=appengine.DebugInstanceRequest ): client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1272,7 +1398,9 @@ async def test_debug_instance_async_from_dict(): def test_debug_instance_field_headers(): - client = InstancesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1292,12 +1420,17 @@ def test_debug_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1319,7 +1452,10 @@ async def test_debug_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1329,7 +1465,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1349,7 +1486,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = InstancesClient(client_options=options, transport=transport,) + client = InstancesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1365,7 +1505,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = InstancesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1395,7 +1536,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport,], + [ + transports.InstancesGrpcTransport, + transports.InstancesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1407,8 +1551,13 @@ def test_transport_adc(transport_class): 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,) + client = InstancesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.InstancesGrpcTransport, + ) def test_instances_base_transport_error(): @@ -1461,7 +1610,8 @@ def test_instances_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.InstancesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1504,7 +1654,10 @@ def test_instances_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.InstancesGrpcTransport, transports.InstancesGrpcAsyncIOTransport,], + [ + transports.InstancesGrpcTransport, + transports.InstancesGrpcAsyncIOTransport, + ], ) def test_instances_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1629,7 +1782,8 @@ def test_instances_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.InstancesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1641,7 +1795,8 @@ def test_instances_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.InstancesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1742,12 +1897,16 @@ def test_instances_transport_channel_mtls_with_adc(transport_class): def test_instances_grpc_lro_client(): client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + 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,) + 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 @@ -1755,12 +1914,16 @@ def test_instances_grpc_lro_client(): def test_instances_grpc_lro_async_client(): client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + 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,) + 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 @@ -1771,8 +1934,13 @@ def test_instance_path(): service = "clam" version = "whelk" instance = "octopus" - expected = "apps/{app}/services/{service}/versions/{version}/instances/{instance}".format( - app=app, service=service, version=version, instance=instance, + 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 @@ -1814,7 +1982,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = InstancesClient.common_folder_path(folder) assert expected == actual @@ -1832,7 +2002,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = InstancesClient.common_organization_path(organization) assert expected == actual @@ -1850,7 +2022,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = InstancesClient.common_project_path(project) assert expected == actual @@ -1870,7 +2044,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = InstancesClient.common_location_path(project, location) assert expected == actual @@ -1895,7 +2070,8 @@ def test_client_with_default_client_info(): transports.InstancesTransport, "_prep_wrapped_messages" ) as prep: client = InstancesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1904,7 +2080,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = InstancesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1912,7 +2089,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = InstancesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index d5f34de..d87b511 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -88,7 +88,13 @@ def test__get_default_mtls_endpoint(): assert ServicesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ServicesClient, + ServicesAsyncClient, + ], +) def test_services_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -128,7 +134,13 @@ def test_services_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ServicesClient, ServicesAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ServicesClient, + ServicesAsyncClient, + ], +) def test_services_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -473,7 +485,9 @@ 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"],) + 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) @@ -605,10 +619,17 @@ def test_services_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [appengine.ListServicesRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -637,7 +658,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -653,7 +675,8 @@ async def test_list_services_async( transport: str = "grpc_asyncio", request_type=appengine.ListServicesRequest ): client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -664,7 +687,9 @@ async def test_list_services_async( 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",) + appengine.ListServicesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_services(request) @@ -684,7 +709,9 @@ async def test_list_services_async_from_dict(): def test_list_services_field_headers(): - client = ServicesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -704,12 +731,17 @@ def test_list_services_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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(),) + 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. @@ -731,12 +763,16 @@ async def test_list_services_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -744,15 +780,28 @@ def test_list_services_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( appengine.ListServicesResponse( - services=[service.Service(), service.Service(), service.Service(),], + 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", + services=[], + next_page_token="def", + ), + appengine.ListServicesResponse( + services=[ + service.Service(), + ], + next_page_token="ghi", ), appengine.ListServicesResponse( - services=[service.Service(), service.Service(),], + services=[ + service.Service(), + service.Service(), + ], ), RuntimeError, ) @@ -772,7 +821,8 @@ def test_list_services_pager(transport_name: str = "grpc"): def test_list_services_pages(transport_name: str = "grpc"): client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -780,15 +830,28 @@ def test_list_services_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( appengine.ListServicesResponse( - services=[service.Service(), service.Service(), service.Service(),], + 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", + services=[], + next_page_token="def", ), appengine.ListServicesResponse( - services=[service.Service(), service.Service(),], + services=[ + service.Service(), + ], + next_page_token="ghi", + ), + appengine.ListServicesResponse( + services=[ + service.Service(), + service.Service(), + ], ), RuntimeError, ) @@ -799,7 +862,9 @@ def test_list_services_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_services_async_pager(): - client = ServicesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ServicesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -808,19 +873,34 @@ async def test_list_services_async_pager(): # Set the response to a series of pages. call.side_effect = ( appengine.ListServicesResponse( - services=[service.Service(), service.Service(), service.Service(),], + 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", + services=[], + next_page_token="def", + ), + appengine.ListServicesResponse( + services=[ + service.Service(), + ], + next_page_token="ghi", ), appengine.ListServicesResponse( - services=[service.Service(), service.Service(),], + services=[ + service.Service(), + service.Service(), + ], ), RuntimeError, ) - async_pager = await client.list_services(request={},) + async_pager = await client.list_services( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -832,7 +912,9 @@ async def test_list_services_async_pager(): @pytest.mark.asyncio async def test_list_services_async_pages(): - client = ServicesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ServicesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -841,15 +923,28 @@ async def test_list_services_async_pages(): # Set the response to a series of pages. call.side_effect = ( appengine.ListServicesResponse( - services=[service.Service(), service.Service(), service.Service(),], + 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", + services=[], + next_page_token="def", + ), + appengine.ListServicesResponse( + services=[ + service.Service(), + ], + next_page_token="ghi", ), appengine.ListServicesResponse( - services=[service.Service(), service.Service(),], + services=[ + service.Service(), + service.Service(), + ], ), RuntimeError, ) @@ -860,10 +955,17 @@ async def test_list_services_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [appengine.GetServiceRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -873,7 +975,10 @@ def test_get_service(request_type, transport: str = "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: # Designate an appropriate return value for the call. - call.return_value = service.Service(name="name_value", id="id_value",) + 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. @@ -891,7 +996,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -907,7 +1013,8 @@ async def test_get_service_async( transport: str = "grpc_asyncio", request_type=appengine.GetServiceRequest ): client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -918,7 +1025,10 @@ async def test_get_service_async( 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",) + service.Service( + name="name_value", + id="id_value", + ) ) response = await client.get_service(request) @@ -939,7 +1049,9 @@ async def test_get_service_async_from_dict(): def test_get_service_field_headers(): - client = ServicesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -959,12 +1071,17 @@ def test_get_service_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -984,13 +1101,23 @@ async def test_get_service_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.UpdateServiceRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1016,7 +1143,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1032,7 +1160,8 @@ async def test_update_service_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateServiceRequest ): client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1062,7 +1191,9 @@ async def test_update_service_async_from_dict(): def test_update_service_field_headers(): - client = ServicesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1082,12 +1213,17 @@ def test_update_service_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1109,13 +1245,23 @@ async def test_update_service_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.DeleteServiceRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1141,7 +1287,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1157,7 +1304,8 @@ async def test_delete_service_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteServiceRequest ): client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1187,7 +1335,9 @@ async def test_delete_service_async_from_dict(): def test_delete_service_field_headers(): - client = ServicesClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1207,12 +1357,17 @@ def test_delete_service_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1234,7 +1389,10 @@ async def test_delete_service_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1244,7 +1402,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1264,7 +1423,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ServicesClient(client_options=options, transport=transport,) + client = ServicesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1280,7 +1442,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ServicesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1310,7 +1473,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport,], + [ + transports.ServicesGrpcTransport, + transports.ServicesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1322,8 +1488,13 @@ def test_transport_adc(transport_class): 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,) + client = ServicesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ServicesGrpcTransport, + ) def test_services_base_transport_error(): @@ -1376,7 +1547,8 @@ def test_services_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServicesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1419,7 +1591,10 @@ def test_services_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport,], + [ + transports.ServicesGrpcTransport, + transports.ServicesGrpcAsyncIOTransport, + ], ) def test_services_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1544,7 +1719,8 @@ def test_services_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ServicesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1556,7 +1732,8 @@ def test_services_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ServicesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1657,12 +1834,16 @@ def test_services_transport_channel_mtls_with_adc(transport_class): def test_services_grpc_lro_client(): client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + 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,) + 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 @@ -1670,12 +1851,16 @@ def test_services_grpc_lro_client(): def test_services_grpc_lro_async_client(): client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + 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,) + 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 @@ -1703,7 +1888,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ServicesClient.common_folder_path(folder) assert expected == actual @@ -1721,7 +1908,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ServicesClient.common_organization_path(organization) assert expected == actual @@ -1739,7 +1928,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ServicesClient.common_project_path(project) assert expected == actual @@ -1759,7 +1950,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ServicesClient.common_location_path(project, location) assert expected == actual @@ -1784,7 +1976,8 @@ def test_client_with_default_client_info(): transports.ServicesTransport, "_prep_wrapped_messages" ) as prep: client = ServicesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1793,7 +1986,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServicesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1801,7 +1995,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServicesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 77d13a3..a7950a6 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -91,7 +91,13 @@ def test__get_default_mtls_endpoint(): assert VersionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + VersionsClient, + VersionsAsyncClient, + ], +) def test_versions_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -131,7 +137,13 @@ def test_versions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + VersionsClient, + VersionsAsyncClient, + ], +) def test_versions_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -476,7 +488,9 @@ 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"],) + 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) @@ -608,10 +622,17 @@ def test_versions_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [appengine.ListVersionsRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -640,7 +661,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -656,7 +678,8 @@ async def test_list_versions_async( transport: str = "grpc_asyncio", request_type=appengine.ListVersionsRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -667,7 +690,9 @@ async def test_list_versions_async( 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",) + appengine.ListVersionsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_versions(request) @@ -687,7 +712,9 @@ async def test_list_versions_async_from_dict(): def test_list_versions_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -707,12 +734,17 @@ def test_list_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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(),) + 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. @@ -734,12 +766,16 @@ async def test_list_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -747,15 +783,28 @@ def test_list_versions_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + 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", + versions=[], + next_page_token="def", ), appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + appengine.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -775,7 +824,8 @@ def test_list_versions_pager(transport_name: str = "grpc"): def test_list_versions_pages(transport_name: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -783,15 +833,28 @@ def test_list_versions_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + 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", + versions=[], + next_page_token="def", + ), + appengine.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -802,7 +865,9 @@ def test_list_versions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_versions_async_pager(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -811,19 +876,34 @@ async def test_list_versions_async_pager(): # Set the response to a series of pages. call.side_effect = ( appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + 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", + versions=[], + next_page_token="def", ), appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + appengine.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) - async_pager = await client.list_versions(request={},) + async_pager = await client.list_versions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -835,7 +915,9 @@ async def test_list_versions_async_pager(): @pytest.mark.asyncio async def test_list_versions_async_pages(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -844,15 +926,28 @@ async def test_list_versions_async_pages(): # Set the response to a series of pages. call.side_effect = ( appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + 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", + versions=[], + next_page_token="def", ), appengine.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + appengine.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -863,10 +958,17 @@ async def test_list_versions_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [appengine.GetVersionRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -934,7 +1036,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -950,7 +1053,8 @@ async def test_get_version_async( transport: str = "grpc_asyncio", request_type=appengine.GetVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1019,7 +1123,9 @@ async def test_get_version_async_from_dict(): def test_get_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1039,12 +1145,17 @@ def test_get_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1064,13 +1175,23 @@ async def test_get_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.CreateVersionRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1096,7 +1217,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1112,7 +1234,8 @@ async def test_create_version_async( transport: str = "grpc_asyncio", request_type=appengine.CreateVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1142,7 +1265,9 @@ async def test_create_version_async_from_dict(): def test_create_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1162,12 +1287,17 @@ def test_create_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + 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(),) + 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. @@ -1189,13 +1319,23 @@ async def test_create_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.UpdateVersionRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1221,7 +1361,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1237,7 +1378,8 @@ async def test_update_version_async( transport: str = "grpc_asyncio", request_type=appengine.UpdateVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1267,7 +1409,9 @@ async def test_update_version_async_from_dict(): def test_update_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1287,12 +1431,17 @@ def test_update_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1314,13 +1463,23 @@ async def test_update_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [appengine.DeleteVersionRequest, dict,]) +@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, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1346,7 +1505,8 @@ 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", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1362,7 +1522,8 @@ async def test_delete_version_async( transport: str = "grpc_asyncio", request_type=appengine.DeleteVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1392,7 +1553,9 @@ async def test_delete_version_async_from_dict(): def test_delete_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + 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. @@ -1412,12 +1575,17 @@ def test_delete_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + 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(),) + 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. @@ -1439,7 +1607,10 @@ async def test_delete_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1449,7 +1620,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1469,7 +1641,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = VersionsClient(client_options=options, transport=transport,) + client = VersionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1485,7 +1660,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VersionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1515,7 +1691,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], + [ + transports.VersionsGrpcTransport, + transports.VersionsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1527,8 +1706,13 @@ def test_transport_adc(transport_class): 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,) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.VersionsGrpcTransport, + ) def test_versions_base_transport_error(): @@ -1582,7 +1766,8 @@ def test_versions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.VersionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1625,7 +1810,10 @@ def test_versions_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], + [ + transports.VersionsGrpcTransport, + transports.VersionsGrpcAsyncIOTransport, + ], ) def test_versions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1750,7 +1938,8 @@ def test_versions_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.VersionsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1762,7 +1951,8 @@ def test_versions_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.VersionsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1863,12 +2053,16 @@ def test_versions_transport_channel_mtls_with_adc(transport_class): def test_versions_grpc_lro_client(): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + 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,) + 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 @@ -1876,12 +2070,16 @@ def test_versions_grpc_lro_client(): def test_versions_grpc_lro_async_client(): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + 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,) + 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 @@ -1909,7 +2107,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = VersionsClient.common_folder_path(folder) assert expected == actual @@ -1927,7 +2127,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = VersionsClient.common_organization_path(organization) assert expected == actual @@ -1945,7 +2147,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = VersionsClient.common_project_path(project) assert expected == actual @@ -1965,7 +2169,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = VersionsClient.common_location_path(project, location) assert expected == actual @@ -1990,7 +2195,8 @@ def test_client_with_default_client_info(): transports.VersionsTransport, "_prep_wrapped_messages" ) as prep: client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1999,7 +2205,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = VersionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2007,7 +2214,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" From c9d15b04f3fbf3859de92d12404ebbe308dfc115 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 16:50:11 +0000 Subject: [PATCH 091/185] chore(python): add E231 to .flake8 ignore list (#119) Source-Link: https://github.com/googleapis/synthtool/commit/7ff4aad2ec5af0380e8bd6da1fa06eaadf24ec81 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 87dd006..9e0a935 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:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe + digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 From 3433e3c84545e4e6c001fa0fc137dc21c3d7fcda Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:16:11 +0000 Subject: [PATCH 092/185] chore(python): update .pre-commit-config.yaml to use black==22.3.0 (#120) Source-Link: https://github.com/googleapis/synthtool/commit/7804ade3daae0d66649bee8df6c55484c6580b8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d --- .github/.OwlBot.lock.yaml | 3 ++- .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9e0a935..22cc254 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:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 + digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d +# created: 2022-03-30T23:44:26.560599165Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 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: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 From 5ba6927bd0cf535baabf211686fd33ef81da7dbf Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 02:14:23 +0000 Subject: [PATCH 093/185] chore(python): Enable size-label bot (#121) Source-Link: https://github.com/googleapis/synthtool/commit/06e82790dd719a165ad32b8a06f8f6ec3e3cae0f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .github/auto-label.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 22cc254..58a0b15 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:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d -# created: 2022-03-30T23:44:26.560599165Z + digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce +# created: 2022-04-01T01:42:03.609279246Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..09c8d73 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,2 @@ +requestsize: + enabled: true From 72fbbb6267d64f3d5b6c448b03c5492720beea78 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:42:14 +0000 Subject: [PATCH 094/185] chore(python): refactor unit / system test dependency install (#122) Source-Link: https://github.com/googleapis/synthtool/commit/993985f0fc4b37152e588f0549bcbdaf34666023 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd --- .github/.OwlBot.lock.yaml | 4 +- noxfile.py | 105 ++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58a0b15..fa57622 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:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce -# created: 2022-04-01T01:42:03.609279246Z + digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd +# created: 2022-04-01T15:48:07.524222836Z diff --git a/noxfile.py b/noxfile.py index 3addb4e..6ee5e8a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,40 @@ import os import pathlib import shutil +import warnings import nox - BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "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 = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -81,23 +105,41 @@ def lint_setup_py(session): 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" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -121,6 +163,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + 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.""" @@ -143,13 +214,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: From 7f935c5e3c8ae627834d2d21aa7e6753984fe050 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 10:40:17 +0000 Subject: [PATCH 095/185] chore(python): add license header to auto-label.yaml (#124) Source-Link: https://github.com/googleapis/synthtool/commit/eb78c980b52c7c6746d2edb77d9cf7aaa99a2aab Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fa57622..bc893c9 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:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd -# created: 2022-04-01T15:48:07.524222836Z + digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 +# created: 2022-04-06T10:30:21.687684602Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 09c8d73..41bff0b 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,2 +1,15 @@ +# 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. requestsize: enabled: true From b0ce988cf7ec3620d6d586abab8b13de50e8b586 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 12 Apr 2022 23:42:11 +0000 Subject: [PATCH 096/185] chore: Use gapic-generator-python 0.65.0 (#127) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 440970084 Source-Link: https://github.com/googleapis/googleapis/commit/5e0a3d57254ab9857ccac77fc6ffade7b69a2dc7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b0c628a3fade768f225d76992791ea1ba2a881be Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9 docs: fix type in docstring for map fields --- .../services/applications/async_client.py | 5 +- .../services/applications/client.py | 5 +- .../services/applications/transports/base.py | 5 ++ .../services/applications/transports/grpc.py | 4 + .../authorized_certificates/async_client.py | 4 +- .../authorized_certificates/client.py | 4 +- .../transports/base.py | 5 ++ .../transports/grpc.py | 4 + .../authorized_domains/async_client.py | 3 +- .../services/authorized_domains/client.py | 3 +- .../authorized_domains/transports/base.py | 5 ++ .../authorized_domains/transports/grpc.py | 4 + .../services/domain_mappings/async_client.py | 5 +- .../services/domain_mappings/client.py | 5 +- .../domain_mappings/transports/base.py | 5 ++ .../domain_mappings/transports/grpc.py | 4 + .../services/firewall/async_client.py | 3 +- .../services/firewall/client.py | 3 +- .../services/firewall/transports/base.py | 5 ++ .../services/firewall/transports/grpc.py | 4 + .../services/instances/async_client.py | 5 +- .../services/instances/client.py | 5 +- .../services/instances/transports/base.py | 5 ++ .../services/instances/transports/grpc.py | 4 + .../services/services/async_client.py | 4 +- .../services/services/client.py | 4 +- .../services/services/transports/base.py | 5 ++ .../services/services/transports/grpc.py | 4 + .../services/versions/async_client.py | 4 +- .../services/versions/client.py | 4 +- .../services/versions/transports/base.py | 5 ++ .../services/versions/transports/grpc.py | 4 + .../appengine_admin_v1/types/__init__.py | 20 +++-- .../appengine_admin_v1/types/app_yaml.py | 2 +- .../cloud/appengine_admin_v1/types/deploy.py | 2 +- .../cloud/appengine_admin_v1/types/service.py | 2 +- .../cloud/appengine_admin_v1/types/version.py | 6 +- .../appengine_admin_v1/test_applications.py | 75 ++++++++++++---- .../test_authorized_certificates.py | 83 +++++++++++++----- .../test_authorized_domains.py | 85 ++++++++++++++----- .../test_domain_mappings.py | 81 +++++++++++++----- .../gapic/appengine_admin_v1/test_firewall.py | 81 +++++++++++++----- .../appengine_admin_v1/test_instances.py | 81 +++++++++++++----- .../gapic/appengine_admin_v1/test_services.py | 81 +++++++++++++----- .../gapic/appengine_admin_v1/test_versions.py | 81 +++++++++++++----- 45 files changed, 607 insertions(+), 211 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 2c7219d..56b440f 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -293,7 +293,6 @@ async def create_application( `Managing Projects, Applications, and Billing `__. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -380,7 +379,6 @@ async def update_application( - ``default_cookie_expiration`` - Cookie expiration policy for the application. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -477,7 +475,6 @@ async def repair_application( . If the deletion was recent, the numeric ID can be found in the Cloud Console Activity Log. - .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index 783cf86..a7639dd 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -500,7 +500,6 @@ def create_application( `Managing Projects, Applications, and Billing `__. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -588,7 +587,6 @@ def update_application( - ``default_cookie_expiration`` - Cookie expiration policy for the application. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -686,7 +684,6 @@ def repair_application( . If the deletion was recent, the numeric ID can be found in the Cloud Console Activity Log. - .. code-block:: python from google.cloud import appengine_admin_v1 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 b1d4942..646f4b5 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -199,5 +200,9 @@ def repair_application( ]: 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 index 3ce9450..cc65019 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -378,5 +378,9 @@ def 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/authorized_certificates/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_certificates/async_client.py index 38b1e00..ab172ac 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -219,7 +219,6 @@ async def list_authorized_certificates( r"""Lists all SSL certificates the user is authorized to administer. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -460,7 +459,6 @@ async def update_authorized_certificate( certificate. The certificate ``display_name`` may also be updated. - .. code-block:: python from google.cloud import appengine_admin_v1 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 b9e92c6..4ad2d1e 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,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -420,7 +420,6 @@ def list_authorized_certificates( r"""Lists all SSL certificates the user is authorized to administer. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -670,7 +669,6 @@ def update_authorized_certificate( certificate. The certificate ``display_name`` may also be updated. - .. code-block:: python from google.cloud import appengine_admin_v1 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 7a59eca..5a69af8 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 @@ -86,6 +86,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -219,5 +220,9 @@ def delete_authorized_certificate( ]: 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 index 3bc13d2..7601960 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 @@ -387,5 +387,9 @@ def 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_domains/async_client.py b/google/cloud/appengine_admin_v1/services/authorized_domains/async_client.py index 5a89294..ed3bd05 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -215,7 +215,6 @@ async def list_authorized_domains( r"""Lists all domains the user is authorized to administer. - .. code-block:: python from google.cloud import appengine_admin_v1 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 dd02522..23e7bbe 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,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -419,7 +419,6 @@ def list_authorized_domains( r"""Lists all domains the user is authorized to administer. - .. code-block:: python from google.cloud import appengine_admin_v1 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 fc9c28f..a1ba556 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 @@ -84,6 +84,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -152,5 +153,9 @@ def list_authorized_domains( ]: 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 index d4b381f..d240b77 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 @@ -262,5 +262,9 @@ def 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/domain_mappings/async_client.py b/google/cloud/appengine_admin_v1/services/domain_mappings/async_client.py index 65786df..f7f3838 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -374,7 +374,6 @@ async def create_domain_mapping( list of available authorized domains, see ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -466,7 +465,6 @@ async def update_domain_mapping( administer the associated domain in order to update a ``DomainMapping`` resource. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -556,7 +554,6 @@ async def delete_domain_mapping( to administer the associated domain in order to delete a ``DomainMapping`` resource. - .. code-block:: python from google.cloud import appengine_admin_v1 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 8a4f006..74d81ae 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,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -580,7 +580,6 @@ def create_domain_mapping( list of available authorized domains, see ```AuthorizedDomains.ListAuthorizedDomains`` <>`__. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -673,7 +672,6 @@ def update_domain_mapping( administer the associated domain in order to update a ``DomainMapping`` resource. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -764,7 +762,6 @@ def delete_domain_mapping( to administer the associated domain in order to delete a ``DomainMapping`` resource. - .. code-block:: python from google.cloud import appengine_admin_v1 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 6df59f0..8732532 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 @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -216,5 +217,9 @@ def delete_domain_mapping( ]: 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 index aaaba25..368a4ed 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 @@ -389,5 +389,9 @@ def 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/firewall/async_client.py b/google/cloud/appengine_admin_v1/services/firewall/async_client.py index a0ef328..45508d8 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -304,7 +304,6 @@ async def batch_update_ingress_rules( IP range, then an "allow all" rule is explicitly added to the end of the list. - .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/firewall/client.py b/google/cloud/appengine_admin_v1/services/firewall/client.py index 98b409b..f9a4604 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -515,7 +515,6 @@ def batch_update_ingress_rules( IP range, then an "allow all" rule is explicitly added to the end of the list. - .. code-block:: python from google.cloud import appengine_admin_v1 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 b1507ae..1a5df11 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/base.py @@ -86,6 +86,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -227,5 +228,9 @@ def delete_ingress_rule( ]: 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 index 6670bd6..259d8ab 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/firewall/transports/grpc.py @@ -409,5 +409,9 @@ def 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/instances/async_client.py b/google/cloud/appengine_admin_v1/services/instances/async_client.py index 6f4d0cd..4108316 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -216,7 +216,6 @@ async def list_instances( `Stackdriver Monitoring API `__. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -388,7 +387,6 @@ async def delete_instance( ```apps.services.versions.patch`` `__ method. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -495,7 +493,6 @@ async def debug_instance( Only applicable for instances in App Engine flexible environment. - .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/instances/client.py b/google/cloud/appengine_admin_v1/services/instances/client.py index e462f2a..0cfc8bb 100644 --- a/google/cloud/appengine_admin_v1/services/instances/client.py +++ b/google/cloud/appengine_admin_v1/services/instances/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -446,7 +446,6 @@ def list_instances( `Stackdriver Monitoring API `__. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -620,7 +619,6 @@ def delete_instance( ```apps.services.versions.patch`` `__ method. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -728,7 +726,6 @@ def debug_instance( Only applicable for instances in App Engine flexible environment. - .. code-block:: python from google.cloud import appengine_admin_v1 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 fd37b2b..05142c4 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -201,5 +202,9 @@ def debug_instance( ]: 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 index 3449a91..65243b6 100644 --- a/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/instances/transports/grpc.py @@ -379,5 +379,9 @@ def 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/services/async_client.py b/google/cloud/appengine_admin_v1/services/services/async_client.py index 6109f9d..c73da6d 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -293,7 +293,6 @@ async def get_service( r"""Gets the current configuration of the specified service. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -470,7 +469,6 @@ async def delete_service( r"""Deletes the specified service and all enclosed versions. - .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/services/client.py b/google/cloud/appengine_admin_v1/services/services/client.py index 036ec01..fc289ad 100644 --- a/google/cloud/appengine_admin_v1/services/services/client.py +++ b/google/cloud/appengine_admin_v1/services/services/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -504,7 +504,6 @@ def get_service( r"""Gets the current configuration of the specified service. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -683,7 +682,6 @@ def delete_service( r"""Deletes the specified service and all enclosed versions. - .. code-block:: python from google.cloud import appengine_admin_v1 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 2f8893a..5d763b4 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -201,5 +202,9 @@ def delete_service( ]: 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 index c10664e..31bd346 100644 --- a/google/cloud/appengine_admin_v1/services/services/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/services/transports/grpc.py @@ -352,5 +352,9 @@ def 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/versions/async_client.py b/google/cloud/appengine_admin_v1/services/versions/async_client.py index ec8ed93..3265a5a 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,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -297,7 +297,6 @@ async def get_version( ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` parameter to get the full resource. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -492,7 +491,6 @@ async def update_version( - ```manual_scaling.instances`` `__ - .. code-block:: python from google.cloud import appengine_admin_v1 diff --git a/google/cloud/appengine_admin_v1/services/versions/client.py b/google/cloud/appengine_admin_v1/services/versions/client.py index 3c77a02..297e033 100644 --- a/google/cloud/appengine_admin_v1/services/versions/client.py +++ b/google/cloud/appengine_admin_v1/services/versions/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -508,7 +508,6 @@ def get_version( ``BASIC_VIEW`` will be returned. Specify the ``FULL_VIEW`` parameter to get the full resource. - .. code-block:: python from google.cloud import appengine_admin_v1 @@ -705,7 +704,6 @@ def update_version( - ```manual_scaling.instances`` `__ - .. code-block:: python from google.cloud import appengine_admin_v1 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 0b17c61..1ccc203 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/base.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -215,5 +216,9 @@ def delete_version( ]: 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 index 10b8ba4..2b94752 100644 --- a/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/versions/transports/grpc.py @@ -413,5 +413,9 @@ def 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/types/__init__.py b/google/cloud/appengine_admin_v1/types/__init__.py index 0af6953..92e52a7 100644 --- a/google/cloud/appengine_admin_v1/types/__init__.py +++ b/google/cloud/appengine_admin_v1/types/__init__.py @@ -97,16 +97,26 @@ FileInfo, ZipInfo, ) -from .domain import AuthorizedDomain +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 .firewall import ( + FirewallRule, +) +from .instance import ( + Instance, +) +from .location import ( + LocationMetadata, +) +from .network_settings import ( + NetworkSettings, +) from .operation import ( CreateVersionMetadataV1, OperationMetadataV1, diff --git a/google/cloud/appengine_admin_v1/types/app_yaml.py b/google/cloud/appengine_admin_v1/types/app_yaml.py index 619e12e..e2c84db 100644 --- a/google/cloud/appengine_admin_v1/types/app_yaml.py +++ b/google/cloud/appengine_admin_v1/types/app_yaml.py @@ -265,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 (Sequence[google.cloud.appengine_admin_v1.types.StaticFilesHandler.HttpHeadersEntry]): + http_headers (Mapping[str, str]): HTTP headers to use for all responses from these URLs. mime_type (str): diff --git a/google/cloud/appengine_admin_v1/types/deploy.py b/google/cloud/appengine_admin_v1/types/deploy.py index e195347..857564e 100644 --- a/google/cloud/appengine_admin_v1/types/deploy.py +++ b/google/cloud/appengine_admin_v1/types/deploy.py @@ -35,7 +35,7 @@ class Deployment(proto.Message): App Engine. Attributes: - files (Sequence[google.cloud.appengine_admin_v1.types.Deployment.FilesEntry]): + files (Mapping[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 diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index 0b273ac..77e2608 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -90,7 +90,7 @@ class TrafficSplit(proto.Message): request is sent to. The traffic selection algorithm will be stable for either type until allocations are changed. - allocations (Sequence[google.cloud.appengine_admin_v1.types.TrafficSplit.AllocationsEntry]): + allocations (Mapping[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 diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 19070f1..7ea3028 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -148,7 +148,7 @@ class Version(proto.Message): vm (bool): Whether to deploy this version in a container on a virtual machine. - beta_settings (Sequence[google.cloud.appengine_admin_v1.types.Version.BetaSettingsEntry]): + beta_settings (Mapping[str, str]): Metadata settings that are supplied to this version to enable beta runtime features. env (str): @@ -208,11 +208,11 @@ class Version(proto.Message): Endpoints `__. Only returned in ``GET`` requests if ``view=FULL`` is set. - env_variables (Sequence[google.cloud.appengine_admin_v1.types.Version.EnvVariablesEntry]): + env_variables (Mapping[str, str]): Environment variables available to the application. Only returned in ``GET`` requests if ``view=FULL`` is set. - build_env_variables (Sequence[google.cloud.appengine_admin_v1.types.Version.BuildEnvVariablesEntry]): + build_env_variables (Mapping[str, str]): Environment variables available to the build environment. Only returned in ``GET`` requests if ``view=FULL`` is set. diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 4437c0a..8fa343a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -92,24 +92,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ApplicationsClient, - ApplicationsAsyncClient, + (ApplicationsClient, "grpc"), + (ApplicationsAsyncClient, "grpc_asyncio"), ], ) -def test_applications_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -138,27 +138,31 @@ def test_applications_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ApplicationsClient, - ApplicationsAsyncClient, + (ApplicationsClient, "grpc"), + (ApplicationsAsyncClient, "grpc_asyncio"), ], ) -def test_applications_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_applications_client_get_transport_class(): @@ -1320,6 +1324,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1370,6 +1387,14 @@ def test_applications_base_transport(): 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 @@ -1528,24 +1553,40 @@ def test_applications_grpc_transport_client_cert_source_for_mtls(transport_class ) -def test_applications_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_applications_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_applications_grpc_transport_channel(): 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 200b8ca..ad07779 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -93,24 +93,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - AuthorizedCertificatesClient, - AuthorizedCertificatesAsyncClient, + (AuthorizedCertificatesClient, "grpc"), + (AuthorizedCertificatesAsyncClient, "grpc_asyncio"), ], ) -def test_authorized_certificates_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -139,27 +141,33 @@ def test_authorized_certificates_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - AuthorizedCertificatesClient, - AuthorizedCertificatesAsyncClient, + (AuthorizedCertificatesClient, "grpc"), + (AuthorizedCertificatesAsyncClient, "grpc_asyncio"), ], ) -def test_authorized_certificates_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_authorized_certificates_client_get_transport_class(): @@ -972,7 +980,7 @@ async def test_list_authorized_certificates_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1022,7 +1030,7 @@ async def test_list_authorized_certificates_async_pages(): pages = [] async for page_ in ( await client.list_authorized_certificates(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1813,6 +1821,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1859,6 +1880,14 @@ def test_authorized_certificates_base_transport(): 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 @@ -2024,24 +2053,40 @@ def test_authorized_certificates_grpc_transport_client_cert_source_for_mtls( ) -def test_authorized_certificates_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_authorized_certificates_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_authorized_certificates_grpc_transport_channel(): 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 bb5b38a..728aef6 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -91,24 +91,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - AuthorizedDomainsClient, - AuthorizedDomainsAsyncClient, + (AuthorizedDomainsClient, "grpc"), + (AuthorizedDomainsAsyncClient, "grpc_asyncio"), ], ) -def test_authorized_domains_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -137,27 +139,33 @@ def test_authorized_domains_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - AuthorizedDomainsClient, - AuthorizedDomainsAsyncClient, + (AuthorizedDomainsClient, "grpc"), + (AuthorizedDomainsAsyncClient, "grpc_asyncio"), ], ) -def test_authorized_domains_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_authorized_domains_client_get_transport_class(): @@ -961,7 +969,7 @@ async def test_list_authorized_domains_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1009,7 +1017,9 @@ async def test_list_authorized_domains_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_authorized_domains(request={})).pages: + async for page_ in ( + await client.list_authorized_domains(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1106,6 +1116,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1146,6 +1169,14 @@ def test_authorized_domains_base_transport(): 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 @@ -1307,24 +1338,40 @@ def test_authorized_domains_grpc_transport_client_cert_source_for_mtls(transport ) -def test_authorized_domains_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_authorized_domains_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_authorized_domains_grpc_transport_channel(): 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 c590dea..3ca570d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -97,24 +97,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - DomainMappingsClient, - DomainMappingsAsyncClient, + (DomainMappingsClient, "grpc"), + (DomainMappingsAsyncClient, "grpc_asyncio"), ], ) -def test_domain_mappings_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -143,27 +143,31 @@ def test_domain_mappings_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - DomainMappingsClient, - DomainMappingsAsyncClient, + (DomainMappingsClient, "grpc"), + (DomainMappingsAsyncClient, "grpc_asyncio"), ], ) -def test_domain_mappings_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_domain_mappings_client_get_transport_class(): @@ -957,7 +961,7 @@ async def test_list_domain_mappings_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1005,7 +1009,9 @@ async def test_list_domain_mappings_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_domain_mappings(request={})).pages: + async for page_ in ( + await client.list_domain_mappings(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1728,6 +1734,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1779,6 +1798,14 @@ def test_domain_mappings_base_transport(): 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 @@ -1940,24 +1967,40 @@ def test_domain_mappings_grpc_transport_client_cert_source_for_mtls(transport_cl ) -def test_domain_mappings_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_domain_mappings_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_domain_mappings_grpc_transport_channel(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 74a2118..19a09af 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -82,24 +82,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - FirewallClient, - FirewallAsyncClient, + (FirewallClient, "grpc"), + (FirewallAsyncClient, "grpc_asyncio"), ], ) -def test_firewall_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -128,27 +128,31 @@ def test_firewall_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - FirewallClient, - FirewallAsyncClient, + (FirewallClient, "grpc"), + (FirewallAsyncClient, "grpc_asyncio"), ], ) -def test_firewall_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_firewall_client_get_transport_class(): @@ -912,7 +916,7 @@ async def test_list_ingress_rules_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -960,7 +964,9 @@ async def test_list_ingress_rules_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_ingress_rules(request={})).pages: + async for page_ in ( + await client.list_ingress_rules(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1868,6 +1874,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1915,6 +1934,14 @@ def test_firewall_base_transport(): 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 @@ -2073,24 +2100,40 @@ def test_firewall_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_firewall_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_firewall_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_firewall_grpc_transport_channel(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 25e066a..0a2ab1d 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -88,24 +88,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - InstancesClient, - InstancesAsyncClient, + (InstancesClient, "grpc"), + (InstancesAsyncClient, "grpc_asyncio"), ], ) -def test_instances_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -134,27 +134,31 @@ def test_instances_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - InstancesClient, - InstancesAsyncClient, + (InstancesClient, "grpc"), + (InstancesAsyncClient, "grpc_asyncio"), ], ) -def test_instances_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_instances_client_get_transport_class(): @@ -910,7 +914,7 @@ async def test_list_instances_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -956,7 +960,9 @@ async def test_list_instances_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_instances(request={})).pages: + async for page_ in ( + await client.list_instances(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1549,6 +1555,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1599,6 +1618,14 @@ def test_instances_base_transport(): 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 @@ -1757,24 +1784,40 @@ def test_instances_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_instances_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_instances_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_instances_grpc_transport_channel(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index d87b511..361eee1 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -89,24 +89,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ServicesClient, - ServicesAsyncClient, + (ServicesClient, "grpc"), + (ServicesAsyncClient, "grpc_asyncio"), ], ) -def test_services_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -135,27 +135,31 @@ def test_services_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ServicesClient, - ServicesAsyncClient, + (ServicesClient, "grpc"), + (ServicesAsyncClient, "grpc_asyncio"), ], ) -def test_services_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_services_client_get_transport_class(): @@ -903,7 +907,7 @@ async def test_list_services_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -949,7 +953,9 @@ async def test_list_services_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_services(request={})).pages: + async for page_ in ( + await client.list_services(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1486,6 +1492,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1536,6 +1555,14 @@ def test_services_base_transport(): 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 @@ -1694,24 +1721,40 @@ def test_services_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_services_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_services_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_services_grpc_transport_channel(): diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index a7950a6..4b5a631 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -92,24 +92,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - VersionsClient, - VersionsAsyncClient, + (VersionsClient, "grpc"), + (VersionsAsyncClient, "grpc_asyncio"), ], ) -def test_versions_client_from_service_account_info(client_class): +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) + 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" + assert client.transport._host == ("appengine.googleapis.com:443") @pytest.mark.parametrize( @@ -138,27 +138,31 @@ def test_versions_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - VersionsClient, - VersionsAsyncClient, + (VersionsClient, "grpc"), + (VersionsAsyncClient, "grpc_asyncio"), ], ) -def test_versions_client_from_service_account_file(client_class): +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") + 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") + 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" + assert client.transport._host == ("appengine.googleapis.com:443") def test_versions_client_get_transport_class(): @@ -906,7 +910,7 @@ async def test_list_versions_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -952,7 +956,9 @@ async def test_list_versions_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_versions(request={})).pages: + async for page_ in ( + await client.list_versions(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1704,6 +1710,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +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( @@ -1755,6 +1774,14 @@ def test_versions_base_transport(): 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 @@ -1913,24 +1940,40 @@ def test_versions_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_versions_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:443") -def test_versions_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +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" + assert client.transport._host == ("appengine.googleapis.com:8000") def test_versions_grpc_transport_channel(): From 798753445f9c60cc4b352d8173c5a075232abee1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 13 Apr 2022 20:10:16 -0400 Subject: [PATCH 097/185] chore: use gapic-generator-python 0.65.1 (#129) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.1 PiperOrigin-RevId: 441524537 Source-Link: https://github.com/googleapis/googleapis/commit/2a273915b3f70fe86c9d2a75470a0b83e48d0abf Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 * 🦉 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 --- .../snippet_metadata_appengine admin_v1.json | 2454 ++++++++++++++++- 1 file changed, 2318 insertions(+), 136 deletions(-) diff --git a/samples/generated_samples/snippet_metadata_appengine admin_v1.json b/samples/generated_samples/snippet_metadata_appengine admin_v1.json index 445ed92..7d498a2 100644 --- a/samples/generated_samples/snippet_metadata_appengine admin_v1.json +++ b/samples/generated_samples/snippet_metadata_appengine admin_v1.json @@ -1,16 +1,57 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.appengine.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-appengine-admin" + }, "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": [ { @@ -43,18 +84,50 @@ "start": 45, "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": [ { @@ -87,19 +160,51 @@ "start": 45, "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": "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": [ { @@ -132,18 +237,50 @@ "start": 41, "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": "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": [ { @@ -176,19 +313,51 @@ "start": 41, "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": [ { @@ -221,18 +390,50 @@ "start": 45, "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": [ { @@ -265,19 +466,51 @@ "start": 45, "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": [ { @@ -310,18 +543,50 @@ "start": 45, "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": [ { @@ -354,19 +619,51 @@ "start": 45, "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": [ { @@ -399,18 +696,50 @@ "start": 41, "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": [ { @@ -443,19 +772,50 @@ "start": 41, "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": [ { @@ -486,18 +846,49 @@ "end": 42, "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": [ { @@ -528,19 +919,51 @@ "end": 42, "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": [ { @@ -573,18 +996,50 @@ "start": 41, "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": [ { @@ -617,19 +1072,51 @@ "start": 41, "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": [ { @@ -662,18 +1149,50 @@ "start": 41, "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": [ { @@ -706,19 +1225,51 @@ "start": 41, "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": [ { @@ -751,18 +1302,50 @@ "start": 41, "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": [ { @@ -795,19 +1378,51 @@ "start": 41, "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": [ { @@ -840,18 +1455,50 @@ "start": 41, "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": [ { @@ -884,19 +1531,51 @@ "start": 41, "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": [ { @@ -929,18 +1608,50 @@ "start": 45, "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": [ { @@ -973,19 +1684,51 @@ "start": 45, "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": [ { @@ -1018,18 +1761,50 @@ "start": 45, "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": [ { @@ -1062,19 +1837,51 @@ "start": 45, "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": [ { @@ -1107,18 +1914,50 @@ "start": 41, "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": [ { @@ -1151,19 +1990,51 @@ "start": 41, "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": [ { @@ -1196,18 +2067,50 @@ "start": 41, "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": [ { @@ -1240,19 +2143,51 @@ "start": 41, "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": [ { @@ -1285,18 +2220,50 @@ "start": 45, "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": [ { @@ -1329,19 +2296,51 @@ "start": 45, "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": [ { @@ -1374,18 +2373,50 @@ "start": 41, "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": [ { @@ -1418,19 +2449,51 @@ "start": 41, "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": [ { @@ -1463,18 +2526,50 @@ "start": 41, "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": [ { @@ -1507,19 +2602,50 @@ "start": 41, "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": [ { @@ -1550,18 +2676,49 @@ "end": 42, "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": [ { @@ -1592,19 +2749,51 @@ "end": 42, "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": [ { @@ -1637,18 +2826,50 @@ "start": 41, "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": [ { @@ -1681,19 +2902,51 @@ "start": 41, "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": [ { @@ -1726,18 +2979,50 @@ "start": 41, "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": [ { @@ -1770,19 +3055,51 @@ "start": 41, "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": [ { @@ -1815,18 +3132,50 @@ "start": 41, "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": [ { @@ -1859,19 +3208,51 @@ "start": 41, "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": [ { @@ -1904,18 +3285,50 @@ "start": 45, "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": [ { @@ -1948,19 +3361,51 @@ "start": 45, "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": [ { @@ -1993,18 +3438,50 @@ "start": 45, "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": [ { @@ -2037,19 +3514,51 @@ "start": 45, "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": [ { @@ -2082,18 +3591,50 @@ "start": 41, "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": [ { @@ -2126,19 +3667,51 @@ "start": 41, "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": [ { @@ -2171,18 +3744,50 @@ "start": 41, "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": [ { @@ -2215,19 +3820,51 @@ "start": 41, "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": [ { @@ -2260,18 +3897,50 @@ "start": 45, "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": [ { @@ -2304,19 +3973,51 @@ "start": 45, "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": [ { @@ -2349,18 +4050,50 @@ "start": 41, "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": [ { @@ -2393,19 +4126,51 @@ "start": 41, "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": [ { @@ -2438,18 +4203,50 @@ "start": 41, "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": [ { @@ -2482,19 +4279,51 @@ "start": 41, "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": [ { @@ -2527,18 +4356,50 @@ "start": 45, "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": [ { @@ -2571,19 +4432,51 @@ "start": 45, "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": [ { @@ -2616,18 +4509,50 @@ "start": 45, "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": [ { @@ -2660,19 +4585,51 @@ "start": 45, "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": [ { @@ -2705,18 +4662,50 @@ "start": 45, "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": [ { @@ -2749,19 +4738,51 @@ "start": 45, "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": [ { @@ -2794,18 +4815,50 @@ "start": 41, "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": [ { @@ -2838,19 +4891,51 @@ "start": 41, "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": [ { @@ -2883,18 +4968,50 @@ "start": 41, "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": [ { @@ -2927,19 +5044,51 @@ "start": 41, "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": [ { @@ -2972,18 +5121,50 @@ "start": 45, "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": [ { @@ -3016,7 +5197,8 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "appengine_v1_generated_versions_update_version_sync.py" } ] } From bfda88a111c8a33e25090fa1bbb3128f04984d52 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 11:58:14 -0700 Subject: [PATCH 098/185] chore(main): release 1.3.3 (#128) 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 0db5d77..08cb000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [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) diff --git a/setup.py b/setup.py index 4dcb351..c82e031 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.3.2" +version = "1.3.3" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 34b0e2d1e8d1b3a1ba3d21dcfe053acbe7ef0b07 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 20:11:56 -0400 Subject: [PATCH 099/185] chore(python): add nox session to sort python imports (#130) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- noxfile.py | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index bc893c9..7c454ab 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:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 -# created: 2022-04-06T10:30:21.687684602Z + digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 +# created: 2022-04-20T23:42:53.970438194Z diff --git a/noxfile.py b/noxfile.py index 6ee5e8a..92da31f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -25,7 +25,8 @@ import nox BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -83,7 +84,7 @@ def lint(session): session.run( "black", "--check", - *BLACK_PATHS, + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -94,7 +95,27 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *BLACK_PATHS, + *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, ) From 8eec073e8d010ba3cc3e17f5e3a104054fbf9292 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 16:12:34 +0000 Subject: [PATCH 100/185] chore(python): use ubuntu 22.04 in docs image (#132) Source-Link: https://github.com/googleapis/synthtool/commit/f15cc72fb401b4861cedebb10af74afe428fb1f8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/docker/docs/Dockerfile | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7c454ab..64f82d6 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:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 -# created: 2022-04-20T23:42:53.970438194Z + digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd +# created: 2022-04-21T15:43:16.246106921Z diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] From 25708b6ac402675d809a138ddba1b9b87b339af1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Apr 2022 09:41:22 -0400 Subject: [PATCH 101/185] chore: use gapic-generator-python 0.65.2 (#133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.2 PiperOrigin-RevId: 444333013 Source-Link: https://github.com/googleapis/googleapis/commit/f91b6cf82e929280f6562f6110957c654bd9e2e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/16eb36095c294e712c74a1bf23550817b42174e5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9 * 🦉 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 | 24 ++++----- .../authorized_certificates/async_client.py | 30 +++++------ .../authorized_domains/async_client.py | 6 +-- .../services/domain_mappings/async_client.py | 30 +++++------ .../services/firewall/async_client.py | 36 ++++++------- .../services/instances/async_client.py | 24 ++++----- .../services/services/async_client.py | 24 ++++----- .../services/versions/async_client.py | 30 +++++------ .../appengine_admin_v1/test_applications.py | 24 ++++----- .../test_authorized_certificates.py | 42 ++++++++-------- .../test_authorized_domains.py | 10 ++-- .../test_domain_mappings.py | 42 ++++++++-------- .../gapic/appengine_admin_v1/test_firewall.py | 50 +++++++++---------- .../appengine_admin_v1/test_instances.py | 34 ++++++------- .../gapic/appengine_admin_v1/test_services.py | 34 ++++++------- .../gapic/appengine_admin_v1/test_versions.py | 42 ++++++++-------- 16 files changed, 241 insertions(+), 241 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 56b440f..c3f55de 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -214,16 +214,16 @@ async def get_application( from google.cloud import appengine_admin_v1 - def sample_get_application(): + async def sample_get_application(): # Create a client - client = appengine_admin_v1.ApplicationsClient() + client = appengine_admin_v1.ApplicationsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.GetApplicationRequest( ) # Make the request - response = client.get_application(request=request) + response = await client.get_application(request=request) # Handle the response print(response) @@ -297,9 +297,9 @@ async def create_application( from google.cloud import appengine_admin_v1 - def sample_create_application(): + async def sample_create_application(): # Create a client - client = appengine_admin_v1.ApplicationsClient() + client = appengine_admin_v1.ApplicationsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.CreateApplicationRequest( @@ -310,7 +310,7 @@ def sample_create_application(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -383,9 +383,9 @@ async def update_application( from google.cloud import appengine_admin_v1 - def sample_update_application(): + async def sample_update_application(): # Create a client - client = appengine_admin_v1.ApplicationsClient() + client = appengine_admin_v1.ApplicationsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.UpdateApplicationRequest( @@ -396,7 +396,7 @@ def sample_update_application(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -479,9 +479,9 @@ async def repair_application( from google.cloud import appengine_admin_v1 - def sample_repair_application(): + async def sample_repair_application(): # Create a client - client = appengine_admin_v1.ApplicationsClient() + client = appengine_admin_v1.ApplicationsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.RepairApplicationRequest( @@ -492,7 +492,7 @@ def sample_repair_application(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) 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 ab172ac..4a3c010 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 @@ -223,9 +223,9 @@ async def list_authorized_certificates( from google.cloud import appengine_admin_v1 - def sample_list_authorized_certificates(): + async def sample_list_authorized_certificates(): # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() + client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.ListAuthorizedCertificatesRequest( @@ -235,7 +235,7 @@ def sample_list_authorized_certificates(): page_result = client.list_authorized_certificates(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -308,16 +308,16 @@ async def get_authorized_certificate( from google.cloud import appengine_admin_v1 - def sample_get_authorized_certificate(): + async def sample_get_authorized_certificate(): # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() + client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.GetAuthorizedCertificateRequest( ) # Make the request - response = client.get_authorized_certificate(request=request) + response = await client.get_authorized_certificate(request=request) # Handle the response print(response) @@ -383,16 +383,16 @@ async def create_authorized_certificate( from google.cloud import appengine_admin_v1 - def sample_create_authorized_certificate(): + async def sample_create_authorized_certificate(): # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() + client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.CreateAuthorizedCertificateRequest( ) # Make the request - response = client.create_authorized_certificate(request=request) + response = await client.create_authorized_certificate(request=request) # Handle the response print(response) @@ -463,16 +463,16 @@ async def update_authorized_certificate( from google.cloud import appengine_admin_v1 - def sample_update_authorized_certificate(): + async def sample_update_authorized_certificate(): # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() + client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.UpdateAuthorizedCertificateRequest( ) # Make the request - response = client.update_authorized_certificate(request=request) + response = await client.update_authorized_certificate(request=request) # Handle the response print(response) @@ -538,16 +538,16 @@ async def delete_authorized_certificate( from google.cloud import appengine_admin_v1 - def sample_delete_authorized_certificate(): + async def sample_delete_authorized_certificate(): # Create a client - client = appengine_admin_v1.AuthorizedCertificatesClient() + client = appengine_admin_v1.AuthorizedCertificatesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.DeleteAuthorizedCertificateRequest( ) # Make the request - client.delete_authorized_certificate(request=request) + await client.delete_authorized_certificate(request=request) Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteAuthorizedCertificateRequest, dict]): 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 ed3bd05..5b79bb6 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 @@ -219,9 +219,9 @@ async def list_authorized_domains( from google.cloud import appengine_admin_v1 - def sample_list_authorized_domains(): + async def sample_list_authorized_domains(): # Create a client - client = appengine_admin_v1.AuthorizedDomainsClient() + client = appengine_admin_v1.AuthorizedDomainsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.ListAuthorizedDomainsRequest( @@ -231,7 +231,7 @@ def sample_list_authorized_domains(): page_result = client.list_authorized_domains(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: 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 f7f3838..69c656a 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 @@ -219,9 +219,9 @@ async def list_domain_mappings( from google.cloud import appengine_admin_v1 - def sample_list_domain_mappings(): + async def sample_list_domain_mappings(): # Create a client - client = appengine_admin_v1.DomainMappingsClient() + client = appengine_admin_v1.DomainMappingsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.ListDomainMappingsRequest( @@ -231,7 +231,7 @@ def sample_list_domain_mappings(): page_result = client.list_domain_mappings(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -303,16 +303,16 @@ async def get_domain_mapping( from google.cloud import appengine_admin_v1 - def sample_get_domain_mapping(): + async def sample_get_domain_mapping(): # Create a client - client = appengine_admin_v1.DomainMappingsClient() + client = appengine_admin_v1.DomainMappingsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.GetDomainMappingRequest( ) # Make the request - response = client.get_domain_mapping(request=request) + response = await client.get_domain_mapping(request=request) # Handle the response print(response) @@ -378,9 +378,9 @@ async def create_domain_mapping( from google.cloud import appengine_admin_v1 - def sample_create_domain_mapping(): + async def sample_create_domain_mapping(): # Create a client - client = appengine_admin_v1.DomainMappingsClient() + client = appengine_admin_v1.DomainMappingsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.CreateDomainMappingRequest( @@ -391,7 +391,7 @@ def sample_create_domain_mapping(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -469,9 +469,9 @@ async def update_domain_mapping( from google.cloud import appengine_admin_v1 - def sample_update_domain_mapping(): + async def sample_update_domain_mapping(): # Create a client - client = appengine_admin_v1.DomainMappingsClient() + client = appengine_admin_v1.DomainMappingsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.UpdateDomainMappingRequest( @@ -482,7 +482,7 @@ def sample_update_domain_mapping(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -558,9 +558,9 @@ async def delete_domain_mapping( from google.cloud import appengine_admin_v1 - def sample_delete_domain_mapping(): + async def sample_delete_domain_mapping(): # Create a client - client = appengine_admin_v1.DomainMappingsClient() + client = appengine_admin_v1.DomainMappingsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.DeleteDomainMappingRequest( @@ -571,7 +571,7 @@ def sample_delete_domain_mapping(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) 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 45508d8..eb65073 100644 --- a/google/cloud/appengine_admin_v1/services/firewall/async_client.py +++ b/google/cloud/appengine_admin_v1/services/firewall/async_client.py @@ -218,9 +218,9 @@ async def list_ingress_rules( from google.cloud import appengine_admin_v1 - def sample_list_ingress_rules(): + async def sample_list_ingress_rules(): # Create a client - client = appengine_admin_v1.FirewallClient() + client = appengine_admin_v1.FirewallAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.ListIngressRulesRequest( @@ -230,7 +230,7 @@ def sample_list_ingress_rules(): page_result = client.list_ingress_rules(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -308,16 +308,16 @@ async def batch_update_ingress_rules( from google.cloud import appengine_admin_v1 - def sample_batch_update_ingress_rules(): + async def sample_batch_update_ingress_rules(): # Create a client - client = appengine_admin_v1.FirewallClient() + client = appengine_admin_v1.FirewallAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.BatchUpdateIngressRulesRequest( ) # Make the request - response = client.batch_update_ingress_rules(request=request) + response = await client.batch_update_ingress_rules(request=request) # Handle the response print(response) @@ -378,16 +378,16 @@ async def create_ingress_rule( from google.cloud import appengine_admin_v1 - def sample_create_ingress_rule(): + async def sample_create_ingress_rule(): # Create a client - client = appengine_admin_v1.FirewallClient() + client = appengine_admin_v1.FirewallAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.CreateIngressRuleRequest( ) # Make the request - response = client.create_ingress_rule(request=request) + response = await client.create_ingress_rule(request=request) # Handle the response print(response) @@ -452,16 +452,16 @@ async def get_ingress_rule( from google.cloud import appengine_admin_v1 - def sample_get_ingress_rule(): + async def sample_get_ingress_rule(): # Create a client - client = appengine_admin_v1.FirewallClient() + client = appengine_admin_v1.FirewallAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.GetIngressRuleRequest( ) # Make the request - response = client.get_ingress_rule(request=request) + response = await client.get_ingress_rule(request=request) # Handle the response print(response) @@ -526,16 +526,16 @@ async def update_ingress_rule( from google.cloud import appengine_admin_v1 - def sample_update_ingress_rule(): + async def sample_update_ingress_rule(): # Create a client - client = appengine_admin_v1.FirewallClient() + client = appengine_admin_v1.FirewallAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.UpdateIngressRuleRequest( ) # Make the request - response = client.update_ingress_rule(request=request) + response = await client.update_ingress_rule(request=request) # Handle the response print(response) @@ -600,16 +600,16 @@ async def delete_ingress_rule( from google.cloud import appengine_admin_v1 - def sample_delete_ingress_rule(): + async def sample_delete_ingress_rule(): # Create a client - client = appengine_admin_v1.FirewallClient() + client = appengine_admin_v1.FirewallAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.DeleteIngressRuleRequest( ) # Make the request - client.delete_ingress_rule(request=request) + await client.delete_ingress_rule(request=request) Args: request (Union[google.cloud.appengine_admin_v1.types.DeleteIngressRuleRequest, dict]): 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 4108316..7ac7e95 100644 --- a/google/cloud/appengine_admin_v1/services/instances/async_client.py +++ b/google/cloud/appengine_admin_v1/services/instances/async_client.py @@ -220,9 +220,9 @@ async def list_instances( from google.cloud import appengine_admin_v1 - def sample_list_instances(): + async def sample_list_instances(): # Create a client - client = appengine_admin_v1.InstancesClient() + client = appengine_admin_v1.InstancesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.ListInstancesRequest( @@ -232,7 +232,7 @@ def sample_list_instances(): page_result = client.list_instances(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -304,16 +304,16 @@ async def get_instance( from google.cloud import appengine_admin_v1 - def sample_get_instance(): + async def sample_get_instance(): # Create a client - client = appengine_admin_v1.InstancesClient() + client = appengine_admin_v1.InstancesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.GetInstanceRequest( ) # Make the request - response = client.get_instance(request=request) + response = await client.get_instance(request=request) # Handle the response print(response) @@ -391,9 +391,9 @@ async def delete_instance( from google.cloud import appengine_admin_v1 - def sample_delete_instance(): + async def sample_delete_instance(): # Create a client - client = appengine_admin_v1.InstancesClient() + client = appengine_admin_v1.InstancesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.DeleteInstanceRequest( @@ -404,7 +404,7 @@ def sample_delete_instance(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -497,9 +497,9 @@ async def debug_instance( from google.cloud import appengine_admin_v1 - def sample_debug_instance(): + async def sample_debug_instance(): # Create a client - client = appengine_admin_v1.InstancesClient() + client = appengine_admin_v1.InstancesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.DebugInstanceRequest( @@ -510,7 +510,7 @@ def sample_debug_instance(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) 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 c73da6d..1e28bde 100644 --- a/google/cloud/appengine_admin_v1/services/services/async_client.py +++ b/google/cloud/appengine_admin_v1/services/services/async_client.py @@ -212,9 +212,9 @@ async def list_services( from google.cloud import appengine_admin_v1 - def sample_list_services(): + async def sample_list_services(): # Create a client - client = appengine_admin_v1.ServicesClient() + client = appengine_admin_v1.ServicesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.ListServicesRequest( @@ -224,7 +224,7 @@ def sample_list_services(): page_result = client.list_services(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -297,16 +297,16 @@ async def get_service( from google.cloud import appengine_admin_v1 - def sample_get_service(): + async def sample_get_service(): # Create a client - client = appengine_admin_v1.ServicesClient() + client = appengine_admin_v1.ServicesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.GetServiceRequest( ) # Make the request - response = client.get_service(request=request) + response = await client.get_service(request=request) # Handle the response print(response) @@ -379,9 +379,9 @@ async def update_service( from google.cloud import appengine_admin_v1 - def sample_update_service(): + async def sample_update_service(): # Create a client - client = appengine_admin_v1.ServicesClient() + client = appengine_admin_v1.ServicesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.UpdateServiceRequest( @@ -392,7 +392,7 @@ def sample_update_service(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -473,9 +473,9 @@ async def delete_service( from google.cloud import appengine_admin_v1 - def sample_delete_service(): + async def sample_delete_service(): # Create a client - client = appengine_admin_v1.ServicesClient() + client = appengine_admin_v1.ServicesAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.DeleteServiceRequest( @@ -486,7 +486,7 @@ def sample_delete_service(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) 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 3265a5a..1ed6d88 100644 --- a/google/cloud/appengine_admin_v1/services/versions/async_client.py +++ b/google/cloud/appengine_admin_v1/services/versions/async_client.py @@ -215,9 +215,9 @@ async def list_versions( from google.cloud import appengine_admin_v1 - def sample_list_versions(): + async def sample_list_versions(): # Create a client - client = appengine_admin_v1.VersionsClient() + client = appengine_admin_v1.VersionsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.ListVersionsRequest( @@ -227,7 +227,7 @@ def sample_list_versions(): page_result = client.list_versions(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -301,16 +301,16 @@ async def get_version( from google.cloud import appengine_admin_v1 - def sample_get_version(): + async def sample_get_version(): # Create a client - client = appengine_admin_v1.VersionsClient() + client = appengine_admin_v1.VersionsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.GetVersionRequest( ) # Make the request - response = client.get_version(request=request) + response = await client.get_version(request=request) # Handle the response print(response) @@ -374,9 +374,9 @@ async def create_version( from google.cloud import appengine_admin_v1 - def sample_create_version(): + async def sample_create_version(): # Create a client - client = appengine_admin_v1.VersionsClient() + client = appengine_admin_v1.VersionsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.CreateVersionRequest( @@ -387,7 +387,7 @@ def sample_create_version(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -495,9 +495,9 @@ async def update_version( from google.cloud import appengine_admin_v1 - def sample_update_version(): + async def sample_update_version(): # Create a client - client = appengine_admin_v1.VersionsClient() + client = appengine_admin_v1.VersionsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.UpdateVersionRequest( @@ -508,7 +508,7 @@ def sample_update_version(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -581,9 +581,9 @@ async def delete_version( from google.cloud import appengine_admin_v1 - def sample_delete_version(): + async def sample_delete_version(): # Create a client - client = appengine_admin_v1.VersionsClient() + client = appengine_admin_v1.VersionsAsyncClient() # Initialize request argument(s) request = appengine_admin_v1.DeleteVersionRequest( @@ -594,7 +594,7 @@ def sample_delete_version(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index 8fa343a..f3ccc2a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -784,7 +784,7 @@ def test_get_application_field_headers(): # a field header. Set these to a non-empty value. request = appengine.GetApplicationRequest() - request.name = "name/value" + 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: @@ -800,7 +800,7 @@ def test_get_application_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -814,7 +814,7 @@ async def test_get_application_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.GetApplicationRequest() - request.name = "name/value" + 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: @@ -832,7 +832,7 @@ async def test_get_application_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1023,7 +1023,7 @@ def test_update_application_field_headers(): # a field header. Set these to a non-empty value. request = appengine.UpdateApplicationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1041,7 +1041,7 @@ def test_update_application_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1055,7 +1055,7 @@ async def test_update_application_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.UpdateApplicationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1075,7 +1075,7 @@ async def test_update_application_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1177,7 +1177,7 @@ def test_repair_application_field_headers(): # a field header. Set these to a non-empty value. request = appengine.RepairApplicationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1195,7 +1195,7 @@ def test_repair_application_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1209,7 +1209,7 @@ async def test_repair_application_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.RepairApplicationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1229,7 +1229,7 @@ async def test_repair_application_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] 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 ad07779..9e95c2e 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -784,7 +784,7 @@ def test_list_authorized_certificates_field_headers(): # a field header. Set these to a non-empty value. request = appengine.ListAuthorizedCertificatesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -802,7 +802,7 @@ def test_list_authorized_certificates_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -816,7 +816,7 @@ async def test_list_authorized_certificates_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.ListAuthorizedCertificatesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -836,7 +836,7 @@ async def test_list_authorized_certificates_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -887,7 +887,7 @@ def test_list_authorized_certificates_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, certificate.AuthorizedCertificate) for i in results) @@ -1161,7 +1161,7 @@ def test_get_authorized_certificate_field_headers(): # a field header. Set these to a non-empty value. request = appengine.GetAuthorizedCertificateRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1179,7 +1179,7 @@ def test_get_authorized_certificate_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1193,7 +1193,7 @@ async def test_get_authorized_certificate_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.GetAuthorizedCertificateRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1213,7 +1213,7 @@ async def test_get_authorized_certificate_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1342,7 +1342,7 @@ def test_create_authorized_certificate_field_headers(): # a field header. Set these to a non-empty value. request = appengine.CreateAuthorizedCertificateRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1360,7 +1360,7 @@ def test_create_authorized_certificate_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1374,7 +1374,7 @@ async def test_create_authorized_certificate_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.CreateAuthorizedCertificateRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1394,7 +1394,7 @@ async def test_create_authorized_certificate_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1523,7 +1523,7 @@ def test_update_authorized_certificate_field_headers(): # a field header. Set these to a non-empty value. request = appengine.UpdateAuthorizedCertificateRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1541,7 +1541,7 @@ def test_update_authorized_certificate_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1555,7 +1555,7 @@ async def test_update_authorized_certificate_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.UpdateAuthorizedCertificateRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1575,7 +1575,7 @@ async def test_update_authorized_certificate_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1676,7 +1676,7 @@ def test_delete_authorized_certificate_field_headers(): # a field header. Set these to a non-empty value. request = appengine.DeleteAuthorizedCertificateRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1694,7 +1694,7 @@ def test_delete_authorized_certificate_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1708,7 +1708,7 @@ async def test_delete_authorized_certificate_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.DeleteAuthorizedCertificateRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1726,7 +1726,7 @@ async def test_delete_authorized_certificate_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] 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 728aef6..19b8ae1 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -773,7 +773,7 @@ def test_list_authorized_domains_field_headers(): # a field header. Set these to a non-empty value. request = appengine.ListAuthorizedDomainsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -791,7 +791,7 @@ def test_list_authorized_domains_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -805,7 +805,7 @@ async def test_list_authorized_domains_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.ListAuthorizedDomainsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -825,7 +825,7 @@ async def test_list_authorized_domains_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -876,7 +876,7 @@ def test_list_authorized_domains_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, domain.AuthorizedDomain) for i in results) 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 3ca570d..4ddf609 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -765,7 +765,7 @@ def test_list_domain_mappings_field_headers(): # a field header. Set these to a non-empty value. request = appengine.ListDomainMappingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -783,7 +783,7 @@ def test_list_domain_mappings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -797,7 +797,7 @@ async def test_list_domain_mappings_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.ListDomainMappingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -817,7 +817,7 @@ async def test_list_domain_mappings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -868,7 +868,7 @@ def test_list_domain_mappings_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, domain_mapping.DomainMapping) for i in results) @@ -1125,7 +1125,7 @@ def test_get_domain_mapping_field_headers(): # a field header. Set these to a non-empty value. request = appengine.GetDomainMappingRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1143,7 +1143,7 @@ def test_get_domain_mapping_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1157,7 +1157,7 @@ async def test_get_domain_mapping_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.GetDomainMappingRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1177,7 +1177,7 @@ async def test_get_domain_mapping_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1279,7 +1279,7 @@ def test_create_domain_mapping_field_headers(): # a field header. Set these to a non-empty value. request = appengine.CreateDomainMappingRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1297,7 +1297,7 @@ def test_create_domain_mapping_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1311,7 +1311,7 @@ async def test_create_domain_mapping_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.CreateDomainMappingRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1331,7 +1331,7 @@ async def test_create_domain_mapping_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1433,7 +1433,7 @@ def test_update_domain_mapping_field_headers(): # a field header. Set these to a non-empty value. request = appengine.UpdateDomainMappingRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1451,7 +1451,7 @@ def test_update_domain_mapping_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1465,7 +1465,7 @@ async def test_update_domain_mapping_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.UpdateDomainMappingRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1485,7 +1485,7 @@ async def test_update_domain_mapping_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1587,7 +1587,7 @@ def test_delete_domain_mapping_field_headers(): # a field header. Set these to a non-empty value. request = appengine.DeleteDomainMappingRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1605,7 +1605,7 @@ def test_delete_domain_mapping_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1619,7 +1619,7 @@ async def test_delete_domain_mapping_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.DeleteDomainMappingRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1639,7 +1639,7 @@ async def test_delete_domain_mapping_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 19a09af..9291205 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -720,7 +720,7 @@ def test_list_ingress_rules_field_headers(): # a field header. Set these to a non-empty value. request = appengine.ListIngressRulesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -738,7 +738,7 @@ def test_list_ingress_rules_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -752,7 +752,7 @@ async def test_list_ingress_rules_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.ListIngressRulesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -772,7 +772,7 @@ async def test_list_ingress_rules_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -823,7 +823,7 @@ def test_list_ingress_rules_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, firewall.FirewallRule) for i in results) @@ -1071,7 +1071,7 @@ def test_batch_update_ingress_rules_field_headers(): # a field header. Set these to a non-empty value. request = appengine.BatchUpdateIngressRulesRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1089,7 +1089,7 @@ def test_batch_update_ingress_rules_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1103,7 +1103,7 @@ async def test_batch_update_ingress_rules_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.BatchUpdateIngressRulesRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1123,7 +1123,7 @@ async def test_batch_update_ingress_rules_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1243,7 +1243,7 @@ def test_create_ingress_rule_field_headers(): # a field header. Set these to a non-empty value. request = appengine.CreateIngressRuleRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1261,7 +1261,7 @@ def test_create_ingress_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1275,7 +1275,7 @@ async def test_create_ingress_rule_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.CreateIngressRuleRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1295,7 +1295,7 @@ async def test_create_ingress_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1409,7 +1409,7 @@ def test_get_ingress_rule_field_headers(): # a field header. Set these to a non-empty value. request = appengine.GetIngressRuleRequest() - request.name = "name/value" + 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: @@ -1425,7 +1425,7 @@ def test_get_ingress_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1439,7 +1439,7 @@ async def test_get_ingress_rule_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.GetIngressRuleRequest() - request.name = "name/value" + 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: @@ -1457,7 +1457,7 @@ async def test_get_ingress_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1577,7 +1577,7 @@ def test_update_ingress_rule_field_headers(): # a field header. Set these to a non-empty value. request = appengine.UpdateIngressRuleRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1595,7 +1595,7 @@ def test_update_ingress_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1609,7 +1609,7 @@ async def test_update_ingress_rule_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.UpdateIngressRuleRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1629,7 +1629,7 @@ async def test_update_ingress_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1729,7 +1729,7 @@ def test_delete_ingress_rule_field_headers(): # a field header. Set these to a non-empty value. request = appengine.DeleteIngressRuleRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1747,7 +1747,7 @@ def test_delete_ingress_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1761,7 +1761,7 @@ async def test_delete_ingress_rule_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.DeleteIngressRuleRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1779,7 +1779,7 @@ async def test_delete_ingress_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 0a2ab1d..14a3ade 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -728,7 +728,7 @@ def test_list_instances_field_headers(): # a field header. Set these to a non-empty value. request = appengine.ListInstancesRequest() - request.parent = "parent/value" + 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: @@ -744,7 +744,7 @@ def test_list_instances_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -758,7 +758,7 @@ async def test_list_instances_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.ListInstancesRequest() - request.parent = "parent/value" + 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: @@ -776,7 +776,7 @@ async def test_list_instances_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -825,7 +825,7 @@ def test_list_instances_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, instance.Instance) for i in results) @@ -1126,7 +1126,7 @@ def test_get_instance_field_headers(): # a field header. Set these to a non-empty value. request = appengine.GetInstanceRequest() - request.name = "name/value" + 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: @@ -1142,7 +1142,7 @@ def test_get_instance_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1156,7 +1156,7 @@ async def test_get_instance_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.GetInstanceRequest() - request.name = "name/value" + 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: @@ -1172,7 +1172,7 @@ async def test_get_instance_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1268,7 +1268,7 @@ def test_delete_instance_field_headers(): # a field header. Set these to a non-empty value. request = appengine.DeleteInstanceRequest() - request.name = "name/value" + 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: @@ -1284,7 +1284,7 @@ def test_delete_instance_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1298,7 +1298,7 @@ async def test_delete_instance_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.DeleteInstanceRequest() - request.name = "name/value" + 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: @@ -1316,7 +1316,7 @@ async def test_delete_instance_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1412,7 +1412,7 @@ def test_debug_instance_field_headers(): # a field header. Set these to a non-empty value. request = appengine.DebugInstanceRequest() - request.name = "name/value" + 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: @@ -1428,7 +1428,7 @@ def test_debug_instance_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1442,7 +1442,7 @@ async def test_debug_instance_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.DebugInstanceRequest() - request.name = "name/value" + 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: @@ -1460,7 +1460,7 @@ async def test_debug_instance_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 361eee1..9b60574 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -721,7 +721,7 @@ def test_list_services_field_headers(): # a field header. Set these to a non-empty value. request = appengine.ListServicesRequest() - request.parent = "parent/value" + 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: @@ -737,7 +737,7 @@ def test_list_services_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -751,7 +751,7 @@ async def test_list_services_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.ListServicesRequest() - request.parent = "parent/value" + 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: @@ -769,7 +769,7 @@ async def test_list_services_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -818,7 +818,7 @@ def test_list_services_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, service.Service) for i in results) @@ -1063,7 +1063,7 @@ def test_get_service_field_headers(): # a field header. Set these to a non-empty value. request = appengine.GetServiceRequest() - request.name = "name/value" + 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: @@ -1079,7 +1079,7 @@ def test_get_service_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1093,7 +1093,7 @@ async def test_get_service_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.GetServiceRequest() - request.name = "name/value" + 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: @@ -1109,7 +1109,7 @@ async def test_get_service_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1205,7 +1205,7 @@ def test_update_service_field_headers(): # a field header. Set these to a non-empty value. request = appengine.UpdateServiceRequest() - request.name = "name/value" + 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: @@ -1221,7 +1221,7 @@ def test_update_service_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1235,7 +1235,7 @@ async def test_update_service_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.UpdateServiceRequest() - request.name = "name/value" + 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: @@ -1253,7 +1253,7 @@ async def test_update_service_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1349,7 +1349,7 @@ def test_delete_service_field_headers(): # a field header. Set these to a non-empty value. request = appengine.DeleteServiceRequest() - request.name = "name/value" + 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: @@ -1365,7 +1365,7 @@ def test_delete_service_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1379,7 +1379,7 @@ async def test_delete_service_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.DeleteServiceRequest() - request.name = "name/value" + 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: @@ -1397,7 +1397,7 @@ async def test_delete_service_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 4b5a631..ba0ef03 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -724,7 +724,7 @@ def test_list_versions_field_headers(): # a field header. Set these to a non-empty value. request = appengine.ListVersionsRequest() - request.parent = "parent/value" + 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: @@ -740,7 +740,7 @@ def test_list_versions_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -754,7 +754,7 @@ async def test_list_versions_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.ListVersionsRequest() - request.parent = "parent/value" + 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: @@ -772,7 +772,7 @@ async def test_list_versions_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -821,7 +821,7 @@ def test_list_versions_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, version.Version) for i in results) @@ -1137,7 +1137,7 @@ def test_get_version_field_headers(): # a field header. Set these to a non-empty value. request = appengine.GetVersionRequest() - request.name = "name/value" + 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: @@ -1153,7 +1153,7 @@ def test_get_version_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1167,7 +1167,7 @@ async def test_get_version_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.GetVersionRequest() - request.name = "name/value" + 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: @@ -1183,7 +1183,7 @@ async def test_get_version_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1279,7 +1279,7 @@ def test_create_version_field_headers(): # a field header. Set these to a non-empty value. request = appengine.CreateVersionRequest() - request.parent = "parent/value" + 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: @@ -1295,7 +1295,7 @@ def test_create_version_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1309,7 +1309,7 @@ async def test_create_version_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.CreateVersionRequest() - request.parent = "parent/value" + 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: @@ -1327,7 +1327,7 @@ async def test_create_version_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1423,7 +1423,7 @@ def test_update_version_field_headers(): # a field header. Set these to a non-empty value. request = appengine.UpdateVersionRequest() - request.name = "name/value" + 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: @@ -1439,7 +1439,7 @@ def test_update_version_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1453,7 +1453,7 @@ async def test_update_version_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.UpdateVersionRequest() - request.name = "name/value" + 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: @@ -1471,7 +1471,7 @@ async def test_update_version_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1567,7 +1567,7 @@ def test_delete_version_field_headers(): # a field header. Set these to a non-empty value. request = appengine.DeleteVersionRequest() - request.name = "name/value" + 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: @@ -1583,7 +1583,7 @@ def test_delete_version_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1597,7 +1597,7 @@ async def test_delete_version_field_headers_async(): # a field header. Set these to a non-empty value. request = appengine.DeleteVersionRequest() - request.name = "name/value" + 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: @@ -1615,7 +1615,7 @@ async def test_delete_version_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] From 595a87cd561cf26da72599adc6750fdf20a2f1b5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 11:20:17 +0000 Subject: [PATCH 102/185] feat: add Application.service_account (#134) - [ ] Regenerate this pull request now. feat: add client library method signature to retrieve Application by name feat: add Service.labels feat: add Version.app_engine_apis feat: add VpcAccessConnector.egress_setting PiperOrigin-RevId: 446641753 Source-Link: https://github.com/googleapis/googleapis/commit/cd7a3e5ea0ba6f184a76353504b643b312f6889f Source-Link: https://github.com/googleapis/googleapis-gen/commit/0e7d6d2055ea2ea48cefd8abb97f7f66e9b0e1a7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGU3ZDZkMjA1NWVhMmVhNDhjZWZkOGFiYjk3ZjdmNjZlOWIwZTFhNyJ9 --- .../services/applications/async_client.py | 24 ++++++ .../services/applications/client.py | 23 +++++ .../services/applications/transports/grpc.py | 2 + .../applications/transports/grpc_asyncio.py | 2 + .../appengine_admin_v1/types/appengine.py | 12 +-- .../appengine_admin_v1/types/application.py | 9 ++ .../cloud/appengine_admin_v1/types/service.py | 23 +++++ .../cloud/appengine_admin_v1/types/version.py | 25 ++++++ .../snippet_metadata_appengine admin_v1.json | 8 ++ .../appengine_admin_v1/test_applications.py | 86 +++++++++++++++++++ .../gapic/appengine_admin_v1/test_versions.py | 4 + 11 files changed, 212 insertions(+), 6 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 c3f55de..5bf8dd9 100644 --- a/google/cloud/appengine_admin_v1/services/applications/async_client.py +++ b/google/cloud/appengine_admin_v1/services/applications/async_client.py @@ -204,6 +204,7 @@ async def get_application( self, request: Union[appengine.GetApplicationRequest, dict] = None, *, + name: str = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -232,6 +233,13 @@ async def sample_get_application(): request (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. @@ -246,8 +254,22 @@ async def sample_get_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( @@ -378,6 +400,8 @@ async def update_application( 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 diff --git a/google/cloud/appengine_admin_v1/services/applications/client.py b/google/cloud/appengine_admin_v1/services/applications/client.py index a7639dd..59b9cd8 100644 --- a/google/cloud/appengine_admin_v1/services/applications/client.py +++ b/google/cloud/appengine_admin_v1/services/applications/client.py @@ -410,6 +410,7 @@ def get_application( self, request: Union[appengine.GetApplicationRequest, dict] = None, *, + name: str = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -438,6 +439,13 @@ def sample_get_application(): 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. @@ -452,12 +460,25 @@ def sample_get_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. @@ -586,6 +607,8 @@ def update_application( 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 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 cc65019..53f5dbe 100644 --- a/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py +++ b/google/cloud/appengine_admin_v1/services/applications/transports/grpc.py @@ -320,6 +320,8 @@ def update_application( 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], 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 f93b2ba..a4315b9 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 @@ -331,6 +331,8 @@ def update_application( 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], diff --git a/google/cloud/appengine_admin_v1/types/appengine.py b/google/cloud/appengine_admin_v1/types/appengine.py index be12296..f4427c2 100644 --- a/google/cloud/appengine_admin_v1/types/appengine.py +++ b/google/cloud/appengine_admin_v1/types/appengine.py @@ -142,8 +142,8 @@ class UpdateApplicationRequest(proto.Message): An Application containing the updated resource. update_mask (google.protobuf.field_mask_pb2.FieldMask): - Standard field mask for the set of fields to - be updated. + Required. Standard field mask for the set of + fields to be updated. """ name = proto.Field( @@ -258,8 +258,8 @@ class UpdateServiceRequest(proto.Message): service. 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. + 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 @@ -1101,8 +1101,8 @@ class UpdateDomainMappingRequest(proto.Message): 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. + Required. Standard field mask for the set of + fields to be updated. """ name = proto.Field( diff --git a/google/cloud/appengine_admin_v1/types/application.py b/google/cloud/appengine_admin_v1/types/application.py index 263562d..f7687e5 100644 --- a/google/cloud/appengine_admin_v1/types/application.py +++ b/google/cloud/appengine_admin_v1/types/application.py @@ -83,6 +83,11 @@ class Application(proto.Message): 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): @@ -226,6 +231,10 @@ class FeatureSettings(proto.Message): proto.STRING, number=12, ) + service_account = proto.Field( + proto.STRING, + number=13, + ) iap = proto.Field( proto.MESSAGE, number=14, diff --git a/google/cloud/appengine_admin_v1/types/service.py b/google/cloud/appengine_admin_v1/types/service.py index 77e2608..c42ffec 100644 --- a/google/cloud/appengine_admin_v1/types/service.py +++ b/google/cloud/appengine_admin_v1/types/service.py @@ -54,6 +54,24 @@ class Service(proto.Message): Mapping that defines fractional HTTP traffic diversion to different versions within the service. + labels (Mapping[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. @@ -72,6 +90,11 @@ class Service(proto.Message): number=3, message="TrafficSplit", ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) network_settings = proto.Field( proto.MESSAGE, number=6, diff --git a/google/cloud/appengine_admin_v1/types/version.py b/google/cloud/appengine_admin_v1/types/version.py index 7ea3028..0bd5458 100644 --- a/google/cloud/appengine_admin_v1/types/version.py +++ b/google/cloud/appengine_admin_v1/types/version.py @@ -148,6 +148,9 @@ class Version(proto.Message): 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 (Mapping[str, str]): Metadata settings that are supplied to this version to enable beta runtime features. @@ -330,6 +333,10 @@ class Version(proto.Message): proto.BOOL, number=12, ) + app_engine_apis = proto.Field( + proto.BOOL, + number=128, + ) beta_settings = proto.MapField( proto.STRING, proto.STRING, @@ -964,12 +971,30 @@ class VpcAccessConnector(proto.Message): 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. + """ + EGRESS_SETTING_UNSPECIFIED = 0 + ALL_TRAFFIC = 1 + PRIVATE_IP_RANGES = 2 + name = proto.Field( proto.STRING, number=1, ) + egress_setting = proto.Field( + proto.ENUM, + number=2, + enum=EgressSetting, + ) class Entrypoint(proto.Message): diff --git a/samples/generated_samples/snippet_metadata_appengine admin_v1.json b/samples/generated_samples/snippet_metadata_appengine admin_v1.json index 7d498a2..a3212d2 100644 --- a/samples/generated_samples/snippet_metadata_appengine admin_v1.json +++ b/samples/generated_samples/snippet_metadata_appengine admin_v1.json @@ -185,6 +185,10 @@ "name": "request", "type": "google.cloud.appengine_admin_v1.types.GetApplicationRequest" }, + { + "name": "name", + "type": "str" + }, { "name": "retry", "type": "google.api_core.retry.Retry" @@ -261,6 +265,10 @@ "name": "request", "type": "google.cloud.appengine_admin_v1.types.GetApplicationRequest" }, + { + "name": "name", + "type": "str" + }, { "name": "retry", "type": "google.api_core.retry.Retry" diff --git a/tests/unit/gapic/appengine_admin_v1/test_applications.py b/tests/unit/gapic/appengine_admin_v1/test_applications.py index f3ccc2a..205bbeb 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -675,6 +675,7 @@ def test_get_application(request_type, transport: str = "grpc"): 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, ) @@ -695,6 +696,7 @@ def test_get_application(request_type, transport: str = "grpc"): 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 @@ -743,6 +745,7 @@ async def test_get_application_async( 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, ) @@ -764,6 +767,7 @@ async def test_get_application_async( 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 @@ -836,6 +840,88 @@ async def test_get_application_field_headers_async(): ) 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", [ diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index ba0ef03..9bf3cd1 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -994,6 +994,7 @@ def test_get_version(request_type, transport: str = "grpc"): 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", @@ -1027,6 +1028,7 @@ def test_get_version(request_type, transport: str = "grpc"): 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" @@ -1081,6 +1083,7 @@ async def test_get_version_async( 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", @@ -1112,6 +1115,7 @@ async def test_get_version_async( 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" From 93d3be6592c6c73da16a00b77d5322a2c20b2f80 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 11:45:20 -0400 Subject: [PATCH 103/185] chore: [autoapprove] update readme_gen.py to include autoescape True (#136) Source-Link: https://github.com/googleapis/synthtool/commit/6b4d5a6407d740beb4158b302194a62a4108a8a6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- scripts/readme-gen/readme_gen.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 64f82d6..b631901 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:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd -# created: 2022-04-21T15:43:16.246106921Z + digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 +# created: 2022-05-05T15:17:27.599381182Z diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') From 5aad08c05773c9aad168c94af05f6640e7acde1b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 23:28:13 +0000 Subject: [PATCH 104/185] chore(python): auto approve template changes (#138) Source-Link: https://github.com/googleapis/synthtool/commit/453a5d9c9a55d1969240a37d36cec626d20a9024 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-approve.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/auto-approve.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b631901..757c9dc 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:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 -# created: 2022-05-05T15:17:27.599381182Z + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" From 02284e0a99978cbfd3608d0204e210ee9944475f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 08:30:40 -0400 Subject: [PATCH 105/185] chore(main): release 1.4.0 (#135) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Averi Kitsch --- CHANGELOG.md | 11 +++++++++++ setup.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08cb000..9cd98b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [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) diff --git a/setup.py b/setup.py index c82e031..dc285df 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.3.3" +version = "1.4.0" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From c09afdd54e576d2d5ff91bf915cf841f1c1dc720 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 17:46:22 +0000 Subject: [PATCH 106/185] chore: use gapic-generator-python 1.0.0 (#166) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 451250442 Source-Link: https://github.com/googleapis/googleapis/commit/cca5e8181f6442b134e8d4d206fbe9e0e74684ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/0b219da161a8bdcc3c6f7b2efcd82105182a30ca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGIyMTlkYTE2MWE4YmRjYzNjNmY3YjJlZmNkODIxMDUxODJhMzBjYSJ9 --- tests/unit/gapic/appengine_admin_v1/test_applications.py | 8 +++++++- .../appengine_admin_v1/test_authorized_certificates.py | 8 +++++++- .../gapic/appengine_admin_v1/test_authorized_domains.py | 8 +++++++- .../unit/gapic/appengine_admin_v1/test_domain_mappings.py | 8 +++++++- tests/unit/gapic/appengine_admin_v1/test_firewall.py | 8 +++++++- tests/unit/gapic/appengine_admin_v1/test_instances.py | 8 +++++++- tests/unit/gapic/appengine_admin_v1/test_services.py | 8 +++++++- tests/unit/gapic/appengine_admin_v1/test_versions.py | 8 +++++++- 8 files changed, 56 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 205bbeb..dcd6dfb 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/tests/unit/gapic/appengine_admin_v1/test_applications.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio 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 9e95c2e..b19deae 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio 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 19b8ae1..6a618f6 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio 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 4ddf609..76999df 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 9291205..dea4bbd 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/tests/unit/gapic/appengine_admin_v1/test_firewall.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/appengine_admin_v1/test_instances.py b/tests/unit/gapic/appengine_admin_v1/test_instances.py index 14a3ade..22591dd 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/tests/unit/gapic/appengine_admin_v1/test_instances.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/appengine_admin_v1/test_services.py b/tests/unit/gapic/appengine_admin_v1/test_services.py index 9b60574..c2a22ff 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/tests/unit/gapic/appengine_admin_v1/test_services.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/appengine_admin_v1/test_versions.py b/tests/unit/gapic/appengine_admin_v1/test_versions.py index 9bf3cd1..d66081a 100644 --- a/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/tests/unit/gapic/appengine_admin_v1/test_versions.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio From d18523f1e900cd3d59ab5919629680f1023cb5da Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 1 Jun 2022 22:30:19 -0400 Subject: [PATCH 107/185] fix(deps): require protobuf <4.0.0dev (#167) * fix(deps): require protobuf <4.0.0dev * update constraints --- setup.py | 6 +++--- testing/constraints-3.6.txt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index dc285df..8e2918a 100644 --- a/setup.py +++ b/setup.py @@ -29,9 +29,9 @@ # 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", - "proto-plus >= 1.18.1", - "grpc-google-iam-v1", - "six", + "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", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 64d95bb..85fd9f0 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,5 +7,5 @@ # 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.3 -six==1.13.0 +grpc-google-iam-v1==0.12.4 +protobuf==3.19.0 From 32eb9839a119be5c9189140e02dd8e2c2798cbf3 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:40:33 -0400 Subject: [PATCH 108/185] docs: fix changelog header to consistent size (#168) Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd98b6..97ab078 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,21 +11,21 @@ * 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) +## [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) +## [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) +## [1.3.1](https://github.com/googleapis/python-appengine-admin/compare/v1.3.0...v1.3.1) (2022-02-11) ### Bug Fixes @@ -44,7 +44,7 @@ * 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) +## [1.2.1](https://www.github.com/googleapis/python-appengine-admin/compare/v1.2.0...v1.2.1) (2021-11-01) ### Bug Fixes @@ -65,21 +65,21 @@ * 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) +## [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) +## [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) +## [1.1.3](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.2...v1.1.3) (2021-07-27) ### Bug Fixes @@ -96,14 +96,14 @@ * 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) +## [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) +## [1.1.1](https://www.github.com/googleapis/python-appengine-admin/compare/v1.1.0...v1.1.1) (2021-06-30) ### Bug Fixes @@ -123,14 +123,14 @@ * 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) +## [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) +## [1.0.1](https://www.github.com/googleapis/python-appengine-admin/compare/v1.0.0...v1.0.1) (2021-06-16) ### Bug Fixes From b7833f35b9e3b234993b91a26ccda5bc614915de Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 3 Jun 2022 12:51:50 -0400 Subject: [PATCH 109/185] chore: test minimum dependencies in python 3.7 (#171) --- testing/constraints-3.7.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29..85fd9f0 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +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. +# 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 From c80862d08edd1dc22e03b7dd9e326a759ba32212 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 18:19:47 -0400 Subject: [PATCH 110/185] chore(main): release 1.4.1 (#169) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ab078..2f65ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [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) diff --git a/setup.py b/setup.py index 8e2918a..16e2282 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-appengine-admin" -version = "1.4.0" +version = "1.4.1" description = "App Engine Admin API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-appengine-admin" From 7c391df98b68eddcdcde11756a831852df76987e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 12 Jun 2022 11:12:27 -0400 Subject: [PATCH 111/185] chore: add prerelease nox session (#173) Source-Link: https://github.com/googleapis/synthtool/commit/050953d60f71b4ed4be563e032f03c192c50332f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:65e656411895bff71cffcae97246966460160028f253c2e45b7a25d805a5b142 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 +- .kokoro/continuous/prerelease-deps.cfg | 7 +++ .kokoro/presubmit/prerelease-deps.cfg | 7 +++ noxfile.py | 64 ++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .kokoro/continuous/prerelease-deps.cfg create mode 100644 .kokoro/presubmit/prerelease-deps.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 757c9dc..2185b59 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:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 -# created: 2022-05-05T22:08:23.383410683Z + digest: sha256:65e656411895bff71cffcae97246966460160028f253c2e45b7a25d805a5b142 +# created: 2022-06-12T13:11:45.905884945Z diff --git a/.kokoro/continuous/prerelease-deps.cfg b/.kokoro/continuous/prerelease-deps.cfg new file mode 100644 index 0000000..3595fb4 --- /dev/null +++ b/.kokoro/continuous/prerelease-deps.cfg @@ -0,0 +1,7 @@ +# 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/prerelease-deps.cfg b/.kokoro/presubmit/prerelease-deps.cfg new file mode 100644 index 0000000..3595fb4 --- /dev/null +++ b/.kokoro/presubmit/prerelease-deps.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Only run this nox session. +env_vars: { + key: "NOX_SESSION" + value: "prerelease_deps" +} diff --git a/noxfile.py b/noxfile.py index 92da31f..bd20103 100644 --- a/noxfile.py +++ b/noxfile.py @@ -324,3 +324,67 @@ def docfx(session): 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.""" + + 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) + + session.install(*UNIT_TEST_STANDARD_DEPENDENCIES) + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES) + + # 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. + 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]") + + # 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("py.test", "tests/unit") + session.run("py.test", "tests/system") + session.run("py.test", "samples/snippets") From 836f76863bbab3cc8f7eeda6143291cacab1f800 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 13 Jun 2022 06:36:18 -0400 Subject: [PATCH 112/185] chore(python): add missing import for prerelease testing (#174) Source-Link: https://github.com/googleapis/synthtool/commit/d2871d98e1e767d4ad49a557ff979236d64361a1 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- noxfile.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 2185b59..50b29ff 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:65e656411895bff71cffcae97246966460160028f253c2e45b7a25d805a5b142 -# created: 2022-06-12T13:11:45.905884945Z + digest: sha256:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97 +# created: 2022-06-12T16:09:31.61859086Z diff --git a/noxfile.py b/noxfile.py index bd20103..fe3a1fe 100644 --- a/noxfile.py +++ b/noxfile.py @@ -19,6 +19,7 @@ from __future__ import absolute_import import os import pathlib +import re import shutil import warnings 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 113/185] 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 114/185] 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 115/185] 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 116/185] 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 117/185] 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 118/185] 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 119/185] 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 120/185] 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 121/185] 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 122/185] 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 123/185] 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 124/185] 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 125/185] 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 126/185] 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 127/185] 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 128/185] 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 129/185] 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 130/185] 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 131/185] 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 132/185] 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 133/185] 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 134/185] 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 135/185] 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 136/185] 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 137/185] 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 138/185] 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 139/185] 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 140/185] 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 141/185] 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 142/185] 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 143/185] 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 144/185] 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 145/185] 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 146/185] 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 147/185] 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 148/185] 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 149/185] 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 150/185] 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 151/185] 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 152/185] 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 153/185] 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 154/185] 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 155/185] 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 156/185] 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 157/185] 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 158/185] 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 159/185] 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 160/185] 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 161/185] 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 162/185] 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 163/185] 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 164/185] 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 165/185] 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 166/185] 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 167/185] 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 168/185] 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 169/185] 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 170/185] 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 171/185] 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 172/185] 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 173/185] 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 174/185] 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 175/185] 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 176/185] 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 177/185] 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 178/185] 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 179/185] 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 180/185] 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 181/185] 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 182/185] 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 183/185] 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 184/185] 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 185/185] 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, - )