From a575b0b0402e92afe5b5ef83e006ad991a2f73bb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 2 Apr 2021 16:50:49 -0700 Subject: [PATCH 01/15] Test: update constraints files and use precommit hook (#81) * chore(deps): update precommit hook pycqa/flake8 to v3.9.0 * test(python): use constraints files to check dependency lower bounds --- .pre-commit-config.yaml | 2 +- noxfile.py | 22 ++++++++++++++-------- synth.metadata | 2 +- testing/constraints-3.6.txt | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9024b15..32302e48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,6 @@ repos: hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.0 hooks: - id: flake8 diff --git a/noxfile.py b/noxfile.py index 9fafb0c2..2efbe2b5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -18,6 +18,7 @@ from __future__ import absolute_import import os +import pathlib import shutil import nox @@ -30,6 +31,8 @@ SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + # 'docfx' is excluded since it only needs to run in 'docs-presubmit' nox.options.sessions = [ "unit", @@ -84,13 +87,15 @@ def lint_setup_py(session): def default(session): # Install all test dependencies, then install this package in-place. - session.install("asyncmock", "pytest-asyncio") - session.install( - "mock", "pytest", "pytest-cov", + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) + session.install("asyncmock", "pytest-asyncio", "-c", constraints_path) - session.install("-e", ".") + session.install("mock", "pytest", "pytest-cov", "-c", constraints_path) + + session.install("-e", ".", "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -117,6 +122,9 @@ def unit(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -141,10 +149,8 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. - session.install( - "mock", "pytest", "google-cloud-testutils", - ) - session.install("-e", ".") + session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) + session.install("-e", ".", "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/synth.metadata b/synth.metadata index 8b5c788a..3082d2db 100644 --- a/synth.metadata +++ b/synth.metadata @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "79c8dd7ee768292f933012d3a69a5b4676404cda" + "sha": "86ed43d4f56e6404d068e62e497029018879c771" } } ], diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index af597f7a..399fa9e8 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.21.2 +google-api-core==1.26.3 grpc-google-iam-v1==0.12.3 proto-plus==1.4.0 libcst==0.2.5 \ No newline at end of file From a7230b85e8c91f6e36b84dac4df6230ef6bbbe04 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 3 Apr 2021 13:45:30 -0700 Subject: [PATCH 02/15] build(python): update docfx job to use new plugin (#83) Source-Author: Dan Lee <71398022+dandhlee@users.noreply.github.com> Source-Date: Tue Mar 30 19:36:37 2021 -0400 Source-Repo: googleapis/synthtool Source-Sha: 4501974ad08b5d693311457e2ea4ce845676e329 Source-Link: https://github.com/googleapis/synthtool/commit/4501974ad08b5d693311457e2ea4ce845676e329 --- noxfile.py | 6 +++--- synth.metadata | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/noxfile.py b/noxfile.py index 2efbe2b5..4ba6aa2d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -211,9 +211,9 @@ def docfx(session): """Build the docfx yaml files for this library.""" session.install("-e", ".") - # sphinx-docfx-yaml supports up to sphinx version 1.5.5. - # https://github.com/docascode/sphinx-docfx-yaml/issues/97 - session.install("sphinx==1.5.5", "alabaster", "recommonmark", "sphinx-docfx-yaml") + session.install( + "sphinx<3.0.0", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml" + ) shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/synth.metadata b/synth.metadata index 3082d2db..55ca22c5 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-container.git", - "sha": "206e49548ee102b59716d58c55373c6aa5b1e990" + "sha": "a575b0b0402e92afe5b5ef83e006ad991a2f73bb" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "86ed43d4f56e6404d068e62e497029018879c771" + "sha": "4501974ad08b5d693311457e2ea4ce845676e329" } } ], From d85380298f4b4b3b690832d9c2854698f7fd6a24 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 7 Apr 2021 08:28:10 -0700 Subject: [PATCH 03/15] chore: Add license headers for python config files (#85) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/84f8868d-ac4d-4151-a388-e762b5d35837/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc --- .pre-commit-config.yaml | 14 ++++++++++++++ docs/conf.py | 13 +++++++++++++ synth.metadata | 4 ++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32302e48..8912e9b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,17 @@ +# 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. +# # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: diff --git a/docs/conf.py b/docs/conf.py index 6cbe9eac..269b380a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,17 @@ # -*- coding: utf-8 -*- +# 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. # # google-cloud-container documentation build configuration file # diff --git a/synth.metadata b/synth.metadata index 55ca22c5..12c065c6 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-container.git", - "sha": "a575b0b0402e92afe5b5ef83e006ad991a2f73bb" + "sha": "a7230b85e8c91f6e36b84dac4df6230ef6bbbe04" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "4501974ad08b5d693311457e2ea4ce845676e329" + "sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc" } } ], From 21e89174026d0976d44c04dc50487e271bf15c40 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sun, 11 Apr 2021 05:28:43 -0700 Subject: [PATCH 04/15] chore: add constraints file check for python samples (#86) This is the sibling PR to https://github.com/GoogleCloudPlatform/python-docs-samples/pull/5611 and this is the issue opened for it https://github.com/GoogleCloudPlatform/python-docs-samples/issues/5549 --- .github/header-checker-lint.yml | 2 +- renovate.json | 5 ++++- synth.metadata | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/header-checker-lint.yml b/.github/header-checker-lint.yml index fc281c05..6fe78aa7 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/renovate.json b/renovate.json index f08bc22c..c0489556 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 12c065c6..96996d99 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-container.git", - "sha": "a7230b85e8c91f6e36b84dac4df6230ef6bbbe04" + "sha": "d85380298f4b4b3b690832d9c2854698f7fd6a24" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc" + "sha": "0a071b3460344886297a304253bf924aa68ddb7e" } } ], From d0e188a62b7b18c36cd1d04f7ba0e88aca792fd6 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 16 Apr 2021 09:23:54 -0700 Subject: [PATCH 05/15] chore: Re-generated to pick up changes from synthtool (#87) * docs(python): add empty lines between methods Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Wed Apr 14 14:41:09 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 721339ab60a6eb63b889978b3d9b295dcb3be370 Source-Link: https://github.com/googleapis/synthtool/commit/721339ab60a6eb63b889978b3d9b295dcb3be370 * build: use PyPI API token in secret manager Migrate python libraries onto the PyPI API token stored in secret manager. A PyPI API token is limited in scope to uploading new releases. https://pypi.org/help/#apitoken Verified that this works with [build](https://fusion2.corp.google.com/invocations/14bae126-83fa-4328-8da9-d390ed99315c/targets/cloud-devrel%2Fclient-libraries%2Fpython%2Fgoogleapis%2Fpython-vision%2Frelease%2Frelease;config=default/log) on https://github.com/googleapis/python-vision/pull/136 Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Wed Apr 14 17:46:06 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 043cc620d6a6111816d9e09f2a97208565fde958 Source-Link: https://github.com/googleapis/synthtool/commit/043cc620d6a6111816d9e09f2a97208565fde958 --- .kokoro/release.sh | 4 ++-- .kokoro/release/common.cfg | 14 ++------------ docs/_static/custom.css | 13 ++++++++++++- synth.metadata | 4 ++-- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.kokoro/release.sh b/.kokoro/release.sh index fe4cfaaf..fe36ee33 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-container 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 59633e6a..a3feb573 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,18 +23,8 @@ env_vars: { value: "github/python-container/.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/docs/_static/custom.css b/docs/_static/custom.css index bcd37bbd..b0a29546 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/synth.metadata b/synth.metadata index 96996d99..c45941fb 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-container.git", - "sha": "d85380298f4b4b3b690832d9c2854698f7fd6a24" + "sha": "21e89174026d0976d44c04dc50487e271bf15c40" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0a071b3460344886297a304253bf924aa68ddb7e" + "sha": "043cc620d6a6111816d9e09f2a97208565fde958" } } ], From 58dc6263287e47964c7c551c8352faea80c3fe1f Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Fri, 16 Apr 2021 17:34:01 -0400 Subject: [PATCH 06/15] chore: prevent normalization of semver versioning (#88) When there is a patch version added to semver versioning, setuptools.setup(version) will normalize the versioning from -patch to .patch which is not correct SEMVER versioning. The added feature with setuptools.sic(version) will prevent this from happening. --- setup.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d73c3d4d..e992e089 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,20 @@ import setuptools +# 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 # Package metadata. @@ -61,7 +75,7 @@ setuptools.setup( name=name, - version=version, + version=sic(version), description=description, long_description=readme, author="Google LLC", From f908d5415c30ec66617ed63e7851f7d13cc06337 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Mon, 26 Apr 2021 13:12:14 -0400 Subject: [PATCH 07/15] chore(revert): revert preventing normalization (#89) --- setup.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/setup.py b/setup.py index e992e089..d73c3d4d 100644 --- a/setup.py +++ b/setup.py @@ -17,20 +17,6 @@ import setuptools -# 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 # Package metadata. @@ -75,7 +61,7 @@ setuptools.setup( name=name, - version=sic(version), + version=version, description=description, long_description=readme, author="Google LLC", From a884426c2cf49057369cad61b6f40228a6664386 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 7 May 2021 12:48:03 -0700 Subject: [PATCH 08/15] chore: autosynth updates (#92) --- .pre-commit-config.yaml | 2 +- CONTRIBUTING.rst | 16 +--------------- noxfile.py | 14 ++------------ synth.metadata | 9 +-------- 4 files changed, 5 insertions(+), 36 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8912e9b5..1bbd7878 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 385552dd..d9e361ea 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/noxfile.py b/noxfile.py index 4ba6aa2d..f88eb87a 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.metadata b/synth.metadata index c45941fb..0a29112b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-container.git", - "sha": "21e89174026d0976d44c04dc50487e271bf15c40" + "sha": "f908d5415c30ec66617ed63e7851f7d13cc06337" } }, { @@ -14,13 +14,6 @@ "sha": "149a3a84c29c9b8189576c7442ccb6dcf6a8f95b", "internalRef": "364411656" } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "043cc620d6a6111816d9e09f2a97208565fde958" - } } ], "destinations": [ From 06c639c0bbe113918a312f508c5dfcfffb2f7d61 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:02:17 +0000 Subject: [PATCH 09/15] chore: add SECURITY.md (#91) 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 00000000..8b58ae9c --- /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 8f49dbdb9bd399fd1b2cb3b30b09e9cf1517acd1 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 May 2021 17:46:05 -0400 Subject: [PATCH 10/15] chore: add library type to .repo-metadata.json (#93) --- .repo-metadata.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.repo-metadata.json b/.repo-metadata.json index 14fa22b7..076eedc0 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -6,6 +6,7 @@ "issue_tracker": "https://issuetracker.google.com/savedsearches/559746", "release_level": "ga", "language": "python", + "library_type": "GAPIC_AUTO", "repo": "googleapis/python-container", "distribution_name": "google-cloud-container", "api_id": "container.googleapis.com", From 13fc9fd468efcc37268098c9b3b8c2badc4bf447 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 May 2021 10:58:59 -0400 Subject: [PATCH 11/15] chore: migrate to owl bot (#95) * chore: migrate to owl bot * chore: copy files from googleapis-gen 130ce904e5d546c312943d10f48799590f9c0f66 * chore: run the post processor --- .github/.OwlBot.lock.yaml | 4 + .github/.OwlBot.yaml | 26 +++++++ owlbot.py | 98 ++++++++++++++++++++++++ synth.metadata | 155 -------------------------------------- synth.py | 111 --------------------------- 5 files changed, 128 insertions(+), 266 deletions(-) create mode 100644 .github/.OwlBot.lock.yaml create mode 100644 .github/.OwlBot.yaml create mode 100644 owlbot.py delete mode 100644 synth.metadata delete mode 100644 synth.py diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 00000000..d49860b3 --- /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 00000000..53345a02 --- /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/container/(v.*)/.*-py/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: 130ce904e5d546c312943d10f48799590f9c0f66 + diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 00000000..8f5ee2ad --- /dev/null +++ b/owlbot.py @@ -0,0 +1,98 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# 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 synthtool as s +from synthtool import gcp + +common = gcp.CommonTemplates() + +default_version = "v1" + +for library in s.get_staging_dirs(default_version): + # Issues exist where python files should define the source encoding + # https://github.com/googleapis/gapic-generator/issues/2097 + s.replace( + library / "google/**/proto/*_pb2.py", + r"(^.*$\n)*", + r"# -*- coding: utf-8 -*-\n\g<0>") + + # Workaround https://github.com/googleapis/gapic-generator/issues/2449 + s.replace( + library / "google/**/proto/cluster_service_pb2.py", + r"nodePool>\n", + r"nodePool>`__\n", + ) + s.replace( + library / "google/**/proto/cluster_service_pb2.py", + r"(\s+)`__ instead", + r"\g<1>instead", + ) + + # Fix namespace + s.replace( + library / f"google/**/*.py", + f"google.container_{library.name}", + f"google.cloud.container_{library.name}", + ) + + s.replace( + library / f"tests/unit/gapic/**/*.py", + f"google.container_{library.name}", + f"google.cloud.container_{library.name}", + ) + + s.replace( + library / f"docs/**/*.rst", + f"google.container_{library.name}", + f"google.cloud.container_{library.name}", + ) + + # Fix package name + s.replace( + library / "google/**/*.py", + "google-container", + "google-cloud-container" + ) + + s.move(library / "google/container", "google/cloud/container") + s.move( + library / f"google/container_{library.name}", + f"google/cloud/container_{library.name}" + ) + s.move(library / "tests") + s.move(library / "scripts") + s.move(library / "docs", excludes=["index.rst"]) + +s.remove_staging_dirs() + +# ---------------------------------------------------------------------------- +# Add templated files +# ---------------------------------------------------------------------------- +templated_files = common.py_library( + samples=False, # set to True only if there are samples + microgenerator=True, + cov_level=99, +) +s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file + + +# TODO(busunkim): Use latest sphinx after microgenerator transition +s.replace("noxfile.py", """['"]sphinx['"]""", '"sphinx<3.0.0"') + +# Temporarily disable warnings due to +# https://github.com/googleapis/gapic-generator-python/issues/525 +s.replace("noxfile.py", '[\"\']-W[\"\']', '# "-W"') + +s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/synth.metadata b/synth.metadata deleted file mode 100644 index 0a29112b..00000000 --- a/synth.metadata +++ /dev/null @@ -1,155 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/python-container.git", - "sha": "f908d5415c30ec66617ed63e7851f7d13cc06337" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "149a3a84c29c9b8189576c7442ccb6dcf6a8f95b", - "internalRef": "364411656" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "container", - "apiVersion": "v1beta1", - "language": "python", - "generator": "bazel" - } - }, - { - "client": { - "source": "googleapis", - "apiName": "container", - "apiVersion": "v1", - "language": "python", - "generator": "bazel" - } - } - ], - "generatedFiles": [ - ".flake8", - ".github/CONTRIBUTING.md", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/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", - "docs/container_v1/cluster_manager.rst", - "docs/container_v1/services.rst", - "docs/container_v1/types.rst", - "docs/container_v1beta1/cluster_manager.rst", - "docs/container_v1beta1/services.rst", - "docs/container_v1beta1/types.rst", - "docs/multiprocessing.rst", - "google/cloud/container/__init__.py", - "google/cloud/container/py.typed", - "google/cloud/container_v1/__init__.py", - "google/cloud/container_v1/proto/cluster_service.proto", - "google/cloud/container_v1/py.typed", - "google/cloud/container_v1/services/__init__.py", - "google/cloud/container_v1/services/cluster_manager/__init__.py", - "google/cloud/container_v1/services/cluster_manager/async_client.py", - "google/cloud/container_v1/services/cluster_manager/client.py", - "google/cloud/container_v1/services/cluster_manager/pagers.py", - "google/cloud/container_v1/services/cluster_manager/transports/__init__.py", - "google/cloud/container_v1/services/cluster_manager/transports/base.py", - "google/cloud/container_v1/services/cluster_manager/transports/grpc.py", - "google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py", - "google/cloud/container_v1/types/__init__.py", - "google/cloud/container_v1/types/cluster_service.py", - "google/cloud/container_v1beta1/__init__.py", - "google/cloud/container_v1beta1/proto/cluster_service.proto", - "google/cloud/container_v1beta1/py.typed", - "google/cloud/container_v1beta1/services/__init__.py", - "google/cloud/container_v1beta1/services/cluster_manager/__init__.py", - "google/cloud/container_v1beta1/services/cluster_manager/async_client.py", - "google/cloud/container_v1beta1/services/cluster_manager/client.py", - "google/cloud/container_v1beta1/services/cluster_manager/pagers.py", - "google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py", - "google/cloud/container_v1beta1/services/cluster_manager/transports/base.py", - "google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py", - "google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py", - "google/cloud/container_v1beta1/types/__init__.py", - "google/cloud/container_v1beta1/types/cluster_service.py", - "noxfile.py", - "renovate.json", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "scripts/decrypt-secrets.sh", - "scripts/fixup_container_v1_keywords.py", - "scripts/fixup_container_v1beta1_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/container_v1/__init__.py", - "tests/unit/gapic/container_v1/test_cluster_manager.py", - "tests/unit/gapic/container_v1beta1/__init__.py", - "tests/unit/gapic/container_v1beta1/test_cluster_manager.py" - ] -} \ No newline at end of file diff --git a/synth.py b/synth.py deleted file mode 100644 index 2ca4a663..00000000 --- a/synth.py +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# 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 synthtool as s -from synthtool import gcp - -gapic = gcp.GAPICBazel() -common = gcp.CommonTemplates() -versions = ["v1beta1", "v1"] - -# ---------------------------------------------------------------------------- -# Generate container GAPIC layer -# ---------------------------------------------------------------------------- -for version in versions: - library = gapic.py_library( - service="container", - version=version, - bazel_target=f"//google/container/{version}:container-{version}-py", - include_protos=True, - proto_output_path=f"google/container_{version}/proto", - ) - - s.move(library / "google/container", "google/cloud/container") - s.move( - library / f"google/container_{version}", - f"google/cloud/container_{version}" - ) - s.move(library / "tests") - s.move(library / "scripts") - s.move(library / "docs", excludes=[library / "docs/index.rst"]) - - # Fix namespace - s.replace( - f"google/cloud/**/*.py", - f"google.container_{version}", - f"google.cloud.container_{version}", - ) - s.replace( - f"tests/unit/gapic/**/*.py", - f"google.container_{version}", - f"google.cloud.container_{version}", - ) - s.replace( - f"google/cloud/**/*.py", - f"google.container_{version}", - f"google.cloud.container_{version}", - ) - s.replace( - f"docs/**/*.rst", - f"google.container_{version}", - f"google.cloud.container_{version}", - ) - -# Fix package name -s.replace( - "google/cloud/**/*.py", - "google-container", - "google-cloud-container" -) - -# Issues exist where python files should define the source encoding -# https://github.com/googleapis/gapic-generator/issues/2097 -s.replace( - "google/**/proto/*_pb2.py", - r"(^.*$\n)*", - r"# -*- coding: utf-8 -*-\n\g<0>") - - -# Workaround https://github.com/googleapis/gapic-generator/issues/2449 -s.replace( - "google/**/proto/cluster_service_pb2.py", - r"nodePool>\n", - r"nodePool>`__\n", -) -s.replace( - "google/**/proto/cluster_service_pb2.py", - r"(\s+)`__ instead", - r"\g<1>instead", -) - -# ---------------------------------------------------------------------------- -# Add templated files -# ---------------------------------------------------------------------------- -templated_files = common.py_library( - samples=False, # set to True only if there are samples - microgenerator=True, - cov_level=99, -) -s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file - - -# TODO(busunkim): Use latest sphinx after microgenerator transition -s.replace("noxfile.py", """['"]sphinx['"]""", '"sphinx<3.0.0"') - -# Temporarily disable warnings due to -# https://github.com/googleapis/gapic-generator-python/issues/525 -s.replace("noxfile.py", '[\"\']-W[\"\']', '# "-W"') - -s.shell.run(["nox", "-s", "blacken"], hide_output=False) From 6923eef728dfa77c1ff6c51ca1768ee16493a582 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 12:54:06 +0000 Subject: [PATCH 12/15] chore: upgrade gapic-generator-python to 0.46.3 (#96) PiperOrigin-RevId: 373649163 Source-Link: https://github.com/googleapis/googleapis/commit/7e1b14e6c7a9ab96d2db7e4a131981f162446d34 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0a3c7d272d697796db75857bac73905c68e498c3 --- docs/container_v1/cluster_manager.rst | 1 - docs/container_v1beta1/cluster_manager.rst | 1 - google/cloud/container/__init__.py | 20 +- google/cloud/container_v1/__init__.py | 11 +- google/cloud/container_v1/gapic_metadata.json | 343 +++ .../cloud/container_v1/services/__init__.py | 1 - .../services/cluster_manager/__init__.py | 2 - .../services/cluster_manager/async_client.py | 115 +- .../services/cluster_manager/client.py | 145 +- .../services/cluster_manager/pagers.py | 4 +- .../cluster_manager/transports/__init__.py | 2 - .../cluster_manager/transports/base.py | 317 +-- .../cluster_manager/transports/grpc.py | 28 +- .../transports/grpc_asyncio.py | 29 +- google/cloud/container_v1/types/__init__.py | 2 - .../container_v1/types/cluster_service.py | 1064 +++----- google/cloud/container_v1beta1/__init__.py | 15 +- .../container_v1beta1/gapic_metadata.json | 353 +++ .../container_v1beta1/services/__init__.py | 1 - .../services/cluster_manager/__init__.py | 2 - .../services/cluster_manager/async_client.py | 126 +- .../services/cluster_manager/client.py | 157 +- .../services/cluster_manager/pagers.py | 4 +- .../cluster_manager/transports/__init__.py | 2 - .../cluster_manager/transports/base.py | 329 +-- .../cluster_manager/transports/grpc.py | 28 +- .../transports/grpc_asyncio.py | 29 +- .../cloud/container_v1beta1/types/__init__.py | 2 - .../types/cluster_service.py | 1199 +++------ scripts/fixup_container_v1_keywords.py | 69 +- scripts/fixup_container_v1beta1_keywords.py | 71 +- tests/__init__.py | 15 + tests/unit/__init__.py | 15 + tests/unit/gapic/__init__.py | 15 + tests/unit/gapic/container_v1/__init__.py | 1 - .../container_v1/test_cluster_manager.py | 2115 ++++++---------- .../unit/gapic/container_v1beta1/__init__.py | 1 - .../container_v1beta1/test_cluster_manager.py | 2181 ++++++----------- 38 files changed, 3556 insertions(+), 5259 deletions(-) create mode 100644 google/cloud/container_v1/gapic_metadata.json create mode 100644 google/cloud/container_v1beta1/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/container_v1/cluster_manager.rst b/docs/container_v1/cluster_manager.rst index be77fd5e..dc27a3bd 100644 --- a/docs/container_v1/cluster_manager.rst +++ b/docs/container_v1/cluster_manager.rst @@ -5,7 +5,6 @@ ClusterManager :members: :inherited-members: - .. automodule:: google.cloud.container_v1.services.cluster_manager.pagers :members: :inherited-members: diff --git a/docs/container_v1beta1/cluster_manager.rst b/docs/container_v1beta1/cluster_manager.rst index e27c2b30..3a3a443d 100644 --- a/docs/container_v1beta1/cluster_manager.rst +++ b/docs/container_v1beta1/cluster_manager.rst @@ -5,7 +5,6 @@ ClusterManager :members: :inherited-members: - .. automodule:: google.cloud.container_v1beta1.services.cluster_manager.pagers :members: :inherited-members: diff --git a/google/cloud/container/__init__.py b/google/cloud/container/__init__.py index bc6619dc..618af61a 100644 --- a/google/cloud/container/__init__.py +++ b/google/cloud/container/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,19 +14,20 @@ # limitations under the License. # -from google.cloud.container_v1.services.cluster_manager.async_client import ( - ClusterManagerAsyncClient, -) from google.cloud.container_v1.services.cluster_manager.client import ( ClusterManagerClient, ) +from google.cloud.container_v1.services.cluster_manager.async_client import ( + ClusterManagerAsyncClient, +) + from google.cloud.container_v1.types.cluster_service import AcceleratorConfig from google.cloud.container_v1.types.cluster_service import AddonsConfig from google.cloud.container_v1.types.cluster_service import AuthenticatorGroupsConfig -from google.cloud.container_v1.types.cluster_service import AutoUpgradeOptions from google.cloud.container_v1.types.cluster_service import ( AutoprovisioningNodePoolDefaults, ) +from google.cloud.container_v1.types.cluster_service import AutoUpgradeOptions from google.cloud.container_v1.types.cluster_service import BinaryAuthorization from google.cloud.container_v1.types.cluster_service import CancelOperationRequest from google.cloud.container_v1.types.cluster_service import ClientCertificateConfig @@ -55,8 +55,8 @@ from google.cloud.container_v1.types.cluster_service import GetServerConfigRequest from google.cloud.container_v1.types.cluster_service import HorizontalPodAutoscaling from google.cloud.container_v1.types.cluster_service import HttpLoadBalancing -from google.cloud.container_v1.types.cluster_service import IPAllocationPolicy from google.cloud.container_v1.types.cluster_service import IntraNodeVisibilityConfig +from google.cloud.container_v1.types.cluster_service import IPAllocationPolicy from google.cloud.container_v1.types.cluster_service import Jwk from google.cloud.container_v1.types.cluster_service import KubernetesDashboard from google.cloud.container_v1.types.cluster_service import LegacyAbac @@ -132,19 +132,19 @@ from google.cloud.container_v1.types.cluster_service import WorkloadMetadataConfig __all__ = ( + "ClusterManagerClient", + "ClusterManagerAsyncClient", "AcceleratorConfig", "AddonsConfig", "AuthenticatorGroupsConfig", - "AutoUpgradeOptions", "AutoprovisioningNodePoolDefaults", + "AutoUpgradeOptions", "BinaryAuthorization", "CancelOperationRequest", "ClientCertificateConfig", "CloudRunConfig", "Cluster", "ClusterAutoscaling", - "ClusterManagerAsyncClient", - "ClusterManagerClient", "ClusterUpdate", "CompleteIPRotationRequest", "ConfigConnectorConfig", @@ -166,8 +166,8 @@ "GetServerConfigRequest", "HorizontalPodAutoscaling", "HttpLoadBalancing", - "IPAllocationPolicy", "IntraNodeVisibilityConfig", + "IPAllocationPolicy", "Jwk", "KubernetesDashboard", "LegacyAbac", diff --git a/google/cloud/container_v1/__init__.py b/google/cloud/container_v1/__init__.py index ce0ea9ad..620445a7 100644 --- a/google/cloud/container_v1/__init__.py +++ b/google/cloud/container_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,11 +15,13 @@ # from .services.cluster_manager import ClusterManagerClient +from .services.cluster_manager import ClusterManagerAsyncClient + from .types.cluster_service import AcceleratorConfig from .types.cluster_service import AddonsConfig from .types.cluster_service import AuthenticatorGroupsConfig -from .types.cluster_service import AutoUpgradeOptions from .types.cluster_service import AutoprovisioningNodePoolDefaults +from .types.cluster_service import AutoUpgradeOptions from .types.cluster_service import BinaryAuthorization from .types.cluster_service import CancelOperationRequest from .types.cluster_service import ClientCertificateConfig @@ -48,8 +49,8 @@ from .types.cluster_service import GetServerConfigRequest from .types.cluster_service import HorizontalPodAutoscaling from .types.cluster_service import HttpLoadBalancing -from .types.cluster_service import IPAllocationPolicy from .types.cluster_service import IntraNodeVisibilityConfig +from .types.cluster_service import IPAllocationPolicy from .types.cluster_service import Jwk from .types.cluster_service import KubernetesDashboard from .types.cluster_service import LegacyAbac @@ -112,8 +113,8 @@ from .types.cluster_service import WorkloadIdentityConfig from .types.cluster_service import WorkloadMetadataConfig - __all__ = ( + "ClusterManagerAsyncClient", "AcceleratorConfig", "AddonsConfig", "AuthenticatorGroupsConfig", @@ -125,6 +126,7 @@ "CloudRunConfig", "Cluster", "ClusterAutoscaling", + "ClusterManagerClient", "ClusterUpdate", "CompleteIPRotationRequest", "ConfigConnectorConfig", @@ -209,5 +211,4 @@ "VerticalPodAutoscaling", "WorkloadIdentityConfig", "WorkloadMetadataConfig", - "ClusterManagerClient", ) diff --git a/google/cloud/container_v1/gapic_metadata.json b/google/cloud/container_v1/gapic_metadata.json new file mode 100644 index 00000000..1638f865 --- /dev/null +++ b/google/cloud/container_v1/gapic_metadata.json @@ -0,0 +1,343 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.container_v1", + "protoPackage": "google.container.v1", + "schema": "1.0", + "services": { + "ClusterManager": { + "clients": { + "grpc": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + }, + "grpc-async": { + "libraryClient": "ClusterManagerAsyncClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + } + } + } + } +} diff --git a/google/cloud/container_v1/services/__init__.py b/google/cloud/container_v1/services/__init__.py index 42ffdf2b..4de65971 100644 --- a/google/cloud/container_v1/services/__init__.py +++ b/google/cloud/container_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/container_v1/services/cluster_manager/__init__.py b/google/cloud/container_v1/services/cluster_manager/__init__.py index 3b4fcb4d..c1624d28 100644 --- a/google/cloud/container_v1/services/cluster_manager/__init__.py +++ b/google/cloud/container_v1/services/cluster_manager/__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 ClusterManagerClient from .async_client import ClusterManagerAsyncClient diff --git a/google/cloud/container_v1/services/cluster_manager/async_client.py b/google/cloud/container_v1/services/cluster_manager/async_client.py index bec7be80..9f03cbbd 100644 --- a/google/cloud/container_v1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1/services/cluster_manager/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,15 +20,14 @@ 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.container_v1.services.cluster_manager import pagers from google.cloud.container_v1.types import cluster_service - from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport from .client import ClusterManagerClient @@ -50,24 +47,20 @@ class ClusterManagerAsyncClient: parse_common_billing_account_path = staticmethod( ClusterManagerClient.parse_common_billing_account_path ) - common_folder_path = staticmethod(ClusterManagerClient.common_folder_path) parse_common_folder_path = staticmethod( ClusterManagerClient.parse_common_folder_path ) - common_organization_path = staticmethod( ClusterManagerClient.common_organization_path ) parse_common_organization_path = staticmethod( ClusterManagerClient.parse_common_organization_path ) - common_project_path = staticmethod(ClusterManagerClient.common_project_path) parse_common_project_path = staticmethod( ClusterManagerClient.parse_common_project_path ) - common_location_path = staticmethod(ClusterManagerClient.common_location_path) parse_common_location_path = staticmethod( ClusterManagerClient.parse_common_location_path @@ -75,7 +68,8 @@ class ClusterManagerAsyncClient: @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) -> ClusterManagerTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: ClusterManagerTransport: The transport used by the client instance. @@ -121,12 +115,12 @@ def transport(self) -> ClusterManagerTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, ClusterManagerTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the cluster manager client. + """Instantiates the cluster manager 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 = ClusterManagerClient( credentials=credentials, transport=transport, @@ -212,7 +205,6 @@ async def list_clusters( This corresponds to the ``parent`` 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. @@ -239,7 +231,6 @@ async def list_clusters( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -256,7 +247,8 @@ async def list_clusters( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -330,7 +322,6 @@ async def get_cluster( 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. @@ -355,7 +346,6 @@ async def get_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -374,7 +364,8 @@ async def get_cluster( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -458,7 +449,6 @@ async def create_cluster( This corresponds to the ``parent`` 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. @@ -487,7 +477,6 @@ async def create_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -579,7 +568,6 @@ async def update_cluster( 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. @@ -608,7 +596,6 @@ async def update_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -655,7 +642,6 @@ async def update_node_pool( request (:class:`google.cloud.container_v1.types.UpdateNodePoolRequest`): The request object. UpdateNodePoolRequests update a node pool's image and/or version. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -671,7 +657,6 @@ async def update_node_pool( """ # Create or coerce a protobuf request object. - request = cluster_service.UpdateNodePoolRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -709,7 +694,6 @@ async def set_node_pool_autoscaling( request (:class:`google.cloud.container_v1.types.SetNodePoolAutoscalingRequest`): The request object. SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -725,7 +709,6 @@ async def set_node_pool_autoscaling( """ # Create or coerce a protobuf request object. - request = cluster_service.SetNodePoolAutoscalingRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -822,7 +805,6 @@ async def set_logging_service( 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. @@ -853,7 +835,6 @@ async def set_logging_service( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -961,7 +942,6 @@ async def set_monitoring_service( 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. @@ -992,7 +972,6 @@ async def set_monitoring_service( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1087,7 +1066,6 @@ async def set_addons_config( 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. @@ -1116,7 +1094,6 @@ async def set_addons_config( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1219,7 +1196,6 @@ async def set_locations( 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. @@ -1248,7 +1224,6 @@ async def set_locations( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1257,7 +1232,6 @@ async def set_locations( request.cluster_id = cluster_id if name is not None: request.name = name - if locations: request.locations.extend(locations) @@ -1355,7 +1329,6 @@ async def update_master( 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. @@ -1384,7 +1357,6 @@ async def update_master( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1433,7 +1405,6 @@ async def set_master_auth( request (:class:`google.cloud.container_v1.types.SetMasterAuthRequest`): The request object. SetMasterAuthRequest updates the admin password of a cluster. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1449,7 +1420,6 @@ async def set_master_auth( """ # Create or coerce a protobuf request object. - request = cluster_service.SetMasterAuthRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -1535,7 +1505,6 @@ async def delete_cluster( 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. @@ -1564,7 +1533,6 @@ async def delete_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1583,7 +1551,8 @@ async def delete_cluster( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -1640,7 +1609,6 @@ async def list_operations( This corresponds to the ``zone`` 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. @@ -1667,7 +1635,6 @@ async def list_operations( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1682,7 +1649,8 @@ async def list_operations( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -1755,7 +1723,6 @@ async def get_operation( 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. @@ -1784,7 +1751,6 @@ async def get_operation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1803,7 +1769,8 @@ async def get_operation( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -1876,7 +1843,6 @@ async def cancel_operation( 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. @@ -1897,7 +1863,6 @@ async def cancel_operation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1970,7 +1935,6 @@ async def get_server_config( 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. @@ -1997,7 +1961,6 @@ async def get_server_config( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2014,7 +1977,8 @@ async def get_server_config( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -2054,7 +2018,6 @@ async def get_json_web_keys( token requests. This will be the jwks_uri for the discover document returned by getOpenIDConfig. See the OpenID Connect Discovery 1.0 specification for details. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2069,7 +2032,6 @@ async def get_json_web_keys( """ # Create or coerce a protobuf request object. - request = cluster_service.GetJSONWebKeysRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -2145,7 +2107,6 @@ async def list_node_pools( This corresponds to the ``parent`` 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. @@ -2172,7 +2133,6 @@ async def list_node_pools( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2191,7 +2151,8 @@ async def list_node_pools( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -2273,7 +2234,6 @@ async def get_node_pool( 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. @@ -2308,7 +2268,6 @@ async def get_node_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2329,7 +2288,8 @@ async def get_node_pool( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -2408,7 +2368,6 @@ async def create_node_pool( This corresponds to the ``parent`` 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. @@ -2437,7 +2396,6 @@ async def create_node_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2532,7 +2490,6 @@ async def delete_node_pool( 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. @@ -2561,7 +2518,6 @@ async def delete_node_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2582,7 +2538,8 @@ async def delete_node_pool( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -2671,7 +2628,6 @@ async def rollback_node_pool_upgrade( 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. @@ -2700,7 +2656,6 @@ async def rollback_node_pool_upgrade( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2746,7 +2701,6 @@ async def set_node_pool_management( request (:class:`google.cloud.container_v1.types.SetNodePoolManagementRequest`): The request object. SetNodePoolManagementRequest sets the node management properties of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2762,7 +2716,6 @@ async def set_node_pool_management( """ # Create or coerce a protobuf request object. - request = cluster_service.SetNodePoolManagementRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -2801,7 +2754,6 @@ async def set_labels( Cloud Platform labels on a Google Container Engine cluster, which will in turn set them for Google Compute Engine resources used by that cluster - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2817,7 +2769,6 @@ async def set_labels( """ # Create or coerce a protobuf request object. - request = cluster_service.SetLabelsRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -2903,7 +2854,6 @@ async def set_legacy_abac( 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. @@ -2932,7 +2882,6 @@ async def set_legacy_abac( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3018,7 +2967,6 @@ async def start_ip_rotation( 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. @@ -3047,7 +2995,6 @@ async def start_ip_rotation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3130,7 +3077,6 @@ async def complete_ip_rotation( 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. @@ -3159,7 +3105,6 @@ async def complete_ip_rotation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3203,7 +3148,6 @@ async def set_node_pool_size( request (:class:`google.cloud.container_v1.types.SetNodePoolSizeRequest`): The request object. SetNodePoolSizeRequest sets the size a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3219,7 +3163,6 @@ async def set_node_pool_size( """ # Create or coerce a protobuf request object. - request = cluster_service.SetNodePoolSizeRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -3303,7 +3246,6 @@ async def set_network_policy( 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. @@ -3332,7 +3274,6 @@ async def set_network_policy( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3422,7 +3363,6 @@ async def set_maintenance_policy( 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. @@ -3453,7 +3393,6 @@ async def set_maintenance_policy( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3501,7 +3440,6 @@ async def list_usable_subnetworks( The request object. ListUsableSubnetworksRequest requests the list of usable subnetworks available to a user for creating clusters. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3520,7 +3458,6 @@ async def list_usable_subnetworks( """ # Create or coerce a protobuf request object. - request = cluster_service.ListUsableSubnetworksRequest(request) # Wrap the RPC method; this adds retry and timeout information, diff --git a/google/cloud/container_v1/services/cluster_manager/client.py b/google/cloud/container_v1/services/cluster_manager/client.py index 9ff4d7a5..6793154a 100644 --- a/google/cloud/container_v1/services/cluster_manager/client.py +++ b/google/cloud/container_v1/services/cluster_manager/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 @@ -34,7 +32,6 @@ from google.cloud.container_v1.services.cluster_manager import pagers from google.cloud.container_v1.types import cluster_service - from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ClusterManagerGrpcTransport from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport @@ -55,7 +52,7 @@ class ClusterManagerClientMeta(type): _transport_registry["grpc_asyncio"] = ClusterManagerGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[ClusterManagerTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -78,7 +75,8 @@ class ClusterManagerClient(metaclass=ClusterManagerClientMeta): @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: @@ -112,7 +110,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. @@ -129,7 +128,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 @@ -148,16 +147,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> ClusterManagerTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - ClusterManagerTransport: The transport used by the client instance. + ClusterManagerTransport: 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, ) @@ -170,7 +170,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 @@ -181,7 +181,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 @@ -192,7 +192,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 @@ -203,7 +203,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, ) @@ -217,12 +217,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, ClusterManagerTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the cluster manager client. + """Instantiates the cluster manager client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -277,9 +277,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: @@ -291,12 +292,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. @@ -311,8 +314,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: @@ -373,7 +376,6 @@ def list_clusters( This corresponds to the ``parent`` 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. @@ -402,10 +404,8 @@ def list_clusters( # there are no flattened fields. if not isinstance(request, cluster_service.ListClustersRequest): request = cluster_service.ListClustersRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -483,7 +483,6 @@ def get_cluster( 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. @@ -510,10 +509,8 @@ def get_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.GetClusterRequest): request = cluster_service.GetClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -603,7 +600,6 @@ def create_cluster( This corresponds to the ``parent`` 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. @@ -634,10 +630,8 @@ def create_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.CreateClusterRequest): request = cluster_service.CreateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -725,7 +719,6 @@ def update_cluster( 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. @@ -756,10 +749,8 @@ def update_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.UpdateClusterRequest): request = cluster_service.UpdateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -802,7 +793,6 @@ def update_node_pool( request (google.cloud.container_v1.types.UpdateNodePoolRequest): The request object. UpdateNodePoolRequests update a node pool's image and/or version. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -818,7 +808,6 @@ def update_node_pool( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.UpdateNodePoolRequest. # There's no risk of modifying the input as we've already verified @@ -857,7 +846,6 @@ def set_node_pool_autoscaling( request (google.cloud.container_v1.types.SetNodePoolAutoscalingRequest): The request object. SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -873,7 +861,6 @@ def set_node_pool_autoscaling( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetNodePoolAutoscalingRequest. # There's no risk of modifying the input as we've already verified @@ -973,7 +960,6 @@ def set_logging_service( 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. @@ -1006,10 +992,8 @@ def set_logging_service( # there are no flattened fields. if not isinstance(request, cluster_service.SetLoggingServiceRequest): request = cluster_service.SetLoggingServiceRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1113,7 +1097,6 @@ def set_monitoring_service( 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. @@ -1146,10 +1129,8 @@ def set_monitoring_service( # there are no flattened fields. if not isinstance(request, cluster_service.SetMonitoringServiceRequest): request = cluster_service.SetMonitoringServiceRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1240,7 +1221,6 @@ def set_addons_config( 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. @@ -1271,10 +1251,8 @@ def set_addons_config( # there are no flattened fields. if not isinstance(request, cluster_service.SetAddonsConfigRequest): request = cluster_service.SetAddonsConfigRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1373,7 +1351,6 @@ def set_locations( 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. @@ -1404,10 +1381,8 @@ def set_locations( # there are no flattened fields. if not isinstance(request, cluster_service.SetLocationsRequest): request = cluster_service.SetLocationsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1509,7 +1484,6 @@ def update_master( 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. @@ -1540,10 +1514,8 @@ def update_master( # there are no flattened fields. if not isinstance(request, cluster_service.UpdateMasterRequest): request = cluster_service.UpdateMasterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1588,7 +1560,6 @@ def set_master_auth( request (google.cloud.container_v1.types.SetMasterAuthRequest): The request object. SetMasterAuthRequest updates the admin password of a cluster. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1604,7 +1575,6 @@ def set_master_auth( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetMasterAuthRequest. # There's no risk of modifying the input as we've already verified @@ -1691,7 +1661,6 @@ def delete_cluster( 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. @@ -1722,10 +1691,8 @@ def delete_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.DeleteClusterRequest): request = cluster_service.DeleteClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1788,7 +1755,6 @@ def list_operations( This corresponds to the ``zone`` 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. @@ -1817,10 +1783,8 @@ def list_operations( # there are no flattened fields. if not isinstance(request, cluster_service.ListOperationsRequest): request = cluster_service.ListOperationsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1895,7 +1859,6 @@ def get_operation( 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. @@ -1926,10 +1889,8 @@ def get_operation( # there are no flattened fields. if not isinstance(request, cluster_service.GetOperationRequest): request = cluster_service.GetOperationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2008,7 +1969,6 @@ def cancel_operation( 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. @@ -2031,10 +1991,8 @@ def cancel_operation( # there are no flattened fields. if not isinstance(request, cluster_service.CancelOperationRequest): request = cluster_service.CancelOperationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2103,7 +2061,6 @@ def get_server_config( 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. @@ -2132,10 +2089,8 @@ def get_server_config( # there are no flattened fields. if not isinstance(request, cluster_service.GetServerConfigRequest): request = cluster_service.GetServerConfigRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2179,7 +2134,6 @@ def get_json_web_keys( token requests. This will be the jwks_uri for the discover document returned by getOpenIDConfig. See the OpenID Connect Discovery 1.0 specification for details. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2194,7 +2148,6 @@ def get_json_web_keys( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.GetJSONWebKeysRequest. # There's no risk of modifying the input as we've already verified @@ -2271,7 +2224,6 @@ def list_node_pools( This corresponds to the ``parent`` 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. @@ -2300,10 +2252,8 @@ def list_node_pools( # there are no flattened fields. if not isinstance(request, cluster_service.ListNodePoolsRequest): request = cluster_service.ListNodePoolsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2391,7 +2341,6 @@ def get_node_pool( 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. @@ -2428,10 +2377,8 @@ def get_node_pool( # there are no flattened fields. if not isinstance(request, cluster_service.GetNodePoolRequest): request = cluster_service.GetNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2518,7 +2465,6 @@ def create_node_pool( This corresponds to the ``parent`` 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. @@ -2549,10 +2495,8 @@ def create_node_pool( # there are no flattened fields. if not isinstance(request, cluster_service.CreateNodePoolRequest): request = cluster_service.CreateNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2643,7 +2587,6 @@ def delete_node_pool( 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. @@ -2674,10 +2617,8 @@ def delete_node_pool( # there are no flattened fields. if not isinstance(request, cluster_service.DeleteNodePoolRequest): request = cluster_service.DeleteNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2774,7 +2715,6 @@ def rollback_node_pool_upgrade( 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. @@ -2805,10 +2745,8 @@ def rollback_node_pool_upgrade( # there are no flattened fields. if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): request = cluster_service.RollbackNodePoolUpgradeRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2852,7 +2790,6 @@ def set_node_pool_management( request (google.cloud.container_v1.types.SetNodePoolManagementRequest): The request object. SetNodePoolManagementRequest sets the node management properties of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2868,7 +2805,6 @@ def set_node_pool_management( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetNodePoolManagementRequest. # There's no risk of modifying the input as we've already verified @@ -2908,7 +2844,6 @@ def set_labels( Cloud Platform labels on a Google Container Engine cluster, which will in turn set them for Google Compute Engine resources used by that cluster - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2924,7 +2859,6 @@ def set_labels( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetLabelsRequest. # There's no risk of modifying the input as we've already verified @@ -3011,7 +2945,6 @@ def set_legacy_abac( 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. @@ -3042,10 +2975,8 @@ def set_legacy_abac( # there are no flattened fields. if not isinstance(request, cluster_service.SetLegacyAbacRequest): request = cluster_service.SetLegacyAbacRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3127,7 +3058,6 @@ def start_ip_rotation( 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. @@ -3158,10 +3088,8 @@ def start_ip_rotation( # there are no flattened fields. if not isinstance(request, cluster_service.StartIPRotationRequest): request = cluster_service.StartIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3240,7 +3168,6 @@ def complete_ip_rotation( 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. @@ -3271,10 +3198,8 @@ def complete_ip_rotation( # there are no flattened fields. if not isinstance(request, cluster_service.CompleteIPRotationRequest): request = cluster_service.CompleteIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3314,7 +3239,6 @@ def set_node_pool_size( request (google.cloud.container_v1.types.SetNodePoolSizeRequest): The request object. SetNodePoolSizeRequest sets the size a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3330,7 +3254,6 @@ def set_node_pool_size( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetNodePoolSizeRequest. # There's no risk of modifying the input as we've already verified @@ -3415,7 +3338,6 @@ def set_network_policy( 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. @@ -3446,10 +3368,8 @@ def set_network_policy( # there are no flattened fields. if not isinstance(request, cluster_service.SetNetworkPolicyRequest): request = cluster_service.SetNetworkPolicyRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3535,7 +3455,6 @@ def set_maintenance_policy( 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. @@ -3568,10 +3487,8 @@ def set_maintenance_policy( # there are no flattened fields. if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): request = cluster_service.SetMaintenancePolicyRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3615,7 +3532,6 @@ def list_usable_subnetworks( The request object. ListUsableSubnetworksRequest requests the list of usable subnetworks available to a user for creating clusters. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3634,7 +3550,6 @@ def list_usable_subnetworks( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.ListUsableSubnetworksRequest. # There's no risk of modifying the input as we've already verified diff --git a/google/cloud/container_v1/services/cluster_manager/pagers.py b/google/cloud/container_v1/services/cluster_manager/pagers.py index e2a2aac9..b726203a 100644 --- a/google/cloud/container_v1/services/cluster_manager/pagers.py +++ b/google/cloud/container_v1/services/cluster_manager/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, @@ -117,7 +115,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/container_v1/services/cluster_manager/transports/__init__.py b/google/cloud/container_v1/services/cluster_manager/transports/__init__.py index 554ca670..11ad942a 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/__init__.py +++ b/google/cloud/container_v1/services/cluster_manager/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/container_v1/services/cluster_manager/transports/base.py b/google/cloud/container_v1/services/cluster_manager/transports/base.py index e237c85d..2c2d568e 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/base.py +++ b/google/cloud/container_v1/services/cluster_manager/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.container_v1.types import cluster_service -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( @@ -36,27 +35,41 @@ 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 ClusterManagerTransport(abc.ABC): """Abstract transport class for ClusterManager.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + DEFAULT_HOST: str = "container.googleapis.com" + def __init__( self, *, - host: str = "container.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 @@ -65,7 +78,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): @@ -79,29 +92,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 = { @@ -112,7 +172,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -126,7 +187,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -174,7 +236,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -188,7 +251,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -202,7 +266,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -219,7 +284,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -236,7 +302,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -250,7 +317,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -267,7 +335,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -319,11 +388,11 @@ def _prep_wrapped_messages(self, client_info): @property def list_clusters( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListClustersRequest], - typing.Union[ + Union[ cluster_service.ListClustersResponse, - typing.Awaitable[cluster_service.ListClustersResponse], + Awaitable[cluster_service.ListClustersResponse], ], ]: raise NotImplementedError() @@ -331,143 +400,119 @@ def list_clusters( @property def get_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetClusterRequest], - typing.Union[ - cluster_service.Cluster, typing.Awaitable[cluster_service.Cluster] - ], + Union[cluster_service.Cluster, Awaitable[cluster_service.Cluster]], ]: raise NotImplementedError() @property def create_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CreateClusterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def update_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.UpdateClusterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def update_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.UpdateNodePoolRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_node_pool_autoscaling( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNodePoolAutoscalingRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_logging_service( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLoggingServiceRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_monitoring_service( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetMonitoringServiceRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_addons_config( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetAddonsConfigRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_locations( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLocationsRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def update_master( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.UpdateMasterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_master_auth( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetMasterAuthRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def delete_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.DeleteClusterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def list_operations( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListOperationsRequest], - typing.Union[ + Union[ cluster_service.ListOperationsResponse, - typing.Awaitable[cluster_service.ListOperationsResponse], + Awaitable[cluster_service.ListOperationsResponse], ], ]: raise NotImplementedError() @@ -475,42 +520,38 @@ def list_operations( @property def get_operation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetOperationRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def cancel_operation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CancelOperationRequest], - typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], ]: raise NotImplementedError() @property def get_server_config( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetServerConfigRequest], - typing.Union[ - cluster_service.ServerConfig, typing.Awaitable[cluster_service.ServerConfig] - ], + Union[cluster_service.ServerConfig, Awaitable[cluster_service.ServerConfig]], ]: raise NotImplementedError() @property def get_json_web_keys( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetJSONWebKeysRequest], - typing.Union[ + Union[ cluster_service.GetJSONWebKeysResponse, - typing.Awaitable[cluster_service.GetJSONWebKeysResponse], + Awaitable[cluster_service.GetJSONWebKeysResponse], ], ]: raise NotImplementedError() @@ -518,11 +559,11 @@ def get_json_web_keys( @property def list_node_pools( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListNodePoolsRequest], - typing.Union[ + Union[ cluster_service.ListNodePoolsResponse, - typing.Awaitable[cluster_service.ListNodePoolsResponse], + Awaitable[cluster_service.ListNodePoolsResponse], ], ]: raise NotImplementedError() @@ -530,143 +571,119 @@ def list_node_pools( @property def get_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetNodePoolRequest], - typing.Union[ - cluster_service.NodePool, typing.Awaitable[cluster_service.NodePool] - ], + Union[cluster_service.NodePool, Awaitable[cluster_service.NodePool]], ]: raise NotImplementedError() @property def create_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CreateNodePoolRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def delete_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.DeleteNodePoolRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def rollback_node_pool_upgrade( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.RollbackNodePoolUpgradeRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_node_pool_management( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNodePoolManagementRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_labels( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLabelsRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_legacy_abac( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLegacyAbacRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def start_ip_rotation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.StartIPRotationRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def complete_ip_rotation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CompleteIPRotationRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_node_pool_size( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNodePoolSizeRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_network_policy( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNetworkPolicyRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_maintenance_policy( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetMaintenancePolicyRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def list_usable_subnetworks( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListUsableSubnetworksRequest], - typing.Union[ + Union[ cluster_service.ListUsableSubnetworksResponse, - typing.Awaitable[cluster_service.ListUsableSubnetworksResponse], + Awaitable[cluster_service.ListUsableSubnetworksResponse], ], ]: raise NotImplementedError() diff --git a/google/cloud/container_v1/services/cluster_manager/transports/grpc.py b/google/cloud/container_v1/services/cluster_manager/transports/grpc.py index c33ecaf6..7bf6f3f7 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/grpc.py +++ b/google/cloud/container_v1/services/cluster_manager/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,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 +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.container_v1.types import cluster_service -from google.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO @@ -51,7 +48,7 @@ def __init__( self, *, host: str = "container.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -65,7 +62,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 @@ -175,7 +173,7 @@ def __init__( def create_channel( cls, host: str = "container.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, @@ -206,13 +204,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, ) @@ -655,7 +655,7 @@ def get_operation( @property def cancel_operation( self, - ) -> Callable[[cluster_service.CancelOperationRequest], empty.Empty]: + ) -> Callable[[cluster_service.CancelOperationRequest], empty_pb2.Empty]: r"""Return a callable for the cancel operation method over gRPC. Cancels the specified operation. @@ -674,7 +674,7 @@ def cancel_operation( self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( "/google.container.v1.ClusterManager/CancelOperation", request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["cancel_operation"] diff --git a/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py b/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py index 385c0e06..e22d694a 100644 --- a/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py +++ b/google/cloud/container_v1/services/cluster_manager/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,22 +13,20 @@ # 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.container_v1.types import cluster_service -from google.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO from .grpc import ClusterManagerGrpcTransport @@ -54,7 +51,7 @@ class ClusterManagerGrpcAsyncIOTransport(ClusterManagerTransport): def create_channel( cls, host: str = "container.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, @@ -81,13 +78,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, ) @@ -95,7 +94,7 @@ def __init__( self, *, host: str = "container.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, @@ -109,7 +108,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 @@ -167,7 +167,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 @@ -683,7 +682,7 @@ def get_operation( @property def cancel_operation( self, - ) -> Callable[[cluster_service.CancelOperationRequest], Awaitable[empty.Empty]]: + ) -> Callable[[cluster_service.CancelOperationRequest], Awaitable[empty_pb2.Empty]]: r"""Return a callable for the cancel operation method over gRPC. Cancels the specified operation. @@ -702,7 +701,7 @@ def cancel_operation( self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( "/google.container.v1.ClusterManager/CancelOperation", request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["cancel_operation"] diff --git a/google/cloud/container_v1/types/__init__.py b/google/cloud/container_v1/types/__init__.py index a20fef06..f11f3ff7 100644 --- a/google/cloud/container_v1/types/__init__.py +++ b/google/cloud/container_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 .cluster_service import ( AcceleratorConfig, AddonsConfig, diff --git a/google/cloud/container_v1/types/cluster_service.py b/google/cloud/container_v1/types/cluster_service.py index f8a90da9..937edbec 100644 --- a/google/cloud/container_v1/types/cluster_service.py +++ b/google/cloud/container_v1/types/cluster_service.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( @@ -125,7 +122,6 @@ class NodeConfig(proto.Message): r"""Parameters that describe the nodes in a cluster. - Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -292,58 +288,38 @@ class NodeConfig(proto.Message): https://cloud.google.com/compute/docs/disks/customer-managed-encryption """ - machine_type = proto.Field(proto.STRING, number=1) - - disk_size_gb = proto.Field(proto.INT32, number=2) - - oauth_scopes = proto.RepeatedField(proto.STRING, number=3) - - service_account = proto.Field(proto.STRING, number=9) - - metadata = proto.MapField(proto.STRING, proto.STRING, number=4) - - image_type = proto.Field(proto.STRING, number=5) - - labels = proto.MapField(proto.STRING, proto.STRING, number=6) - - local_ssd_count = proto.Field(proto.INT32, number=7) - - tags = proto.RepeatedField(proto.STRING, number=8) - - preemptible = proto.Field(proto.BOOL, number=10) - + machine_type = proto.Field(proto.STRING, number=1,) + disk_size_gb = proto.Field(proto.INT32, number=2,) + oauth_scopes = proto.RepeatedField(proto.STRING, number=3,) + service_account = proto.Field(proto.STRING, number=9,) + metadata = proto.MapField(proto.STRING, proto.STRING, number=4,) + image_type = proto.Field(proto.STRING, number=5,) + labels = proto.MapField(proto.STRING, proto.STRING, number=6,) + local_ssd_count = proto.Field(proto.INT32, number=7,) + tags = proto.RepeatedField(proto.STRING, number=8,) + preemptible = proto.Field(proto.BOOL, number=10,) accelerators = proto.RepeatedField( proto.MESSAGE, number=11, message="AcceleratorConfig", ) - - disk_type = proto.Field(proto.STRING, number=12) - - min_cpu_platform = proto.Field(proto.STRING, number=13) - + disk_type = proto.Field(proto.STRING, number=12,) + min_cpu_platform = proto.Field(proto.STRING, number=13,) workload_metadata_config = proto.Field( proto.MESSAGE, number=14, message="WorkloadMetadataConfig", ) - taints = proto.RepeatedField(proto.MESSAGE, number=15, message="NodeTaint",) - sandbox_config = proto.Field(proto.MESSAGE, number=17, message="SandboxConfig",) - - node_group = proto.Field(proto.STRING, number=18) - + node_group = proto.Field(proto.STRING, number=18,) reservation_affinity = proto.Field( proto.MESSAGE, number=19, message="ReservationAffinity", ) - shielded_instance_config = proto.Field( proto.MESSAGE, number=20, message="ShieldedInstanceConfig", ) - - boot_disk_kms_key = proto.Field(proto.STRING, number=23) + boot_disk_kms_key = proto.Field(proto.STRING, number=23,) class ShieldedInstanceConfig(proto.Message): r"""A set of Shielded Instance options. - Attributes: enable_secure_boot (bool): Defines whether the instance has Secure Boot @@ -364,9 +340,8 @@ class ShieldedInstanceConfig(proto.Message): is created. """ - enable_secure_boot = proto.Field(proto.BOOL, number=1) - - enable_integrity_monitoring = proto.Field(proto.BOOL, number=2) + enable_secure_boot = proto.Field(proto.BOOL, number=1,) + enable_integrity_monitoring = proto.Field(proto.BOOL, number=2,) class SandboxConfig(proto.Message): @@ -415,10 +390,8 @@ class Type(proto.Enum): SPECIFIC_RESERVATION = 3 consume_reservation_type = proto.Field(proto.ENUM, number=1, enum=Type,) - - key = proto.Field(proto.STRING, number=2) - - values = proto.RepeatedField(proto.STRING, number=3) + key = proto.Field(proto.STRING, number=2,) + values = proto.RepeatedField(proto.STRING, number=3,) class NodeTaint(proto.Message): @@ -446,10 +419,8 @@ class Effect(proto.Enum): PREFER_NO_SCHEDULE = 2 NO_EXECUTE = 3 - key = proto.Field(proto.STRING, number=1) - - value = proto.Field(proto.STRING, number=2) - + key = proto.Field(proto.STRING, number=1,) + value = proto.Field(proto.STRING, number=2,) effect = proto.Field(proto.ENUM, number=3, enum=Effect,) @@ -501,30 +472,24 @@ class MasterAuth(proto.Message): authenticate to the cluster endpoint. """ - username = proto.Field(proto.STRING, number=1) - - password = proto.Field(proto.STRING, number=2) - + username = proto.Field(proto.STRING, number=1,) + password = proto.Field(proto.STRING, number=2,) client_certificate_config = proto.Field( proto.MESSAGE, number=3, message="ClientCertificateConfig", ) - - cluster_ca_certificate = proto.Field(proto.STRING, number=100) - - client_certificate = proto.Field(proto.STRING, number=101) - - client_key = proto.Field(proto.STRING, number=102) + cluster_ca_certificate = proto.Field(proto.STRING, number=100,) + client_certificate = proto.Field(proto.STRING, number=101,) + client_key = proto.Field(proto.STRING, number=102,) class ClientCertificateConfig(proto.Message): r"""Configuration for client certificates on the cluster. - Attributes: issue_client_certificate (bool): Issue a client certificate. """ - issue_client_certificate = proto.Field(proto.BOOL, number=1) + issue_client_certificate = proto.Field(proto.BOOL, number=1,) class AddonsConfig(proto.Message): @@ -573,23 +538,17 @@ class AddonsConfig(proto.Message): http_load_balancing = proto.Field( proto.MESSAGE, number=1, message="HttpLoadBalancing", ) - horizontal_pod_autoscaling = proto.Field( proto.MESSAGE, number=2, message="HorizontalPodAutoscaling", ) - kubernetes_dashboard = proto.Field( proto.MESSAGE, number=3, message="KubernetesDashboard", ) - network_policy_config = proto.Field( proto.MESSAGE, number=4, message="NetworkPolicyConfig", ) - cloud_run_config = proto.Field(proto.MESSAGE, number=7, message="CloudRunConfig",) - dns_cache_config = proto.Field(proto.MESSAGE, number=8, message="DnsCacheConfig",) - config_connector_config = proto.Field( proto.MESSAGE, number=10, message="ConfigConnectorConfig", ) @@ -608,7 +567,7 @@ class HttpLoadBalancing(proto.Message): balancers. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class HorizontalPodAutoscaling(proto.Message): @@ -625,19 +584,18 @@ class HorizontalPodAutoscaling(proto.Message): Stackdriver Monitoring. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class KubernetesDashboard(proto.Message): r"""Configuration for the Kubernetes Dashboard. - Attributes: disabled (bool): Whether the Kubernetes Dashboard is enabled for this cluster. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class NetworkPolicyConfig(proto.Message): @@ -651,36 +609,33 @@ class NetworkPolicyConfig(proto.Message): cluster. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class DnsCacheConfig(proto.Message): r"""Configuration for NodeLocal DNSCache - Attributes: enabled (bool): Whether NodeLocal DNSCache is enabled for this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class PrivateClusterMasterGlobalAccessConfig(proto.Message): r"""Configuration for controlling master global access settings. - Attributes: enabled (bool): Whenever master is accessible globally or not. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class PrivateClusterConfig(proto.Message): r"""Configuration options for private clusters. - Attributes: enable_private_nodes (bool): Whether nodes have internal IP addresses @@ -710,18 +665,12 @@ class PrivateClusterConfig(proto.Message): Controls master global access settings. """ - enable_private_nodes = proto.Field(proto.BOOL, number=1) - - enable_private_endpoint = proto.Field(proto.BOOL, number=2) - - master_ipv4_cidr_block = proto.Field(proto.STRING, number=3) - - private_endpoint = proto.Field(proto.STRING, number=4) - - public_endpoint = proto.Field(proto.STRING, number=5) - - peering_name = proto.Field(proto.STRING, number=7) - + enable_private_nodes = proto.Field(proto.BOOL, number=1,) + enable_private_endpoint = proto.Field(proto.BOOL, number=2,) + master_ipv4_cidr_block = proto.Field(proto.STRING, number=3,) + private_endpoint = proto.Field(proto.STRING, number=4,) + public_endpoint = proto.Field(proto.STRING, number=5,) + peering_name = proto.Field(proto.STRING, number=7,) master_global_access_config = proto.Field( proto.MESSAGE, number=8, message="PrivateClusterMasterGlobalAccessConfig", ) @@ -741,14 +690,12 @@ class AuthenticatorGroupsConfig(proto.Message): be used. Only relevant if enabled = true. """ - enabled = proto.Field(proto.BOOL, number=1) - - security_group = proto.Field(proto.STRING, number=2) + enabled = proto.Field(proto.BOOL, number=1,) + security_group = proto.Field(proto.STRING, number=2,) class CloudRunConfig(proto.Message): r"""Configuration options for the Cloud Run feature. - Attributes: disabled (bool): Whether Cloud Run addon is enabled for this @@ -764,21 +711,19 @@ class LoadBalancerType(proto.Enum): LOAD_BALANCER_TYPE_EXTERNAL = 1 LOAD_BALANCER_TYPE_INTERNAL = 2 - disabled = proto.Field(proto.BOOL, number=1) - + disabled = proto.Field(proto.BOOL, number=1,) load_balancer_type = proto.Field(proto.ENUM, number=3, enum=LoadBalancerType,) class ConfigConnectorConfig(proto.Message): r"""Configuration options for the Config Connector add-on. - Attributes: enabled (bool): Whether Cloud Connector is enabled for this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class MasterAuthorizedNetworksConfig(proto.Message): @@ -799,7 +744,6 @@ class MasterAuthorizedNetworksConfig(proto.Message): class CidrBlock(proto.Message): r"""CidrBlock contains an optional name and one CIDR block. - Attributes: display_name (str): display_name is an optional field for users to identify CIDR @@ -808,12 +752,10 @@ class CidrBlock(proto.Message): cidr_block must be specified in CIDR notation. """ - display_name = proto.Field(proto.STRING, number=1) - - cidr_block = proto.Field(proto.STRING, number=2) - - enabled = proto.Field(proto.BOOL, number=1) + display_name = proto.Field(proto.STRING, number=1,) + cidr_block = proto.Field(proto.STRING, number=2,) + enabled = proto.Field(proto.BOOL, number=1,) cidr_blocks = proto.RepeatedField(proto.MESSAGE, number=2, message=CidrBlock,) @@ -831,7 +773,7 @@ class LegacyAbac(proto.Message): configuration or IAM. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class NetworkPolicy(proto.Message): @@ -853,13 +795,11 @@ class Provider(proto.Enum): CALICO = 1 provider = proto.Field(proto.ENUM, number=1, enum=Provider,) - - enabled = proto.Field(proto.BOOL, number=2) + enabled = proto.Field(proto.BOOL, number=2,) class BinaryAuthorization(proto.Message): r"""Configuration for Binary Authorization. - Attributes: enabled (bool): Enable Binary Authorization for this cluster. @@ -867,7 +807,7 @@ class BinaryAuthorization(proto.Message): validated by Binary Authorization. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class IPAllocationPolicy(proto.Message): @@ -990,36 +930,23 @@ class IPAllocationPolicy(proto.Message): allocation mode """ - use_ip_aliases = proto.Field(proto.BOOL, number=1) - - create_subnetwork = proto.Field(proto.BOOL, number=2) - - subnetwork_name = proto.Field(proto.STRING, number=3) - - cluster_ipv4_cidr = proto.Field(proto.STRING, number=4) - - node_ipv4_cidr = proto.Field(proto.STRING, number=5) - - services_ipv4_cidr = proto.Field(proto.STRING, number=6) - - cluster_secondary_range_name = proto.Field(proto.STRING, number=7) - - services_secondary_range_name = proto.Field(proto.STRING, number=8) - - cluster_ipv4_cidr_block = proto.Field(proto.STRING, number=9) - - node_ipv4_cidr_block = proto.Field(proto.STRING, number=10) - - services_ipv4_cidr_block = proto.Field(proto.STRING, number=11) - - tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=13) - - use_routes = proto.Field(proto.BOOL, number=15) + use_ip_aliases = proto.Field(proto.BOOL, number=1,) + create_subnetwork = proto.Field(proto.BOOL, number=2,) + subnetwork_name = proto.Field(proto.STRING, number=3,) + cluster_ipv4_cidr = proto.Field(proto.STRING, number=4,) + node_ipv4_cidr = proto.Field(proto.STRING, number=5,) + services_ipv4_cidr = proto.Field(proto.STRING, number=6,) + cluster_secondary_range_name = proto.Field(proto.STRING, number=7,) + services_secondary_range_name = proto.Field(proto.STRING, number=8,) + cluster_ipv4_cidr_block = proto.Field(proto.STRING, number=9,) + node_ipv4_cidr_block = proto.Field(proto.STRING, number=10,) + services_ipv4_cidr_block = proto.Field(proto.STRING, number=11,) + tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=13,) + use_routes = proto.Field(proto.BOOL, number=15,) class Cluster(proto.Message): r"""A Google Kubernetes Engine cluster. - Attributes: name (str): The name of this cluster. The name must be unique within @@ -1293,128 +1220,78 @@ class Status(proto.Enum): ERROR = 5 DEGRADED = 6 - name = proto.Field(proto.STRING, number=1) - - description = proto.Field(proto.STRING, number=2) - - initial_node_count = proto.Field(proto.INT32, number=3) - + name = proto.Field(proto.STRING, number=1,) + description = proto.Field(proto.STRING, number=2,) + initial_node_count = proto.Field(proto.INT32, number=3,) node_config = proto.Field(proto.MESSAGE, number=4, message="NodeConfig",) - master_auth = proto.Field(proto.MESSAGE, number=5, message="MasterAuth",) - - logging_service = proto.Field(proto.STRING, number=6) - - monitoring_service = proto.Field(proto.STRING, number=7) - - network = proto.Field(proto.STRING, number=8) - - cluster_ipv4_cidr = proto.Field(proto.STRING, number=9) - + logging_service = proto.Field(proto.STRING, number=6,) + monitoring_service = proto.Field(proto.STRING, number=7,) + network = proto.Field(proto.STRING, number=8,) + cluster_ipv4_cidr = proto.Field(proto.STRING, number=9,) addons_config = proto.Field(proto.MESSAGE, number=10, message="AddonsConfig",) - - subnetwork = proto.Field(proto.STRING, number=11) - + subnetwork = proto.Field(proto.STRING, number=11,) node_pools = proto.RepeatedField(proto.MESSAGE, number=12, message="NodePool",) - - locations = proto.RepeatedField(proto.STRING, number=13) - - enable_kubernetes_alpha = proto.Field(proto.BOOL, number=14) - - resource_labels = proto.MapField(proto.STRING, proto.STRING, number=15) - - label_fingerprint = proto.Field(proto.STRING, number=16) - + locations = proto.RepeatedField(proto.STRING, number=13,) + enable_kubernetes_alpha = proto.Field(proto.BOOL, number=14,) + resource_labels = proto.MapField(proto.STRING, proto.STRING, number=15,) + label_fingerprint = proto.Field(proto.STRING, number=16,) legacy_abac = proto.Field(proto.MESSAGE, number=18, message="LegacyAbac",) - network_policy = proto.Field(proto.MESSAGE, number=19, message="NetworkPolicy",) - ip_allocation_policy = proto.Field( proto.MESSAGE, number=20, message="IPAllocationPolicy", ) - master_authorized_networks_config = proto.Field( proto.MESSAGE, number=22, message="MasterAuthorizedNetworksConfig", ) - maintenance_policy = proto.Field( proto.MESSAGE, number=23, message="MaintenancePolicy", ) - binary_authorization = proto.Field( proto.MESSAGE, number=24, message="BinaryAuthorization", ) - autoscaling = proto.Field(proto.MESSAGE, number=26, message="ClusterAutoscaling",) - network_config = proto.Field(proto.MESSAGE, number=27, message="NetworkConfig",) - default_max_pods_constraint = proto.Field( proto.MESSAGE, number=30, message="MaxPodsConstraint", ) - resource_usage_export_config = proto.Field( proto.MESSAGE, number=33, message="ResourceUsageExportConfig", ) - authenticator_groups_config = proto.Field( proto.MESSAGE, number=34, message="AuthenticatorGroupsConfig", ) - private_cluster_config = proto.Field( proto.MESSAGE, number=37, message="PrivateClusterConfig", ) - database_encryption = proto.Field( proto.MESSAGE, number=38, message="DatabaseEncryption", ) - vertical_pod_autoscaling = proto.Field( proto.MESSAGE, number=39, message="VerticalPodAutoscaling", ) - shielded_nodes = proto.Field(proto.MESSAGE, number=40, message="ShieldedNodes",) - release_channel = proto.Field(proto.MESSAGE, number=41, message="ReleaseChannel",) - workload_identity_config = proto.Field( proto.MESSAGE, number=43, message="WorkloadIdentityConfig", ) - - self_link = proto.Field(proto.STRING, number=100) - - zone = proto.Field(proto.STRING, number=101) - - endpoint = proto.Field(proto.STRING, number=102) - - initial_cluster_version = proto.Field(proto.STRING, number=103) - - current_master_version = proto.Field(proto.STRING, number=104) - - current_node_version = proto.Field(proto.STRING, number=105) - - create_time = proto.Field(proto.STRING, number=106) - + self_link = proto.Field(proto.STRING, number=100,) + zone = proto.Field(proto.STRING, number=101,) + endpoint = proto.Field(proto.STRING, number=102,) + initial_cluster_version = proto.Field(proto.STRING, number=103,) + current_master_version = proto.Field(proto.STRING, number=104,) + current_node_version = proto.Field(proto.STRING, number=105,) + create_time = proto.Field(proto.STRING, number=106,) status = proto.Field(proto.ENUM, number=107, enum=Status,) - - status_message = proto.Field(proto.STRING, number=108) - - node_ipv4_cidr_size = proto.Field(proto.INT32, number=109) - - services_ipv4_cidr = proto.Field(proto.STRING, number=110) - - instance_group_urls = proto.RepeatedField(proto.STRING, number=111) - - current_node_count = proto.Field(proto.INT32, number=112) - - expire_time = proto.Field(proto.STRING, number=113) - - location = proto.Field(proto.STRING, number=114) - - enable_tpu = proto.Field(proto.BOOL, number=115) - - tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=116) - + status_message = proto.Field(proto.STRING, number=108,) + node_ipv4_cidr_size = proto.Field(proto.INT32, number=109,) + services_ipv4_cidr = proto.Field(proto.STRING, number=110,) + instance_group_urls = proto.RepeatedField(proto.STRING, number=111,) + current_node_count = proto.Field(proto.INT32, number=112,) + expire_time = proto.Field(proto.STRING, number=113,) + location = proto.Field(proto.STRING, number=114,) + enable_tpu = proto.Field(proto.BOOL, number=115,) + tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=116,) conditions = proto.RepeatedField( proto.MESSAGE, number=118, message="StatusCondition", ) @@ -1539,75 +1416,55 @@ class ClusterUpdate(proto.Message): Kubernetes version """ - desired_node_version = proto.Field(proto.STRING, number=4) - - desired_monitoring_service = proto.Field(proto.STRING, number=5) - + desired_node_version = proto.Field(proto.STRING, number=4,) + desired_monitoring_service = proto.Field(proto.STRING, number=5,) desired_addons_config = proto.Field( proto.MESSAGE, number=6, message="AddonsConfig", ) - - desired_node_pool_id = proto.Field(proto.STRING, number=7) - - desired_image_type = proto.Field(proto.STRING, number=8) - + desired_node_pool_id = proto.Field(proto.STRING, number=7,) + desired_image_type = proto.Field(proto.STRING, number=8,) desired_database_encryption = proto.Field( proto.MESSAGE, number=46, message="DatabaseEncryption", ) - desired_workload_identity_config = proto.Field( proto.MESSAGE, number=47, message="WorkloadIdentityConfig", ) - desired_shielded_nodes = proto.Field( proto.MESSAGE, number=48, message="ShieldedNodes", ) - desired_node_pool_autoscaling = proto.Field( proto.MESSAGE, number=9, message="NodePoolAutoscaling", ) - - desired_locations = proto.RepeatedField(proto.STRING, number=10) - + desired_locations = proto.RepeatedField(proto.STRING, number=10,) desired_master_authorized_networks_config = proto.Field( proto.MESSAGE, number=12, message="MasterAuthorizedNetworksConfig", ) - desired_cluster_autoscaling = proto.Field( proto.MESSAGE, number=15, message="ClusterAutoscaling", ) - desired_binary_authorization = proto.Field( proto.MESSAGE, number=16, message="BinaryAuthorization", ) - - desired_logging_service = proto.Field(proto.STRING, number=19) - + desired_logging_service = proto.Field(proto.STRING, number=19,) desired_resource_usage_export_config = proto.Field( proto.MESSAGE, number=21, message="ResourceUsageExportConfig", ) - desired_vertical_pod_autoscaling = proto.Field( proto.MESSAGE, number=22, message="VerticalPodAutoscaling", ) - desired_private_cluster_config = proto.Field( proto.MESSAGE, number=25, message="PrivateClusterConfig", ) - desired_intra_node_visibility_config = proto.Field( proto.MESSAGE, number=26, message="IntraNodeVisibilityConfig", ) - desired_default_snat_status = proto.Field( proto.MESSAGE, number=28, message="DefaultSnatStatus", ) - desired_release_channel = proto.Field( proto.MESSAGE, number=31, message="ReleaseChannel", ) - - desired_master_version = proto.Field(proto.STRING, number=100) + desired_master_version = proto.Field(proto.STRING, number=100,) class Operation(proto.Message): @@ -1690,34 +1547,21 @@ class Type(proto.Enum): SET_NETWORK_POLICY = 15 SET_MAINTENANCE_POLICY = 16 - name = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) operation_type = proto.Field(proto.ENUM, number=3, enum=Type,) - status = proto.Field(proto.ENUM, number=4, enum=Status,) - - detail = proto.Field(proto.STRING, number=8) - - status_message = proto.Field(proto.STRING, number=5) - - self_link = proto.Field(proto.STRING, number=6) - - target_link = proto.Field(proto.STRING, number=7) - - location = proto.Field(proto.STRING, number=9) - - start_time = proto.Field(proto.STRING, number=10) - - end_time = proto.Field(proto.STRING, number=11) - + detail = proto.Field(proto.STRING, number=8,) + status_message = proto.Field(proto.STRING, number=5,) + self_link = proto.Field(proto.STRING, number=6,) + target_link = proto.Field(proto.STRING, number=7,) + location = proto.Field(proto.STRING, number=9,) + start_time = proto.Field(proto.STRING, number=10,) + end_time = proto.Field(proto.STRING, number=11,) progress = proto.Field(proto.MESSAGE, number=12, message="OperationProgress",) - cluster_conditions = proto.RepeatedField( proto.MESSAGE, number=13, message="StatusCondition", ) - nodepool_conditions = proto.RepeatedField( proto.MESSAGE, number=14, message="StatusCondition", ) @@ -1725,7 +1569,6 @@ class Type(proto.Enum): class OperationProgress(proto.Message): r"""Information about operation (or operation stage) progress. - Attributes: name (str): A non-parameterized string describing an @@ -1745,7 +1588,6 @@ class OperationProgress(proto.Message): class Metric(proto.Message): r"""Progress metric is (string, int|float|string) pair. - Attributes: name (str): Required. Metric name, e.g., "nodes total", @@ -1759,26 +1601,19 @@ class Metric(proto.Message): visual progress, etc.). """ - name = proto.Field(proto.STRING, number=1) - - int_value = proto.Field(proto.INT64, number=2, oneof="value") - - double_value = proto.Field(proto.DOUBLE, number=3, oneof="value") - - string_value = proto.Field(proto.STRING, number=4, oneof="value") - - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) + int_value = proto.Field(proto.INT64, number=2, oneof="value",) + double_value = proto.Field(proto.DOUBLE, number=3, oneof="value",) + string_value = proto.Field(proto.STRING, number=4, oneof="value",) + name = proto.Field(proto.STRING, number=1,) status = proto.Field(proto.ENUM, number=2, enum="Operation.Status",) - metrics = proto.RepeatedField(proto.MESSAGE, number=3, message=Metric,) - stages = proto.RepeatedField(proto.MESSAGE, number=4, message="OperationProgress",) class CreateClusterRequest(proto.Message): r"""CreateClusterRequest creates a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -1799,18 +1634,14 @@ class CreateClusterRequest(proto.Message): created. Specified in the format ``projects/*/locations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) cluster = proto.Field(proto.MESSAGE, number=3, message="Cluster",) - - parent = proto.Field(proto.STRING, number=5) + parent = proto.Field(proto.STRING, number=5,) class GetClusterRequest(proto.Message): r"""GetClusterRequest gets the settings of a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -1833,18 +1664,14 @@ class GetClusterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=5,) class UpdateClusterRequest(proto.Message): r"""UpdateClusterRequest updates the settings of a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -1869,15 +1696,11 @@ class UpdateClusterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) update = proto.Field(proto.MESSAGE, number=4, message="ClusterUpdate",) - - name = proto.Field(proto.STRING, number=5) + name = proto.Field(proto.STRING, number=5,) class UpdateNodePoolRequest(proto.Message): @@ -1940,26 +1763,17 @@ class UpdateNodePoolRequest(proto.Message): of the upgrade. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - node_version = proto.Field(proto.STRING, number=5) - - image_type = proto.Field(proto.STRING, number=6) - - name = proto.Field(proto.STRING, number=8) - - locations = proto.RepeatedField(proto.STRING, number=13) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + node_version = proto.Field(proto.STRING, number=5,) + image_type = proto.Field(proto.STRING, number=6,) + name = proto.Field(proto.STRING, number=8,) + locations = proto.RepeatedField(proto.STRING, number=13,) workload_metadata_config = proto.Field( proto.MESSAGE, number=14, message="WorkloadMetadataConfig", ) - upgrade_settings = proto.Field( proto.MESSAGE, number=15, message="NodePool.UpgradeSettings", ) @@ -1998,17 +1812,12 @@ class SetNodePoolAutoscalingRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) autoscaling = proto.Field(proto.MESSAGE, number=5, message="NodePoolAutoscaling",) - - name = proto.Field(proto.STRING, number=6) + name = proto.Field(proto.STRING, number=6,) class SetLoggingServiceRequest(proto.Message): @@ -2051,15 +1860,11 @@ class SetLoggingServiceRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - logging_service = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + logging_service = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=5,) class SetMonitoringServiceRequest(proto.Message): @@ -2103,15 +1908,11 @@ class SetMonitoringServiceRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - monitoring_service = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + monitoring_service = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class SetAddonsConfigRequest(proto.Message): @@ -2143,20 +1944,15 @@ class SetAddonsConfigRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) addons_config = proto.Field(proto.MESSAGE, number=4, message="AddonsConfig",) - - name = proto.Field(proto.STRING, number=6) + name = proto.Field(proto.STRING, number=6,) class SetLocationsRequest(proto.Message): r"""SetLocationsRequest sets the locations of the cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2188,20 +1984,15 @@ class SetLocationsRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - locations = proto.RepeatedField(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + locations = proto.RepeatedField(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class UpdateMasterRequest(proto.Message): r"""UpdateMasterRequest updates the master of the cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2237,20 +2028,15 @@ class UpdateMasterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - master_version = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + master_version = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=7,) class SetMasterAuthRequest(proto.Message): r"""SetMasterAuthRequest updates the admin password of a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2285,22 +2071,16 @@ class Action(proto.Enum): GENERATE_PASSWORD = 2 SET_USERNAME = 3 - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) action = proto.Field(proto.ENUM, number=4, enum=Action,) - update = proto.Field(proto.MESSAGE, number=5, message="MasterAuth",) - - name = proto.Field(proto.STRING, number=7) + name = proto.Field(proto.STRING, number=7,) class DeleteClusterRequest(proto.Message): r"""DeleteClusterRequest deletes a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2323,18 +2103,14 @@ class DeleteClusterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=4,) class ListClustersRequest(proto.Message): r"""ListClustersRequest lists clusters. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2353,16 +2129,13 @@ class ListClustersRequest(proto.Message): Location "-" matches all zones and all regions. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - parent = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + parent = proto.Field(proto.STRING, number=4,) class ListClustersResponse(proto.Message): r"""ListClustersResponse is the result of ListClustersRequest. - Attributes: clusters (Sequence[google.cloud.container_v1.types.Cluster]): A list of clusters in the project in the @@ -2373,13 +2146,11 @@ class ListClustersResponse(proto.Message): """ clusters = proto.RepeatedField(proto.MESSAGE, number=1, message="Cluster",) - - missing_zones = proto.RepeatedField(proto.STRING, number=2) + missing_zones = proto.RepeatedField(proto.STRING, number=2,) class GetOperationRequest(proto.Message): r"""GetOperationRequest gets a single operation. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2402,18 +2173,14 @@ class GetOperationRequest(proto.Message): ``projects/*/locations/*/operations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - operation_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + operation_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=5,) class ListOperationsRequest(proto.Message): r"""ListOperationsRequest lists operations. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2433,16 +2200,13 @@ class ListOperationsRequest(proto.Message): and all regions. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - parent = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + parent = proto.Field(proto.STRING, number=4,) class CancelOperationRequest(proto.Message): r"""CancelOperationRequest cancels a single operation. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2465,13 +2229,10 @@ class CancelOperationRequest(proto.Message): ``projects/*/locations/*/operations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - operation_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + operation_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=4,) class ListOperationsResponse(proto.Message): @@ -2489,13 +2250,11 @@ class ListOperationsResponse(proto.Message): """ operations = proto.RepeatedField(proto.MESSAGE, number=1, message="Operation",) - - missing_zones = proto.RepeatedField(proto.STRING, number=2) + missing_zones = proto.RepeatedField(proto.STRING, number=2,) class GetServerConfigRequest(proto.Message): r"""Gets the current Kubernetes Engine service configuration. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2513,16 +2272,13 @@ class GetServerConfigRequest(proto.Message): specified in the format ``projects/*/locations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - name = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + name = proto.Field(proto.STRING, number=4,) class ServerConfig(proto.Message): r"""Kubernetes Engine service configuration. - Attributes: default_cluster_version (str): Version of Kubernetes the service deploys by @@ -2557,21 +2313,14 @@ class ReleaseChannelConfig(proto.Message): """ channel = proto.Field(proto.ENUM, number=1, enum="ReleaseChannel.Channel",) - - default_version = proto.Field(proto.STRING, number=2) - - valid_versions = proto.RepeatedField(proto.STRING, number=4) - - default_cluster_version = proto.Field(proto.STRING, number=1) - - valid_node_versions = proto.RepeatedField(proto.STRING, number=3) - - default_image_type = proto.Field(proto.STRING, number=4) - - valid_image_types = proto.RepeatedField(proto.STRING, number=5) - - valid_master_versions = proto.RepeatedField(proto.STRING, number=6) - + default_version = proto.Field(proto.STRING, number=2,) + valid_versions = proto.RepeatedField(proto.STRING, number=4,) + + default_cluster_version = proto.Field(proto.STRING, number=1,) + valid_node_versions = proto.RepeatedField(proto.STRING, number=3,) + default_image_type = proto.Field(proto.STRING, number=4,) + valid_image_types = proto.RepeatedField(proto.STRING, number=5,) + valid_master_versions = proto.RepeatedField(proto.STRING, number=6,) channels = proto.RepeatedField( proto.MESSAGE, number=9, message=ReleaseChannelConfig, ) @@ -2579,7 +2328,6 @@ class ReleaseChannelConfig(proto.Message): class CreateNodePoolRequest(proto.Message): r"""CreateNodePoolRequest creates a node pool for a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2604,20 +2352,15 @@ class CreateNodePoolRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) node_pool = proto.Field(proto.MESSAGE, number=4, message="NodePool",) - - parent = proto.Field(proto.STRING, number=6) + parent = proto.Field(proto.STRING, number=6,) class DeleteNodePoolRequest(proto.Message): r"""DeleteNodePoolRequest deletes a node pool for a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2644,20 +2387,15 @@ class DeleteNodePoolRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class ListNodePoolsRequest(proto.Message): r"""ListNodePoolsRequest lists the node pool(s) for a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2680,18 +2418,14 @@ class ListNodePoolsRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - parent = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field(proto.STRING, number=5,) class GetNodePoolRequest(proto.Message): r"""GetNodePoolRequest retrieves a node pool for a cluster. - Attributes: project_id (str): Deprecated. The Google Developers Console `project ID or @@ -2718,15 +2452,11 @@ class GetNodePoolRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class NodePool(proto.Message): @@ -2844,42 +2574,27 @@ class UpgradeSettings(proto.Message): status is Ready. """ - max_surge = proto.Field(proto.INT32, number=1) - - max_unavailable = proto.Field(proto.INT32, number=2) - - name = proto.Field(proto.STRING, number=1) + max_surge = proto.Field(proto.INT32, number=1,) + max_unavailable = proto.Field(proto.INT32, number=2,) + name = proto.Field(proto.STRING, number=1,) config = proto.Field(proto.MESSAGE, number=2, message="NodeConfig",) - - initial_node_count = proto.Field(proto.INT32, number=3) - - locations = proto.RepeatedField(proto.STRING, number=13) - - self_link = proto.Field(proto.STRING, number=100) - - version = proto.Field(proto.STRING, number=101) - - instance_group_urls = proto.RepeatedField(proto.STRING, number=102) - + initial_node_count = proto.Field(proto.INT32, number=3,) + locations = proto.RepeatedField(proto.STRING, number=13,) + self_link = proto.Field(proto.STRING, number=100,) + version = proto.Field(proto.STRING, number=101,) + instance_group_urls = proto.RepeatedField(proto.STRING, number=102,) status = proto.Field(proto.ENUM, number=103, enum=Status,) - - status_message = proto.Field(proto.STRING, number=104) - + status_message = proto.Field(proto.STRING, number=104,) autoscaling = proto.Field(proto.MESSAGE, number=4, message="NodePoolAutoscaling",) - management = proto.Field(proto.MESSAGE, number=5, message="NodeManagement",) - max_pods_constraint = proto.Field( proto.MESSAGE, number=6, message="MaxPodsConstraint", ) - conditions = proto.RepeatedField( proto.MESSAGE, number=105, message="StatusCondition", ) - - pod_ipv4_cidr_size = proto.Field(proto.INT32, number=7) - + pod_ipv4_cidr_size = proto.Field(proto.INT32, number=7,) upgrade_settings = proto.Field(proto.MESSAGE, number=107, message=UpgradeSettings,) @@ -2905,10 +2620,8 @@ class NodeManagement(proto.Message): pool. """ - auto_upgrade = proto.Field(proto.BOOL, number=1) - - auto_repair = proto.Field(proto.BOOL, number=2) - + auto_upgrade = proto.Field(proto.BOOL, number=1,) + auto_repair = proto.Field(proto.BOOL, number=2,) upgrade_options = proto.Field( proto.MESSAGE, number=10, message="AutoUpgradeOptions", ) @@ -2929,9 +2642,8 @@ class AutoUpgradeOptions(proto.Message): commence with the description of the upgrade. """ - auto_upgrade_start_time = proto.Field(proto.STRING, number=1) - - description = proto.Field(proto.STRING, number=2) + auto_upgrade_start_time = proto.Field(proto.STRING, number=1,) + description = proto.Field(proto.STRING, number=2,) class MaintenancePolicy(proto.Message): @@ -2953,8 +2665,7 @@ class MaintenancePolicy(proto.Message): """ window = proto.Field(proto.MESSAGE, number=1, message="MaintenanceWindow",) - - resource_version = proto.Field(proto.STRING, number=3) + resource_version = proto.Field(proto.STRING, number=3,) class MaintenanceWindow(proto.Message): @@ -2980,11 +2691,9 @@ class MaintenanceWindow(proto.Message): daily_maintenance_window = proto.Field( proto.MESSAGE, number=2, oneof="policy", message="DailyMaintenanceWindow", ) - recurring_window = proto.Field( proto.MESSAGE, number=3, oneof="policy", message="RecurringTimeWindow", ) - maintenance_exclusions = proto.MapField( proto.STRING, proto.MESSAGE, number=4, message="TimeWindow", ) @@ -2992,7 +2701,6 @@ class MaintenanceWindow(proto.Message): class TimeWindow(proto.Message): r"""Represents an arbitrary window of time. - Attributes: start_time (google.protobuf.timestamp_pb2.Timestamp): The time that the window first starts. @@ -3001,14 +2709,12 @@ class TimeWindow(proto.Message): should take place after the start time. """ - start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) - - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) + start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) + end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) class RecurringTimeWindow(proto.Message): r"""Represents an arbitrary window of time that recurs. - Attributes: window (google.cloud.container_v1.types.TimeWindow): The window of the first recurrence. @@ -3054,13 +2760,11 @@ class RecurringTimeWindow(proto.Message): """ window = proto.Field(proto.MESSAGE, number=1, message="TimeWindow",) - - recurrence = proto.Field(proto.STRING, number=2) + recurrence = proto.Field(proto.STRING, number=2,) class DailyMaintenanceWindow(proto.Message): r"""Time window specified for daily maintenance operations. - Attributes: start_time (str): Time within the maintenance window to start the maintenance @@ -3075,9 +2779,8 @@ class DailyMaintenanceWindow(proto.Message): "PTnHnMnS". """ - start_time = proto.Field(proto.STRING, number=2) - - duration = proto.Field(proto.STRING, number=3) + start_time = proto.Field(proto.STRING, number=2,) + duration = proto.Field(proto.STRING, number=3,) class SetNodePoolManagementRequest(proto.Message): @@ -3113,17 +2816,12 @@ class SetNodePoolManagementRequest(proto.Message): format ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) management = proto.Field(proto.MESSAGE, number=5, message="NodeManagement",) - - name = proto.Field(proto.STRING, number=7) + name = proto.Field(proto.STRING, number=7,) class SetNodePoolSizeRequest(proto.Message): @@ -3159,17 +2857,12 @@ class SetNodePoolSizeRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - node_count = proto.Field(proto.INT32, number=5) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + node_count = proto.Field(proto.INT32, number=5,) + name = proto.Field(proto.STRING, number=7,) class RollbackNodePoolUpgradeRequest(proto.Message): @@ -3203,20 +2896,15 @@ class RollbackNodePoolUpgradeRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class ListNodePoolsResponse(proto.Message): r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. - Attributes: node_pools (Sequence[google.cloud.container_v1.types.NodePool]): A list of node pools for a cluster. @@ -3247,17 +2935,14 @@ class ClusterAutoscaling(proto.Message): in which the NodePool's nodes can be created by NAP. """ - enable_node_autoprovisioning = proto.Field(proto.BOOL, number=1) - + enable_node_autoprovisioning = proto.Field(proto.BOOL, number=1,) resource_limits = proto.RepeatedField( proto.MESSAGE, number=2, message="ResourceLimit", ) - autoprovisioning_node_pool_defaults = proto.Field( proto.MESSAGE, number=4, message="AutoprovisioningNodePoolDefaults", ) - - autoprovisioning_locations = proto.RepeatedField(proto.STRING, number=5) + autoprovisioning_locations = proto.RepeatedField(proto.STRING, number=5,) class AutoprovisioningNodePoolDefaults(proto.Message): @@ -3310,27 +2995,19 @@ class AutoprovisioningNodePoolDefaults(proto.Message): https://cloud.google.com/compute/docs/disks/customer-managed-encryption """ - oauth_scopes = proto.RepeatedField(proto.STRING, number=1) - - service_account = proto.Field(proto.STRING, number=2) - + oauth_scopes = proto.RepeatedField(proto.STRING, number=1,) + service_account = proto.Field(proto.STRING, number=2,) upgrade_settings = proto.Field( proto.MESSAGE, number=3, message="NodePool.UpgradeSettings", ) - management = proto.Field(proto.MESSAGE, number=4, message="NodeManagement",) - - min_cpu_platform = proto.Field(proto.STRING, number=5) - - disk_size_gb = proto.Field(proto.INT32, number=6) - - disk_type = proto.Field(proto.STRING, number=7) - + min_cpu_platform = proto.Field(proto.STRING, number=5,) + disk_size_gb = proto.Field(proto.INT32, number=6,) + disk_type = proto.Field(proto.STRING, number=7,) shielded_instance_config = proto.Field( proto.MESSAGE, number=8, message="ShieldedInstanceConfig", ) - - boot_disk_kms_key = proto.Field(proto.STRING, number=9) + boot_disk_kms_key = proto.Field(proto.STRING, number=9,) class ResourceLimit(proto.Message): @@ -3349,11 +3026,9 @@ class ResourceLimit(proto.Message): cluster. """ - resource_type = proto.Field(proto.STRING, number=1) - - minimum = proto.Field(proto.INT64, number=2) - - maximum = proto.Field(proto.INT64, number=3) + resource_type = proto.Field(proto.STRING, number=1,) + minimum = proto.Field(proto.INT64, number=2,) + maximum = proto.Field(proto.INT64, number=3,) class NodePoolAutoscaling(proto.Message): @@ -3375,13 +3050,10 @@ class NodePoolAutoscaling(proto.Message): Can this node pool be deleted automatically. """ - enabled = proto.Field(proto.BOOL, number=1) - - min_node_count = proto.Field(proto.INT32, number=2) - - max_node_count = proto.Field(proto.INT32, number=3) - - autoprovisioned = proto.Field(proto.BOOL, number=4) + enabled = proto.Field(proto.BOOL, number=1,) + min_node_count = proto.Field(proto.INT32, number=2,) + max_node_count = proto.Field(proto.INT32, number=3,) + autoprovisioned = proto.Field(proto.BOOL, number=4,) class SetLabelsRequest(proto.Message): @@ -3421,17 +3093,12 @@ class SetLabelsRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - resource_labels = proto.MapField(proto.STRING, proto.STRING, number=4) - - label_fingerprint = proto.Field(proto.STRING, number=5) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + resource_labels = proto.MapField(proto.STRING, proto.STRING, number=4,) + label_fingerprint = proto.Field(proto.STRING, number=5,) + name = proto.Field(proto.STRING, number=7,) class SetLegacyAbacRequest(proto.Message): @@ -3463,15 +3130,11 @@ class SetLegacyAbacRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - enabled = proto.Field(proto.BOOL, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + enabled = proto.Field(proto.BOOL, number=4,) + name = proto.Field(proto.STRING, number=6,) class StartIPRotationRequest(proto.Message): @@ -3504,15 +3167,11 @@ class StartIPRotationRequest(proto.Message): rotation. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=6) - - rotate_credentials = proto.Field(proto.BOOL, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=6,) + rotate_credentials = proto.Field(proto.BOOL, number=7,) class CompleteIPRotationRequest(proto.Message): @@ -3541,18 +3200,14 @@ class CompleteIPRotationRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=7,) class AcceleratorConfig(proto.Message): r"""AcceleratorConfig represents a Hardware Accelerator request. - Attributes: accelerator_count (int): The number of the accelerator cards exposed @@ -3563,9 +3218,8 @@ class AcceleratorConfig(proto.Message): `here `__ """ - accelerator_count = proto.Field(proto.INT64, number=1) - - accelerator_type = proto.Field(proto.STRING, number=2) + accelerator_count = proto.Field(proto.INT64, number=1,) + accelerator_type = proto.Field(proto.STRING, number=2,) class WorkloadMetadataConfig(proto.Message): @@ -3618,15 +3272,11 @@ class SetNetworkPolicyRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) network_policy = proto.Field(proto.MESSAGE, number=4, message="NetworkPolicy",) - - name = proto.Field(proto.STRING, number=6) + name = proto.Field(proto.STRING, number=6,) class SetMaintenancePolicyRequest(proto.Message): @@ -3654,17 +3304,13 @@ class SetMaintenancePolicyRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) maintenance_policy = proto.Field( proto.MESSAGE, number=4, message="MaintenancePolicy", ) - - name = proto.Field(proto.STRING, number=5) + name = proto.Field(proto.STRING, number=5,) class StatusCondition(proto.Message): @@ -3690,8 +3336,7 @@ class Code(proto.Enum): CLOUD_KMS_KEY_ERROR = 7 code = proto.Field(proto.ENUM, number=1, enum=Code,) - - message = proto.Field(proto.STRING, number=2) + message = proto.Field(proto.STRING, number=2,) class NetworkConfig(proto.Message): @@ -3721,12 +3366,9 @@ class NetworkConfig(proto.Message): sNAT on cluster internal traffic. """ - network = proto.Field(proto.STRING, number=1) - - subnetwork = proto.Field(proto.STRING, number=2) - - enable_intra_node_visibility = proto.Field(proto.BOOL, number=5) - + network = proto.Field(proto.STRING, number=1,) + subnetwork = proto.Field(proto.STRING, number=2,) + enable_intra_node_visibility = proto.Field(proto.BOOL, number=5,) default_snat_status = proto.Field( proto.MESSAGE, number=7, message="DefaultSnatStatus", ) @@ -3744,7 +3386,7 @@ class GetOpenIDConfigRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - parent = proto.Field(proto.STRING, number=1) + parent = proto.Field(proto.STRING, number=1,) class GetOpenIDConfigResponse(proto.Message): @@ -3769,19 +3411,13 @@ class GetOpenIDConfigResponse(proto.Message): Supported grant types. """ - issuer = proto.Field(proto.STRING, number=1) - - jwks_uri = proto.Field(proto.STRING, number=2) - - response_types_supported = proto.RepeatedField(proto.STRING, number=3) - - subject_types_supported = proto.RepeatedField(proto.STRING, number=4) - - id_token_signing_alg_values_supported = proto.RepeatedField(proto.STRING, number=5) - - claims_supported = proto.RepeatedField(proto.STRING, number=6) - - grant_types = proto.RepeatedField(proto.STRING, number=7) + issuer = proto.Field(proto.STRING, number=1,) + jwks_uri = proto.Field(proto.STRING, number=2,) + response_types_supported = proto.RepeatedField(proto.STRING, number=3,) + subject_types_supported = proto.RepeatedField(proto.STRING, number=4,) + id_token_signing_alg_values_supported = proto.RepeatedField(proto.STRING, number=5,) + claims_supported = proto.RepeatedField(proto.STRING, number=6,) + grant_types = proto.RepeatedField(proto.STRING, number=7,) class GetJSONWebKeysRequest(proto.Message): @@ -3797,12 +3433,11 @@ class GetJSONWebKeysRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - parent = proto.Field(proto.STRING, number=1) + parent = proto.Field(proto.STRING, number=1,) class Jwk(proto.Message): r"""Jwk is a JSON Web Key as specified in RFC 7517 - Attributes: kty (str): Key Type. @@ -3824,23 +3459,15 @@ class Jwk(proto.Message): Used for ECDSA keys. """ - kty = proto.Field(proto.STRING, number=1) - - alg = proto.Field(proto.STRING, number=2) - - use = proto.Field(proto.STRING, number=3) - - kid = proto.Field(proto.STRING, number=4) - - n = proto.Field(proto.STRING, number=5) - - e = proto.Field(proto.STRING, number=6) - - x = proto.Field(proto.STRING, number=7) - - y = proto.Field(proto.STRING, number=8) - - crv = proto.Field(proto.STRING, number=9) + kty = proto.Field(proto.STRING, number=1,) + alg = proto.Field(proto.STRING, number=2,) + use = proto.Field(proto.STRING, number=3,) + kid = proto.Field(proto.STRING, number=4,) + n = proto.Field(proto.STRING, number=5,) + e = proto.Field(proto.STRING, number=6,) + x = proto.Field(proto.STRING, number=7,) + y = proto.Field(proto.STRING, number=8,) + crv = proto.Field(proto.STRING, number=9,) class GetJSONWebKeysResponse(proto.Message): @@ -3889,19 +3516,18 @@ class IntraNodeVisibilityConfig(proto.Message): cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class MaxPodsConstraint(proto.Message): r"""Constraints applied to pods. - Attributes: max_pods_per_node (int): Constraint enforced on the max num of pods per node. """ - max_pods_per_node = proto.Field(proto.INT64, number=1) + max_pods_per_node = proto.Field(proto.INT64, number=1,) class WorkloadIdentityConfig(proto.Message): @@ -3914,12 +3540,11 @@ class WorkloadIdentityConfig(proto.Message): service accounts to. """ - workload_pool = proto.Field(proto.STRING, number=2) + workload_pool = proto.Field(proto.STRING, number=2,) class DatabaseEncryption(proto.Message): r"""Configuration of etcd encryption. - Attributes: state (google.cloud.container_v1.types.DatabaseEncryption.State): Denotes the state of etcd encryption. @@ -3937,8 +3562,7 @@ class State(proto.Enum): DECRYPTED = 2 state = proto.Field(proto.ENUM, number=2, enum=State,) - - key_name = proto.Field(proto.STRING, number=1) + key_name = proto.Field(proto.STRING, number=1,) class ListUsableSubnetworksRequest(proto.Message): @@ -3968,13 +3592,10 @@ class ListUsableSubnetworksRequest(proto.Message): requests to get the next page of results. """ - parent = proto.Field(proto.STRING, number=1) - - filter = proto.Field(proto.STRING, number=2) - - page_size = proto.Field(proto.INT32, number=3) - - page_token = proto.Field(proto.STRING, number=4) + parent = proto.Field(proto.STRING, number=1,) + filter = proto.Field(proto.STRING, number=2,) + page_size = proto.Field(proto.INT32, number=3,) + page_token = proto.Field(proto.STRING, number=4,) class ListUsableSubnetworksResponse(proto.Message): @@ -4000,13 +3621,11 @@ def raw_page(self): subnetworks = proto.RepeatedField( proto.MESSAGE, number=1, message="UsableSubnetwork", ) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = proto.Field(proto.STRING, number=2,) class UsableSubnetworkSecondaryRange(proto.Message): r"""Secondary IP range of a usable subnetwork. - Attributes: range_name (str): The name associated with this subnetwork @@ -4028,10 +3647,8 @@ class Status(proto.Enum): IN_USE_SHAREABLE_POD = 3 IN_USE_MANAGED_POD = 4 - range_name = proto.Field(proto.STRING, number=1) - - ip_cidr_range = proto.Field(proto.STRING, number=2) - + range_name = proto.Field(proto.STRING, number=1,) + ip_cidr_range = proto.Field(proto.STRING, number=2,) status = proto.Field(proto.ENUM, number=3, enum=Status,) @@ -4061,22 +3678,17 @@ class UsableSubnetwork(proto.Message): message will be given by status_message. """ - subnetwork = proto.Field(proto.STRING, number=1) - - network = proto.Field(proto.STRING, number=2) - - ip_cidr_range = proto.Field(proto.STRING, number=3) - + subnetwork = proto.Field(proto.STRING, number=1,) + network = proto.Field(proto.STRING, number=2,) + ip_cidr_range = proto.Field(proto.STRING, number=3,) secondary_ip_ranges = proto.RepeatedField( proto.MESSAGE, number=4, message="UsableSubnetworkSecondaryRange", ) - - status_message = proto.Field(proto.STRING, number=5) + status_message = proto.Field(proto.STRING, number=5,) class ResourceUsageExportConfig(proto.Message): r"""Configuration for exporting cluster resource usages. - Attributes: bigquery_destination (google.cloud.container_v1.types.ResourceUsageExportConfig.BigQueryDestination): Configuration to use BigQuery as usage export @@ -4100,11 +3712,10 @@ class BigQueryDestination(proto.Message): The ID of a BigQuery Dataset. """ - dataset_id = proto.Field(proto.STRING, number=1) + dataset_id = proto.Field(proto.STRING, number=1,) class ConsumptionMeteringConfig(proto.Message): r"""Parameters for controlling consumption metering. - Attributes: enabled (bool): Whether to enable consumption metering for @@ -4113,14 +3724,12 @@ class ConsumptionMeteringConfig(proto.Message): consumption records. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) bigquery_destination = proto.Field( proto.MESSAGE, number=1, message=BigQueryDestination, ) - - enable_network_egress_metering = proto.Field(proto.BOOL, number=2) - + enable_network_egress_metering = proto.Field(proto.BOOL, number=2,) consumption_metering_config = proto.Field( proto.MESSAGE, number=3, message=ConsumptionMeteringConfig, ) @@ -4136,7 +3745,7 @@ class VerticalPodAutoscaling(proto.Message): Enables vertical pod autoscaling. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class DefaultSnatStatus(proto.Message): @@ -4148,19 +3757,18 @@ class DefaultSnatStatus(proto.Message): Disables cluster default sNAT rules. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class ShieldedNodes(proto.Message): r"""Configuration of Shielded Nodes feature. - Attributes: enabled (bool): Whether Shielded Nodes features are enabled on all nodes in this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/container_v1beta1/__init__.py b/google/cloud/container_v1beta1/__init__.py index e6827164..2a2f15ff 100644 --- a/google/cloud/container_v1beta1/__init__.py +++ b/google/cloud/container_v1beta1/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,11 +15,13 @@ # from .services.cluster_manager import ClusterManagerClient +from .services.cluster_manager import ClusterManagerAsyncClient + from .types.cluster_service import AcceleratorConfig from .types.cluster_service import AddonsConfig from .types.cluster_service import AuthenticatorGroupsConfig -from .types.cluster_service import AutoUpgradeOptions from .types.cluster_service import AutoprovisioningNodePoolDefaults +from .types.cluster_service import AutoUpgradeOptions from .types.cluster_service import BinaryAuthorization from .types.cluster_service import CancelOperationRequest from .types.cluster_service import ClientCertificateConfig @@ -36,7 +37,6 @@ from .types.cluster_service import CreateNodePoolRequest from .types.cluster_service import DailyMaintenanceWindow from .types.cluster_service import DatabaseEncryption -from .types.cluster_service import DatapathProvider from .types.cluster_service import DefaultSnatStatus from .types.cluster_service import DeleteClusterRequest from .types.cluster_service import DeleteNodePoolRequest @@ -53,8 +53,8 @@ from .types.cluster_service import GetServerConfigRequest from .types.cluster_service import HorizontalPodAutoscaling from .types.cluster_service import HttpLoadBalancing -from .types.cluster_service import IPAllocationPolicy from .types.cluster_service import IntraNodeVisibilityConfig +from .types.cluster_service import IPAllocationPolicy from .types.cluster_service import IstioConfig from .types.cluster_service import Jwk from .types.cluster_service import KalmConfig @@ -123,15 +123,16 @@ from .types.cluster_service import UpdateMasterRequest from .types.cluster_service import UpdateNodePoolRequest from .types.cluster_service import UpgradeEvent -from .types.cluster_service import UpgradeResourceType from .types.cluster_service import UsableSubnetwork from .types.cluster_service import UsableSubnetworkSecondaryRange from .types.cluster_service import VerticalPodAutoscaling from .types.cluster_service import WorkloadIdentityConfig from .types.cluster_service import WorkloadMetadataConfig - +from .types.cluster_service import DatapathProvider +from .types.cluster_service import UpgradeResourceType __all__ = ( + "ClusterManagerAsyncClient", "AcceleratorConfig", "AddonsConfig", "AuthenticatorGroupsConfig", @@ -143,6 +144,7 @@ "CloudRunConfig", "Cluster", "ClusterAutoscaling", + "ClusterManagerClient", "ClusterTelemetry", "ClusterUpdate", "CompleteIPRotationRequest", @@ -245,5 +247,4 @@ "VerticalPodAutoscaling", "WorkloadIdentityConfig", "WorkloadMetadataConfig", - "ClusterManagerClient", ) diff --git a/google/cloud/container_v1beta1/gapic_metadata.json b/google/cloud/container_v1beta1/gapic_metadata.json new file mode 100644 index 00000000..0ff8e5d5 --- /dev/null +++ b/google/cloud/container_v1beta1/gapic_metadata.json @@ -0,0 +1,353 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.container_v1beta1", + "protoPackage": "google.container.v1beta1", + "schema": "1.0", + "services": { + "ClusterManager": { + "clients": { + "grpc": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListLocations": { + "methods": [ + "list_locations" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + }, + "grpc-async": { + "libraryClient": "ClusterManagerAsyncClient", + "rpcs": { + "CancelOperation": { + "methods": [ + "cancel_operation" + ] + }, + "CompleteIPRotation": { + "methods": [ + "complete_ip_rotation" + ] + }, + "CreateCluster": { + "methods": [ + "create_cluster" + ] + }, + "CreateNodePool": { + "methods": [ + "create_node_pool" + ] + }, + "DeleteCluster": { + "methods": [ + "delete_cluster" + ] + }, + "DeleteNodePool": { + "methods": [ + "delete_node_pool" + ] + }, + "GetCluster": { + "methods": [ + "get_cluster" + ] + }, + "GetJSONWebKeys": { + "methods": [ + "get_json_web_keys" + ] + }, + "GetNodePool": { + "methods": [ + "get_node_pool" + ] + }, + "GetOperation": { + "methods": [ + "get_operation" + ] + }, + "GetServerConfig": { + "methods": [ + "get_server_config" + ] + }, + "ListClusters": { + "methods": [ + "list_clusters" + ] + }, + "ListLocations": { + "methods": [ + "list_locations" + ] + }, + "ListNodePools": { + "methods": [ + "list_node_pools" + ] + }, + "ListOperations": { + "methods": [ + "list_operations" + ] + }, + "ListUsableSubnetworks": { + "methods": [ + "list_usable_subnetworks" + ] + }, + "RollbackNodePoolUpgrade": { + "methods": [ + "rollback_node_pool_upgrade" + ] + }, + "SetAddonsConfig": { + "methods": [ + "set_addons_config" + ] + }, + "SetLabels": { + "methods": [ + "set_labels" + ] + }, + "SetLegacyAbac": { + "methods": [ + "set_legacy_abac" + ] + }, + "SetLocations": { + "methods": [ + "set_locations" + ] + }, + "SetLoggingService": { + "methods": [ + "set_logging_service" + ] + }, + "SetMaintenancePolicy": { + "methods": [ + "set_maintenance_policy" + ] + }, + "SetMasterAuth": { + "methods": [ + "set_master_auth" + ] + }, + "SetMonitoringService": { + "methods": [ + "set_monitoring_service" + ] + }, + "SetNetworkPolicy": { + "methods": [ + "set_network_policy" + ] + }, + "SetNodePoolAutoscaling": { + "methods": [ + "set_node_pool_autoscaling" + ] + }, + "SetNodePoolManagement": { + "methods": [ + "set_node_pool_management" + ] + }, + "SetNodePoolSize": { + "methods": [ + "set_node_pool_size" + ] + }, + "StartIPRotation": { + "methods": [ + "start_ip_rotation" + ] + }, + "UpdateCluster": { + "methods": [ + "update_cluster" + ] + }, + "UpdateMaster": { + "methods": [ + "update_master" + ] + }, + "UpdateNodePool": { + "methods": [ + "update_node_pool" + ] + } + } + } + } + } + } +} diff --git a/google/cloud/container_v1beta1/services/__init__.py b/google/cloud/container_v1beta1/services/__init__.py index 42ffdf2b..4de65971 100644 --- a/google/cloud/container_v1beta1/services/__init__.py +++ b/google/cloud/container_v1beta1/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/container_v1beta1/services/cluster_manager/__init__.py b/google/cloud/container_v1beta1/services/cluster_manager/__init__.py index 3b4fcb4d..c1624d28 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/__init__.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/__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 ClusterManagerClient from .async_client import ClusterManagerAsyncClient diff --git a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py b/google/cloud/container_v1beta1/services/cluster_manager/async_client.py index e8137869..fa943c1a 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/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.container_v1beta1.services.cluster_manager import pagers from google.cloud.container_v1beta1.types import cluster_service -from google.rpc import status_pb2 as status # type: ignore - +from google.rpc import status_pb2 # type: ignore from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport from .client import ClusterManagerClient @@ -47,31 +44,26 @@ class ClusterManagerAsyncClient: topic_path = staticmethod(ClusterManagerClient.topic_path) parse_topic_path = staticmethod(ClusterManagerClient.parse_topic_path) - common_billing_account_path = staticmethod( ClusterManagerClient.common_billing_account_path ) parse_common_billing_account_path = staticmethod( ClusterManagerClient.parse_common_billing_account_path ) - common_folder_path = staticmethod(ClusterManagerClient.common_folder_path) parse_common_folder_path = staticmethod( ClusterManagerClient.parse_common_folder_path ) - common_organization_path = staticmethod( ClusterManagerClient.common_organization_path ) parse_common_organization_path = staticmethod( ClusterManagerClient.parse_common_organization_path ) - common_project_path = staticmethod(ClusterManagerClient.common_project_path) parse_common_project_path = staticmethod( ClusterManagerClient.parse_common_project_path ) - common_location_path = staticmethod(ClusterManagerClient.common_location_path) parse_common_location_path = staticmethod( ClusterManagerClient.parse_common_location_path @@ -79,7 +71,8 @@ class ClusterManagerAsyncClient: @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 +87,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 +104,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> ClusterManagerTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: ClusterManagerTransport: The transport used by the client instance. @@ -125,12 +118,12 @@ def transport(self) -> ClusterManagerTransport: def __init__( self, *, - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, transport: Union[str, ClusterManagerTransport] = "grpc_asyncio", client_options: ClientOptions = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the cluster manager client. + """Instantiates the cluster manager client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -162,7 +155,6 @@ def __init__( google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. """ - self._client = ClusterManagerClient( credentials=credentials, transport=transport, @@ -207,7 +199,6 @@ async def list_clusters( This corresponds to the ``zone`` 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. @@ -234,7 +225,6 @@ async def list_clusters( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -249,7 +239,8 @@ async def list_clusters( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -315,7 +306,6 @@ async def get_cluster( This corresponds to the ``cluster_id`` 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. @@ -340,7 +330,6 @@ async def get_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -357,7 +346,8 @@ async def get_cluster( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -433,7 +423,6 @@ async def create_cluster( This corresponds to the ``cluster`` 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. @@ -462,7 +451,6 @@ async def create_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -544,7 +532,6 @@ async def update_cluster( This corresponds to the ``update`` 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. @@ -573,7 +560,6 @@ async def update_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -618,7 +604,6 @@ async def update_node_pool( request (:class:`google.cloud.container_v1beta1.types.UpdateNodePoolRequest`): The request object. SetNodePoolVersionRequest updates the version of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -634,7 +619,6 @@ async def update_node_pool( """ # Create or coerce a protobuf request object. - request = cluster_service.UpdateNodePoolRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -672,7 +656,6 @@ async def set_node_pool_autoscaling( request (:class:`google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest`): The request object. SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -688,7 +671,6 @@ async def set_node_pool_autoscaling( """ # Create or coerce a protobuf request object. - request = cluster_service.SetNodePoolAutoscalingRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -777,7 +759,6 @@ async def set_logging_service( This corresponds to the ``logging_service`` 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. @@ -806,7 +787,6 @@ async def set_logging_service( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -904,7 +884,6 @@ async def set_monitoring_service( This corresponds to the ``monitoring_service`` 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. @@ -933,7 +912,6 @@ async def set_monitoring_service( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1018,7 +996,6 @@ async def set_addons_config( This corresponds to the ``addons_config`` 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. @@ -1047,7 +1024,6 @@ async def set_addons_config( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1140,7 +1116,6 @@ async def set_locations( This corresponds to the ``locations`` 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. @@ -1169,14 +1144,12 @@ async def set_locations( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: request.zone = zone if cluster_id is not None: request.cluster_id = cluster_id - if locations: request.locations.extend(locations) @@ -1266,7 +1239,6 @@ async def update_master( This corresponds to the ``master_version`` 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. @@ -1295,7 +1267,6 @@ async def update_master( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1342,7 +1313,6 @@ async def set_master_auth( request (:class:`google.cloud.container_v1beta1.types.SetMasterAuthRequest`): The request object. SetMasterAuthRequest updates the admin password of a cluster. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1358,7 +1328,6 @@ async def set_master_auth( """ # Create or coerce a protobuf request object. - request = cluster_service.SetMasterAuthRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -1436,7 +1405,6 @@ async def delete_cluster( This corresponds to the ``cluster_id`` 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. @@ -1465,7 +1433,6 @@ async def delete_cluster( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1482,7 +1449,8 @@ async def delete_cluster( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -1540,7 +1508,6 @@ async def list_operations( This corresponds to the ``zone`` 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. @@ -1567,7 +1534,6 @@ async def list_operations( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1582,7 +1548,8 @@ async def list_operations( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -1647,7 +1614,6 @@ async def get_operation( This corresponds to the ``operation_id`` 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. @@ -1676,7 +1642,6 @@ async def get_operation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1693,7 +1658,8 @@ async def get_operation( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -1758,7 +1724,6 @@ async def cancel_operation( This corresponds to the ``operation_id`` 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. @@ -1779,7 +1744,6 @@ async def cancel_operation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1843,7 +1807,6 @@ async def get_server_config( This corresponds to the ``zone`` 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. @@ -1870,7 +1833,6 @@ async def get_server_config( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1885,7 +1847,8 @@ async def get_server_config( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -1950,7 +1913,6 @@ async def list_node_pools( This corresponds to the ``cluster_id`` 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. @@ -1977,7 +1939,6 @@ async def list_node_pools( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1994,7 +1955,8 @@ async def list_node_pools( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -2034,7 +1996,6 @@ async def get_json_web_keys( token requests. This will be the jwks_uri for the discover document returned by getOpenIDConfig. See the OpenID Connect Discovery 1.0 specification for details. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2049,7 +2010,6 @@ async def get_json_web_keys( """ # Create or coerce a protobuf request object. - request = cluster_service.GetJSONWebKeysRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -2127,7 +2087,6 @@ async def get_node_pool( This corresponds to the ``node_pool_id`` 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. @@ -2162,7 +2121,6 @@ async def get_node_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2181,7 +2139,8 @@ async def get_node_pool( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -2252,7 +2211,6 @@ async def create_node_pool( This corresponds to the ``node_pool`` 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. @@ -2281,7 +2239,6 @@ async def create_node_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2366,7 +2323,6 @@ async def delete_node_pool( This corresponds to the ``node_pool_id`` 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. @@ -2395,7 +2351,6 @@ async def delete_node_pool( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2414,7 +2369,8 @@ async def delete_node_pool( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -2494,7 +2450,6 @@ async def rollback_node_pool_upgrade( This corresponds to the ``node_pool_id`` 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. @@ -2523,7 +2478,6 @@ async def rollback_node_pool_upgrade( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2617,7 +2571,6 @@ async def set_node_pool_management( This corresponds to the ``management`` 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. @@ -2648,7 +2601,6 @@ async def set_node_pool_management( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2751,7 +2703,6 @@ async def set_labels( This corresponds to the ``label_fingerprint`` 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. @@ -2782,7 +2733,6 @@ async def set_labels( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2870,7 +2820,6 @@ async def set_legacy_abac( This corresponds to the ``enabled`` 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. @@ -2899,7 +2848,6 @@ async def set_legacy_abac( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2975,7 +2923,6 @@ async def start_ip_rotation( This corresponds to the ``cluster_id`` 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. @@ -3004,7 +2951,6 @@ async def start_ip_rotation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3077,7 +3023,6 @@ async def complete_ip_rotation( This corresponds to the ``cluster_id`` 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. @@ -3106,7 +3051,6 @@ async def complete_ip_rotation( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3148,7 +3092,6 @@ async def set_node_pool_size( request (:class:`google.cloud.container_v1beta1.types.SetNodePoolSizeRequest`): The request object. SetNodePoolSizeRequest sets the size a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3164,7 +3107,6 @@ async def set_node_pool_size( """ # Create or coerce a protobuf request object. - request = cluster_service.SetNodePoolSizeRequest(request) # Wrap the RPC method; this adds retry and timeout information, @@ -3240,7 +3182,6 @@ async def set_network_policy( This corresponds to the ``network_policy`` 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. @@ -3269,7 +3210,6 @@ async def set_network_policy( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3348,7 +3288,6 @@ async def set_maintenance_policy( This corresponds to the ``maintenance_policy`` 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. @@ -3377,7 +3316,6 @@ async def set_maintenance_policy( # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3431,7 +3369,6 @@ async def list_usable_subnetworks( This corresponds to the ``parent`` 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. @@ -3463,7 +3400,6 @@ async def list_usable_subnetworks( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -3476,7 +3412,8 @@ async def list_usable_subnetworks( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -3525,7 +3462,6 @@ async def list_locations( This corresponds to the ``parent`` 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. @@ -3553,7 +3489,6 @@ async def list_locations( # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -3566,7 +3501,8 @@ async def list_locations( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), diff --git a/google/cloud/container_v1beta1/services/cluster_manager/client.py b/google/cloud/container_v1beta1/services/cluster_manager/client.py index eea79a2b..48d8ff97 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/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 @@ -34,8 +32,7 @@ from google.cloud.container_v1beta1.services.cluster_manager import pagers from google.cloud.container_v1beta1.types import cluster_service -from google.rpc import status_pb2 as status # type: ignore - +from google.rpc import status_pb2 # type: ignore from .transports.base import ClusterManagerTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ClusterManagerGrpcTransport from .transports.grpc_asyncio import ClusterManagerGrpcAsyncIOTransport @@ -56,7 +53,7 @@ class ClusterManagerClientMeta(type): _transport_registry["grpc_asyncio"] = ClusterManagerGrpcAsyncIOTransport def get_transport_class(cls, label: str = None,) -> Type[ClusterManagerTransport]: - """Return an appropriate transport class. + """Returns an appropriate transport class. Args: label: The name of the desired transport. If none is @@ -79,7 +76,8 @@ class ClusterManagerClient(metaclass=ClusterManagerClientMeta): @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: @@ -113,7 +111,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. @@ -130,7 +129,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 @@ -149,27 +148,28 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): @property def transport(self) -> ClusterManagerTransport: - """Return the transport used by the client instance. + """Returns the transport used by the client instance. Returns: - ClusterManagerTransport: The transport used by the client instance. + ClusterManagerTransport: The transport used by the client + instance. """ return self._transport @staticmethod def topic_path(project: str, topic: str,) -> str: - """Return a fully-qualified topic string.""" + """Returns a fully-qualified topic string.""" return "projects/{project}/topics/{topic}".format(project=project, topic=topic,) @staticmethod def parse_topic_path(path: str) -> Dict[str, str]: - """Parse a topic path into its component segments.""" + """Parses a topic path into its component segments.""" m = re.match(r"^projects/(?P.+?)/topics/(?P.+?)$", path) return m.groupdict() if m else {} @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, ) @@ -182,7 +182,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 @@ -193,7 +193,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 @@ -204,7 +204,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 @@ -215,7 +215,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, ) @@ -229,12 +229,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, ClusterManagerTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the cluster manager client. + """Instantiates the cluster manager client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -289,9 +289,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: @@ -303,12 +304,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. @@ -323,8 +326,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: @@ -376,7 +379,6 @@ def list_clusters( This corresponds to the ``zone`` 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. @@ -405,10 +407,8 @@ def list_clusters( # there are no flattened fields. if not isinstance(request, cluster_service.ListClustersRequest): request = cluster_service.ListClustersRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -476,7 +476,6 @@ def get_cluster( This corresponds to the ``cluster_id`` 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. @@ -503,10 +502,8 @@ def get_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.GetClusterRequest): request = cluster_service.GetClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -586,7 +583,6 @@ def create_cluster( This corresponds to the ``cluster`` 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. @@ -617,10 +613,8 @@ def create_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.CreateClusterRequest): request = cluster_service.CreateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -698,7 +692,6 @@ def update_cluster( This corresponds to the ``update`` 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. @@ -729,10 +722,8 @@ def update_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.UpdateClusterRequest): request = cluster_service.UpdateClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -773,7 +764,6 @@ def update_node_pool( request (google.cloud.container_v1beta1.types.UpdateNodePoolRequest): The request object. SetNodePoolVersionRequest updates the version of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -789,7 +779,6 @@ def update_node_pool( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.UpdateNodePoolRequest. # There's no risk of modifying the input as we've already verified @@ -828,7 +817,6 @@ def set_node_pool_autoscaling( request (google.cloud.container_v1beta1.types.SetNodePoolAutoscalingRequest): The request object. SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -844,7 +832,6 @@ def set_node_pool_autoscaling( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetNodePoolAutoscalingRequest. # There's no risk of modifying the input as we've already verified @@ -936,7 +923,6 @@ def set_logging_service( This corresponds to the ``logging_service`` 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. @@ -967,10 +953,8 @@ def set_logging_service( # there are no flattened fields. if not isinstance(request, cluster_service.SetLoggingServiceRequest): request = cluster_service.SetLoggingServiceRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1064,7 +1048,6 @@ def set_monitoring_service( This corresponds to the ``monitoring_service`` 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. @@ -1095,10 +1078,8 @@ def set_monitoring_service( # there are no flattened fields. if not isinstance(request, cluster_service.SetMonitoringServiceRequest): request = cluster_service.SetMonitoringServiceRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1179,7 +1160,6 @@ def set_addons_config( This corresponds to the ``addons_config`` 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. @@ -1210,10 +1190,8 @@ def set_addons_config( # there are no flattened fields. if not isinstance(request, cluster_service.SetAddonsConfigRequest): request = cluster_service.SetAddonsConfigRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1302,7 +1280,6 @@ def set_locations( This corresponds to the ``locations`` 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. @@ -1333,10 +1310,8 @@ def set_locations( # there are no flattened fields. if not isinstance(request, cluster_service.SetLocationsRequest): request = cluster_service.SetLocationsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1428,7 +1403,6 @@ def update_master( This corresponds to the ``master_version`` 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. @@ -1459,10 +1433,8 @@ def update_master( # there are no flattened fields. if not isinstance(request, cluster_service.UpdateMasterRequest): request = cluster_service.UpdateMasterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1505,7 +1477,6 @@ def set_master_auth( request (google.cloud.container_v1beta1.types.SetMasterAuthRequest): The request object. SetMasterAuthRequest updates the admin password of a cluster. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1521,7 +1492,6 @@ def set_master_auth( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetMasterAuthRequest. # There's no risk of modifying the input as we've already verified @@ -1600,7 +1570,6 @@ def delete_cluster( This corresponds to the ``cluster_id`` 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. @@ -1631,10 +1600,8 @@ def delete_cluster( # there are no flattened fields. if not isinstance(request, cluster_service.DeleteClusterRequest): request = cluster_service.DeleteClusterRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1696,7 +1663,6 @@ def list_operations( This corresponds to the ``zone`` 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. @@ -1725,10 +1691,8 @@ def list_operations( # there are no flattened fields. if not isinstance(request, cluster_service.ListOperationsRequest): request = cluster_service.ListOperationsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1795,7 +1759,6 @@ def get_operation( This corresponds to the ``operation_id`` 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. @@ -1826,10 +1789,8 @@ def get_operation( # there are no flattened fields. if not isinstance(request, cluster_service.GetOperationRequest): request = cluster_service.GetOperationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1898,7 +1859,6 @@ def cancel_operation( This corresponds to the ``operation_id`` 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. @@ -1921,10 +1881,8 @@ def cancel_operation( # there are no flattened fields. if not isinstance(request, cluster_service.CancelOperationRequest): request = cluster_service.CancelOperationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -1984,7 +1942,6 @@ def get_server_config( This corresponds to the ``zone`` 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. @@ -2013,10 +1970,8 @@ def get_server_config( # there are no flattened fields. if not isinstance(request, cluster_service.GetServerConfigRequest): request = cluster_service.GetServerConfigRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2083,7 +2038,6 @@ def list_node_pools( This corresponds to the ``cluster_id`` 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. @@ -2112,10 +2066,8 @@ def list_node_pools( # there are no flattened fields. if not isinstance(request, cluster_service.ListNodePoolsRequest): request = cluster_service.ListNodePoolsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2159,7 +2111,6 @@ def get_json_web_keys( token requests. This will be the jwks_uri for the discover document returned by getOpenIDConfig. See the OpenID Connect Discovery 1.0 specification for details. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2174,7 +2125,6 @@ def get_json_web_keys( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.GetJSONWebKeysRequest. # There's no risk of modifying the input as we've already verified @@ -2253,7 +2203,6 @@ def get_node_pool( This corresponds to the ``node_pool_id`` 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. @@ -2290,10 +2239,8 @@ def get_node_pool( # there are no flattened fields. if not isinstance(request, cluster_service.GetNodePoolRequest): request = cluster_service.GetNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2370,7 +2317,6 @@ def create_node_pool( This corresponds to the ``node_pool`` 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. @@ -2401,10 +2347,8 @@ def create_node_pool( # there are no flattened fields. if not isinstance(request, cluster_service.CreateNodePoolRequest): request = cluster_service.CreateNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2485,7 +2429,6 @@ def delete_node_pool( This corresponds to the ``node_pool_id`` 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. @@ -2516,10 +2459,8 @@ def delete_node_pool( # there are no flattened fields. if not isinstance(request, cluster_service.DeleteNodePoolRequest): request = cluster_service.DeleteNodePoolRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2605,7 +2546,6 @@ def rollback_node_pool_upgrade( This corresponds to the ``node_pool_id`` 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. @@ -2636,10 +2576,8 @@ def rollback_node_pool_upgrade( # there are no flattened fields. if not isinstance(request, cluster_service.RollbackNodePoolUpgradeRequest): request = cluster_service.RollbackNodePoolUpgradeRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2731,7 +2669,6 @@ def set_node_pool_management( This corresponds to the ``management`` 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. @@ -2764,10 +2701,8 @@ def set_node_pool_management( # there are no flattened fields. if not isinstance(request, cluster_service.SetNodePoolManagementRequest): request = cluster_service.SetNodePoolManagementRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2866,7 +2801,6 @@ def set_labels( This corresponds to the ``label_fingerprint`` 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. @@ -2899,10 +2833,8 @@ def set_labels( # there are no flattened fields. if not isinstance(request, cluster_service.SetLabelsRequest): request = cluster_service.SetLabelsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -2985,7 +2917,6 @@ def set_legacy_abac( This corresponds to the ``enabled`` 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. @@ -3016,10 +2947,8 @@ def set_legacy_abac( # there are no flattened fields. if not isinstance(request, cluster_service.SetLegacyAbacRequest): request = cluster_service.SetLegacyAbacRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3091,7 +3020,6 @@ def start_ip_rotation( This corresponds to the ``cluster_id`` 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. @@ -3122,10 +3050,8 @@ def start_ip_rotation( # there are no flattened fields. if not isinstance(request, cluster_service.StartIPRotationRequest): request = cluster_service.StartIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3194,7 +3120,6 @@ def complete_ip_rotation( This corresponds to the ``cluster_id`` 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. @@ -3225,10 +3150,8 @@ def complete_ip_rotation( # there are no flattened fields. if not isinstance(request, cluster_service.CompleteIPRotationRequest): request = cluster_service.CompleteIPRotationRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3266,7 +3189,6 @@ def set_node_pool_size( request (google.cloud.container_v1beta1.types.SetNodePoolSizeRequest): The request object. SetNodePoolSizeRequest sets the size a node pool. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3282,7 +3204,6 @@ def set_node_pool_size( """ # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes # in a cluster_service.SetNodePoolSizeRequest. # There's no risk of modifying the input as we've already verified @@ -3359,7 +3280,6 @@ def set_network_policy( This corresponds to the ``network_policy`` 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. @@ -3390,10 +3310,8 @@ def set_network_policy( # there are no flattened fields. if not isinstance(request, cluster_service.SetNetworkPolicyRequest): request = cluster_service.SetNetworkPolicyRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3468,7 +3386,6 @@ def set_maintenance_policy( This corresponds to the ``maintenance_policy`` 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. @@ -3499,10 +3416,8 @@ def set_maintenance_policy( # there are no flattened fields. if not isinstance(request, cluster_service.SetMaintenancePolicyRequest): request = cluster_service.SetMaintenancePolicyRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if project_id is not None: request.project_id = project_id if zone is not None: @@ -3552,7 +3467,6 @@ def list_usable_subnetworks( This corresponds to the ``parent`` 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. @@ -3586,10 +3500,8 @@ def list_usable_subnetworks( # there are no flattened fields. if not isinstance(request, cluster_service.ListUsableSubnetworksRequest): request = cluster_service.ListUsableSubnetworksRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent @@ -3638,7 +3550,6 @@ def list_locations( This corresponds to the ``parent`` 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. @@ -3668,10 +3579,8 @@ def list_locations( # there are no flattened fields. if not isinstance(request, cluster_service.ListLocationsRequest): request = cluster_service.ListLocationsRequest(request) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: request.parent = parent diff --git a/google/cloud/container_v1beta1/services/cluster_manager/pagers.py b/google/cloud/container_v1beta1/services/cluster_manager/pagers.py index 3967c955..8dc8127d 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/pagers.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/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, @@ -117,7 +115,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/container_v1beta1/services/cluster_manager/transports/__init__.py b/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py index 554ca670..11ad942a 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/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/container_v1beta1/services/cluster_manager/transports/base.py b/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py index 3c51f6d5..523a2431 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/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.container_v1beta1.types import cluster_service -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( @@ -36,27 +35,41 @@ 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 ClusterManagerTransport(abc.ABC): """Abstract transport class for ClusterManager.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + DEFAULT_HOST: str = "container.googleapis.com" + def __init__( self, *, - host: str = "container.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 @@ -65,7 +78,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): @@ -79,29 +92,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 = { @@ -112,7 +172,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -126,7 +187,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -174,7 +236,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -188,7 +251,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -202,7 +266,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -219,7 +284,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -233,7 +299,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -250,7 +317,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -267,7 +335,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -316,7 +385,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -330,7 +400,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, ), deadline=20.0, ), @@ -342,11 +413,11 @@ def _prep_wrapped_messages(self, client_info): @property def list_clusters( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListClustersRequest], - typing.Union[ + Union[ cluster_service.ListClustersResponse, - typing.Awaitable[cluster_service.ListClustersResponse], + Awaitable[cluster_service.ListClustersResponse], ], ]: raise NotImplementedError() @@ -354,143 +425,119 @@ def list_clusters( @property def get_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetClusterRequest], - typing.Union[ - cluster_service.Cluster, typing.Awaitable[cluster_service.Cluster] - ], + Union[cluster_service.Cluster, Awaitable[cluster_service.Cluster]], ]: raise NotImplementedError() @property def create_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CreateClusterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def update_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.UpdateClusterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def update_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.UpdateNodePoolRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_node_pool_autoscaling( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNodePoolAutoscalingRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_logging_service( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLoggingServiceRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_monitoring_service( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetMonitoringServiceRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_addons_config( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetAddonsConfigRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_locations( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLocationsRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def update_master( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.UpdateMasterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_master_auth( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetMasterAuthRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def delete_cluster( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.DeleteClusterRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def list_operations( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListOperationsRequest], - typing.Union[ + Union[ cluster_service.ListOperationsResponse, - typing.Awaitable[cluster_service.ListOperationsResponse], + Awaitable[cluster_service.ListOperationsResponse], ], ]: raise NotImplementedError() @@ -498,42 +545,38 @@ def list_operations( @property def get_operation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetOperationRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def cancel_operation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CancelOperationRequest], - typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], ]: raise NotImplementedError() @property def get_server_config( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetServerConfigRequest], - typing.Union[ - cluster_service.ServerConfig, typing.Awaitable[cluster_service.ServerConfig] - ], + Union[cluster_service.ServerConfig, Awaitable[cluster_service.ServerConfig]], ]: raise NotImplementedError() @property def list_node_pools( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListNodePoolsRequest], - typing.Union[ + Union[ cluster_service.ListNodePoolsResponse, - typing.Awaitable[cluster_service.ListNodePoolsResponse], + Awaitable[cluster_service.ListNodePoolsResponse], ], ]: raise NotImplementedError() @@ -541,11 +584,11 @@ def list_node_pools( @property def get_json_web_keys( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetJSONWebKeysRequest], - typing.Union[ + Union[ cluster_service.GetJSONWebKeysResponse, - typing.Awaitable[cluster_service.GetJSONWebKeysResponse], + Awaitable[cluster_service.GetJSONWebKeysResponse], ], ]: raise NotImplementedError() @@ -553,143 +596,119 @@ def get_json_web_keys( @property def get_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.GetNodePoolRequest], - typing.Union[ - cluster_service.NodePool, typing.Awaitable[cluster_service.NodePool] - ], + Union[cluster_service.NodePool, Awaitable[cluster_service.NodePool]], ]: raise NotImplementedError() @property def create_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CreateNodePoolRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def delete_node_pool( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.DeleteNodePoolRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def rollback_node_pool_upgrade( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.RollbackNodePoolUpgradeRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_node_pool_management( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNodePoolManagementRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_labels( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLabelsRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_legacy_abac( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetLegacyAbacRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def start_ip_rotation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.StartIPRotationRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def complete_ip_rotation( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.CompleteIPRotationRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_node_pool_size( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNodePoolSizeRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_network_policy( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetNetworkPolicyRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def set_maintenance_policy( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.SetMaintenancePolicyRequest], - typing.Union[ - cluster_service.Operation, typing.Awaitable[cluster_service.Operation] - ], + Union[cluster_service.Operation, Awaitable[cluster_service.Operation]], ]: raise NotImplementedError() @property def list_usable_subnetworks( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListUsableSubnetworksRequest], - typing.Union[ + Union[ cluster_service.ListUsableSubnetworksResponse, - typing.Awaitable[cluster_service.ListUsableSubnetworksResponse], + Awaitable[cluster_service.ListUsableSubnetworksResponse], ], ]: raise NotImplementedError() @@ -697,11 +716,11 @@ def list_usable_subnetworks( @property def list_locations( self, - ) -> typing.Callable[ + ) -> Callable[ [cluster_service.ListLocationsRequest], - typing.Union[ + Union[ cluster_service.ListLocationsResponse, - typing.Awaitable[cluster_service.ListLocationsResponse], + Awaitable[cluster_service.ListLocationsResponse], ], ]: raise NotImplementedError() diff --git a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py b/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py index 65264465..5da4bc2d 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/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,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 +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.container_v1beta1.types import cluster_service -from google.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO @@ -51,7 +48,7 @@ def __init__( self, *, host: str = "container.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -65,7 +62,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 @@ -175,7 +173,7 @@ def __init__( def create_channel( cls, host: str = "container.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, @@ -206,13 +204,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, ) @@ -655,7 +655,7 @@ def get_operation( @property def cancel_operation( self, - ) -> Callable[[cluster_service.CancelOperationRequest], empty.Empty]: + ) -> Callable[[cluster_service.CancelOperationRequest], empty_pb2.Empty]: r"""Return a callable for the cancel operation method over gRPC. Cancels the specified operation. @@ -674,7 +674,7 @@ def cancel_operation( self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( "/google.container.v1beta1.ClusterManager/CancelOperation", request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["cancel_operation"] diff --git a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py b/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py index 0d431fc2..b5f2bb5a 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/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,22 +13,20 @@ # 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.container_v1beta1.types import cluster_service -from google.protobuf import empty_pb2 as empty # type: ignore - +from google.protobuf import empty_pb2 # type: ignore from .base import ClusterManagerTransport, DEFAULT_CLIENT_INFO from .grpc import ClusterManagerGrpcTransport @@ -54,7 +51,7 @@ class ClusterManagerGrpcAsyncIOTransport(ClusterManagerTransport): def create_channel( cls, host: str = "container.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, @@ -81,13 +78,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, ) @@ -95,7 +94,7 @@ def __init__( self, *, host: str = "container.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, @@ -109,7 +108,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 @@ -167,7 +167,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 @@ -683,7 +682,7 @@ def get_operation( @property def cancel_operation( self, - ) -> Callable[[cluster_service.CancelOperationRequest], Awaitable[empty.Empty]]: + ) -> Callable[[cluster_service.CancelOperationRequest], Awaitable[empty_pb2.Empty]]: r"""Return a callable for the cancel operation method over gRPC. Cancels the specified operation. @@ -702,7 +701,7 @@ def cancel_operation( self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( "/google.container.v1beta1.ClusterManager/CancelOperation", request_serializer=cluster_service.CancelOperationRequest.serialize, - response_deserializer=empty.Empty.FromString, + response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["cancel_operation"] diff --git a/google/cloud/container_v1beta1/types/__init__.py b/google/cloud/container_v1beta1/types/__init__.py index 90863492..8583d925 100644 --- a/google/cloud/container_v1beta1/types/__init__.py +++ b/google/cloud/container_v1beta1/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 .cluster_service import ( AcceleratorConfig, AddonsConfig, diff --git a/google/cloud/container_v1beta1/types/cluster_service.py b/google/cloud/container_v1beta1/types/cluster_service.py index 4ab224c7..6a951a15 100644 --- a/google/cloud/container_v1beta1/types/cluster_service.py +++ b/google/cloud/container_v1beta1/types/cluster_service.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.protobuf import timestamp_pb2 as timestamp # type: ignore -from google.protobuf import wrappers_pb2 as wrappers # type: ignore -from google.rpc import code_pb2 as gr_code # type: ignore -from google.rpc import status_pb2 as gr_status # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.protobuf import wrappers_pb2 # type: ignore +from google.rpc import code_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore __protobuf__ = proto.module( @@ -165,7 +162,6 @@ class UpgradeResourceType(proto.Enum): class LinuxNodeConfig(proto.Message): r"""Parameters that can be configured on Linux nodes. - Attributes: sysctls (Sequence[google.cloud.container_v1beta1.types.LinuxNodeConfig.SysctlsEntry]): The Linux kernel parameters to be applied to the nodes and @@ -179,12 +175,11 @@ class LinuxNodeConfig(proto.Message): net.ipv4.tcp_tw_reuse """ - sysctls = proto.MapField(proto.STRING, proto.STRING, number=1) + sysctls = proto.MapField(proto.STRING, proto.STRING, number=1,) class NodeKubeletConfig(proto.Message): r"""Node kubelet configs. - Attributes: cpu_manager_policy (str): Control the CPU management policy on the @@ -223,16 +218,15 @@ class NodeKubeletConfig(proto.Message): The value must be a positive duration. """ - cpu_manager_policy = proto.Field(proto.STRING, number=1) - - cpu_cfs_quota = proto.Field(proto.MESSAGE, number=2, message=wrappers.BoolValue,) - - cpu_cfs_quota_period = proto.Field(proto.STRING, number=3) + cpu_manager_policy = proto.Field(proto.STRING, number=1,) + cpu_cfs_quota = proto.Field( + proto.MESSAGE, number=2, message=wrappers_pb2.BoolValue, + ) + cpu_cfs_quota_period = proto.Field(proto.STRING, number=3,) class NodeConfig(proto.Message): r"""Parameters that describe the nodes in a cluster. - Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -408,60 +402,38 @@ class NodeConfig(proto.Message): backed by the boot disk. """ - machine_type = proto.Field(proto.STRING, number=1) - - disk_size_gb = proto.Field(proto.INT32, number=2) - - oauth_scopes = proto.RepeatedField(proto.STRING, number=3) - - service_account = proto.Field(proto.STRING, number=9) - - metadata = proto.MapField(proto.STRING, proto.STRING, number=4) - - image_type = proto.Field(proto.STRING, number=5) - - labels = proto.MapField(proto.STRING, proto.STRING, number=6) - - local_ssd_count = proto.Field(proto.INT32, number=7) - - tags = proto.RepeatedField(proto.STRING, number=8) - - preemptible = proto.Field(proto.BOOL, number=10) - + machine_type = proto.Field(proto.STRING, number=1,) + disk_size_gb = proto.Field(proto.INT32, number=2,) + oauth_scopes = proto.RepeatedField(proto.STRING, number=3,) + service_account = proto.Field(proto.STRING, number=9,) + metadata = proto.MapField(proto.STRING, proto.STRING, number=4,) + image_type = proto.Field(proto.STRING, number=5,) + labels = proto.MapField(proto.STRING, proto.STRING, number=6,) + local_ssd_count = proto.Field(proto.INT32, number=7,) + tags = proto.RepeatedField(proto.STRING, number=8,) + preemptible = proto.Field(proto.BOOL, number=10,) accelerators = proto.RepeatedField( proto.MESSAGE, number=11, message="AcceleratorConfig", ) - sandbox_config = proto.Field(proto.MESSAGE, number=17, message="SandboxConfig",) - - node_group = proto.Field(proto.STRING, number=18) - + node_group = proto.Field(proto.STRING, number=18,) reservation_affinity = proto.Field( proto.MESSAGE, number=19, message="ReservationAffinity", ) - - disk_type = proto.Field(proto.STRING, number=12) - - min_cpu_platform = proto.Field(proto.STRING, number=13) - + disk_type = proto.Field(proto.STRING, number=12,) + min_cpu_platform = proto.Field(proto.STRING, number=13,) workload_metadata_config = proto.Field( proto.MESSAGE, number=14, message="WorkloadMetadataConfig", ) - taints = proto.RepeatedField(proto.MESSAGE, number=15, message="NodeTaint",) - - boot_disk_kms_key = proto.Field(proto.STRING, number=23) - + boot_disk_kms_key = proto.Field(proto.STRING, number=23,) shielded_instance_config = proto.Field( proto.MESSAGE, number=20, message="ShieldedInstanceConfig", ) - linux_node_config = proto.Field( proto.MESSAGE, number=21, message="LinuxNodeConfig", ) - kubelet_config = proto.Field(proto.MESSAGE, number=22, message="NodeKubeletConfig",) - ephemeral_storage_config = proto.Field( proto.MESSAGE, number=24, message="EphemeralStorageConfig", ) @@ -469,7 +441,6 @@ class NodeConfig(proto.Message): class ShieldedInstanceConfig(proto.Message): r"""A set of Shielded Instance options. - Attributes: enable_secure_boot (bool): Defines whether the instance has Secure Boot @@ -490,9 +461,8 @@ class ShieldedInstanceConfig(proto.Message): is created. """ - enable_secure_boot = proto.Field(proto.BOOL, number=1) - - enable_integrity_monitoring = proto.Field(proto.BOOL, number=2) + enable_secure_boot = proto.Field(proto.BOOL, number=1,) + enable_integrity_monitoring = proto.Field(proto.BOOL, number=2,) class SandboxConfig(proto.Message): @@ -512,8 +482,7 @@ class Type(proto.Enum): UNSPECIFIED = 0 GVISOR = 1 - sandbox_type = proto.Field(proto.STRING, number=1) - + sandbox_type = proto.Field(proto.STRING, number=1,) type_ = proto.Field(proto.ENUM, number=2, enum=Type,) @@ -529,7 +498,7 @@ class EphemeralStorageConfig(proto.Message): using local SSDs as ephemeral storage. """ - local_ssd_count = proto.Field(proto.INT32, number=1) + local_ssd_count = proto.Field(proto.INT32, number=1,) class ReservationAffinity(proto.Message): @@ -561,10 +530,8 @@ class Type(proto.Enum): SPECIFIC_RESERVATION = 3 consume_reservation_type = proto.Field(proto.ENUM, number=1, enum=Type,) - - key = proto.Field(proto.STRING, number=2) - - values = proto.RepeatedField(proto.STRING, number=3) + key = proto.Field(proto.STRING, number=2,) + values = proto.RepeatedField(proto.STRING, number=3,) class NodeTaint(proto.Message): @@ -592,10 +559,8 @@ class Effect(proto.Enum): PREFER_NO_SCHEDULE = 2 NO_EXECUTE = 3 - key = proto.Field(proto.STRING, number=1) - - value = proto.Field(proto.STRING, number=2) - + key = proto.Field(proto.STRING, number=1,) + value = proto.Field(proto.STRING, number=2,) effect = proto.Field(proto.ENUM, number=3, enum=Effect,) @@ -646,30 +611,24 @@ class MasterAuth(proto.Message): authenticate to the cluster endpoint. """ - username = proto.Field(proto.STRING, number=1) - - password = proto.Field(proto.STRING, number=2) - + username = proto.Field(proto.STRING, number=1,) + password = proto.Field(proto.STRING, number=2,) client_certificate_config = proto.Field( proto.MESSAGE, number=3, message="ClientCertificateConfig", ) - - cluster_ca_certificate = proto.Field(proto.STRING, number=100) - - client_certificate = proto.Field(proto.STRING, number=101) - - client_key = proto.Field(proto.STRING, number=102) + cluster_ca_certificate = proto.Field(proto.STRING, number=100,) + client_certificate = proto.Field(proto.STRING, number=101,) + client_key = proto.Field(proto.STRING, number=102,) class ClientCertificateConfig(proto.Message): r"""Configuration for client certificates on the cluster. - Attributes: issue_client_certificate (bool): Issue a client certificate. """ - issue_client_certificate = proto.Field(proto.BOOL, number=1) + issue_client_certificate = proto.Field(proto.BOOL, number=1,) class AddonsConfig(proto.Message): @@ -727,33 +686,24 @@ class AddonsConfig(proto.Message): http_load_balancing = proto.Field( proto.MESSAGE, number=1, message="HttpLoadBalancing", ) - horizontal_pod_autoscaling = proto.Field( proto.MESSAGE, number=2, message="HorizontalPodAutoscaling", ) - kubernetes_dashboard = proto.Field( proto.MESSAGE, number=3, message="KubernetesDashboard", ) - network_policy_config = proto.Field( proto.MESSAGE, number=4, message="NetworkPolicyConfig", ) - istio_config = proto.Field(proto.MESSAGE, number=5, message="IstioConfig",) - cloud_run_config = proto.Field(proto.MESSAGE, number=7, message="CloudRunConfig",) - dns_cache_config = proto.Field(proto.MESSAGE, number=8, message="DnsCacheConfig",) - config_connector_config = proto.Field( proto.MESSAGE, number=10, message="ConfigConnectorConfig", ) - gce_persistent_disk_csi_driver_config = proto.Field( proto.MESSAGE, number=11, message="GcePersistentDiskCsiDriverConfig", ) - kalm_config = proto.Field(proto.MESSAGE, number=12, message="KalmConfig",) @@ -770,7 +720,7 @@ class HttpLoadBalancing(proto.Message): balancers. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class HorizontalPodAutoscaling(proto.Message): @@ -787,19 +737,18 @@ class HorizontalPodAutoscaling(proto.Message): Stackdriver Monitoring. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class KubernetesDashboard(proto.Message): r"""Configuration for the Kubernetes Dashboard. - Attributes: disabled (bool): Whether the Kubernetes Dashboard is enabled for this cluster. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class NetworkPolicyConfig(proto.Message): @@ -813,42 +762,39 @@ class NetworkPolicyConfig(proto.Message): cluster. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class DnsCacheConfig(proto.Message): r"""Configuration for NodeLocal DNSCache - Attributes: enabled (bool): Whether NodeLocal DNSCache is enabled for this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class KalmConfig(proto.Message): r"""Configuration options for the KALM addon. - Attributes: enabled (bool): Whether KALM is enabled for this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class ConfigConnectorConfig(proto.Message): r"""Configuration options for the Config Connector add-on. - Attributes: enabled (bool): Whether Cloud Connector is enabled for this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class GcePersistentDiskCsiDriverConfig(proto.Message): @@ -861,24 +807,22 @@ class GcePersistentDiskCsiDriverConfig(proto.Message): enabled for this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class PrivateClusterMasterGlobalAccessConfig(proto.Message): r"""Configuration for controlling master global access settings. - Attributes: enabled (bool): Whenever master is accessible globally or not. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class PrivateClusterConfig(proto.Message): r"""Configuration options for private clusters. - Attributes: enable_private_nodes (bool): Whether nodes have internal IP addresses @@ -908,18 +852,12 @@ class PrivateClusterConfig(proto.Message): Controls master global access settings. """ - enable_private_nodes = proto.Field(proto.BOOL, number=1) - - enable_private_endpoint = proto.Field(proto.BOOL, number=2) - - master_ipv4_cidr_block = proto.Field(proto.STRING, number=3) - - private_endpoint = proto.Field(proto.STRING, number=4) - - public_endpoint = proto.Field(proto.STRING, number=5) - - peering_name = proto.Field(proto.STRING, number=7) - + enable_private_nodes = proto.Field(proto.BOOL, number=1,) + enable_private_endpoint = proto.Field(proto.BOOL, number=2,) + master_ipv4_cidr_block = proto.Field(proto.STRING, number=3,) + private_endpoint = proto.Field(proto.STRING, number=4,) + public_endpoint = proto.Field(proto.STRING, number=5,) + peering_name = proto.Field(proto.STRING, number=7,) master_global_access_config = proto.Field( proto.MESSAGE, number=8, message="PrivateClusterMasterGlobalAccessConfig", ) @@ -927,7 +865,6 @@ class PrivateClusterConfig(proto.Message): class IstioConfig(proto.Message): r"""Configuration options for Istio addon. - Attributes: disabled (bool): Whether Istio is enabled for this cluster. @@ -943,14 +880,12 @@ class IstioAuthMode(proto.Enum): AUTH_NONE = 0 AUTH_MUTUAL_TLS = 1 - disabled = proto.Field(proto.BOOL, number=1) - + disabled = proto.Field(proto.BOOL, number=1,) auth = proto.Field(proto.ENUM, number=2, enum=IstioAuthMode,) class CloudRunConfig(proto.Message): r"""Configuration options for the Cloud Run feature. - Attributes: disabled (bool): Whether Cloud Run addon is enabled for this @@ -966,8 +901,7 @@ class LoadBalancerType(proto.Enum): LOAD_BALANCER_TYPE_EXTERNAL = 1 LOAD_BALANCER_TYPE_INTERNAL = 2 - disabled = proto.Field(proto.BOOL, number=1) - + disabled = proto.Field(proto.BOOL, number=1,) load_balancer_type = proto.Field(proto.ENUM, number=3, enum=LoadBalancerType,) @@ -989,7 +923,6 @@ class MasterAuthorizedNetworksConfig(proto.Message): class CidrBlock(proto.Message): r"""CidrBlock contains an optional name and one CIDR block. - Attributes: display_name (str): display_name is an optional field for users to identify CIDR @@ -998,12 +931,10 @@ class CidrBlock(proto.Message): cidr_block must be specified in CIDR notation. """ - display_name = proto.Field(proto.STRING, number=1) - - cidr_block = proto.Field(proto.STRING, number=2) - - enabled = proto.Field(proto.BOOL, number=1) + display_name = proto.Field(proto.STRING, number=1,) + cidr_block = proto.Field(proto.STRING, number=2,) + enabled = proto.Field(proto.BOOL, number=1,) cidr_blocks = proto.RepeatedField(proto.MESSAGE, number=2, message=CidrBlock,) @@ -1021,7 +952,7 @@ class LegacyAbac(proto.Message): configuration or IAM. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class NetworkPolicy(proto.Message): @@ -1043,8 +974,7 @@ class Provider(proto.Enum): CALICO = 1 provider = proto.Field(proto.ENUM, number=1, enum=Provider,) - - enabled = proto.Field(proto.BOOL, number=2) + enabled = proto.Field(proto.BOOL, number=2,) class IPAllocationPolicy(proto.Message): @@ -1186,38 +1116,24 @@ class IPAllocationPolicy(proto.Message): allocation mode """ - use_ip_aliases = proto.Field(proto.BOOL, number=1) - - create_subnetwork = proto.Field(proto.BOOL, number=2) - - subnetwork_name = proto.Field(proto.STRING, number=3) - - cluster_ipv4_cidr = proto.Field(proto.STRING, number=4) - - node_ipv4_cidr = proto.Field(proto.STRING, number=5) - - services_ipv4_cidr = proto.Field(proto.STRING, number=6) - - cluster_secondary_range_name = proto.Field(proto.STRING, number=7) - - services_secondary_range_name = proto.Field(proto.STRING, number=8) - - cluster_ipv4_cidr_block = proto.Field(proto.STRING, number=9) - - node_ipv4_cidr_block = proto.Field(proto.STRING, number=10) - - services_ipv4_cidr_block = proto.Field(proto.STRING, number=11) - - allow_route_overlap = proto.Field(proto.BOOL, number=12) - - tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=13) - - use_routes = proto.Field(proto.BOOL, number=15) + use_ip_aliases = proto.Field(proto.BOOL, number=1,) + create_subnetwork = proto.Field(proto.BOOL, number=2,) + subnetwork_name = proto.Field(proto.STRING, number=3,) + cluster_ipv4_cidr = proto.Field(proto.STRING, number=4,) + node_ipv4_cidr = proto.Field(proto.STRING, number=5,) + services_ipv4_cidr = proto.Field(proto.STRING, number=6,) + cluster_secondary_range_name = proto.Field(proto.STRING, number=7,) + services_secondary_range_name = proto.Field(proto.STRING, number=8,) + cluster_ipv4_cidr_block = proto.Field(proto.STRING, number=9,) + node_ipv4_cidr_block = proto.Field(proto.STRING, number=10,) + services_ipv4_cidr_block = proto.Field(proto.STRING, number=11,) + allow_route_overlap = proto.Field(proto.BOOL, number=12,) + tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=13,) + use_routes = proto.Field(proto.BOOL, number=15,) class BinaryAuthorization(proto.Message): r"""Configuration for Binary Authorization. - Attributes: enabled (bool): Enable Binary Authorization for this cluster. @@ -1225,12 +1141,11 @@ class BinaryAuthorization(proto.Message): validated by Google Binauthz. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class PodSecurityPolicyConfig(proto.Message): r"""Configuration for the PodSecurityPolicy feature. - Attributes: enabled (bool): Enable the PodSecurityPolicy controller for @@ -1238,7 +1153,7 @@ class PodSecurityPolicyConfig(proto.Message): under a PodSecurityPolicy to be created. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class AuthenticatorGroupsConfig(proto.Message): @@ -1255,14 +1170,12 @@ class AuthenticatorGroupsConfig(proto.Message): be used. Only relevant if enabled = true. """ - enabled = proto.Field(proto.BOOL, number=1) - - security_group = proto.Field(proto.STRING, number=2) + enabled = proto.Field(proto.BOOL, number=1,) + security_group = proto.Field(proto.STRING, number=2,) class ClusterTelemetry(proto.Message): r"""Telemetry integration for the cluster. - Attributes: type_ (google.cloud.container_v1beta1.types.ClusterTelemetry.Type): Type of the integration. @@ -1280,7 +1193,6 @@ class Type(proto.Enum): class Cluster(proto.Message): r"""A Google Kubernetes Engine cluster. - Attributes: name (str): The name of this cluster. The name must be unique within @@ -1581,154 +1493,96 @@ class Status(proto.Enum): ERROR = 5 DEGRADED = 6 - name = proto.Field(proto.STRING, number=1) - - description = proto.Field(proto.STRING, number=2) - - initial_node_count = proto.Field(proto.INT32, number=3) - + name = proto.Field(proto.STRING, number=1,) + description = proto.Field(proto.STRING, number=2,) + initial_node_count = proto.Field(proto.INT32, number=3,) node_config = proto.Field(proto.MESSAGE, number=4, message="NodeConfig",) - master_auth = proto.Field(proto.MESSAGE, number=5, message="MasterAuth",) - - logging_service = proto.Field(proto.STRING, number=6) - - monitoring_service = proto.Field(proto.STRING, number=7) - - network = proto.Field(proto.STRING, number=8) - - cluster_ipv4_cidr = proto.Field(proto.STRING, number=9) - + logging_service = proto.Field(proto.STRING, number=6,) + monitoring_service = proto.Field(proto.STRING, number=7,) + network = proto.Field(proto.STRING, number=8,) + cluster_ipv4_cidr = proto.Field(proto.STRING, number=9,) addons_config = proto.Field(proto.MESSAGE, number=10, message="AddonsConfig",) - - subnetwork = proto.Field(proto.STRING, number=11) - + subnetwork = proto.Field(proto.STRING, number=11,) node_pools = proto.RepeatedField(proto.MESSAGE, number=12, message="NodePool",) - - locations = proto.RepeatedField(proto.STRING, number=13) - - enable_kubernetes_alpha = proto.Field(proto.BOOL, number=14) - - resource_labels = proto.MapField(proto.STRING, proto.STRING, number=15) - - label_fingerprint = proto.Field(proto.STRING, number=16) - + locations = proto.RepeatedField(proto.STRING, number=13,) + enable_kubernetes_alpha = proto.Field(proto.BOOL, number=14,) + resource_labels = proto.MapField(proto.STRING, proto.STRING, number=15,) + label_fingerprint = proto.Field(proto.STRING, number=16,) legacy_abac = proto.Field(proto.MESSAGE, number=18, message="LegacyAbac",) - network_policy = proto.Field(proto.MESSAGE, number=19, message="NetworkPolicy",) - ip_allocation_policy = proto.Field( proto.MESSAGE, number=20, message="IPAllocationPolicy", ) - master_authorized_networks_config = proto.Field( proto.MESSAGE, number=22, message="MasterAuthorizedNetworksConfig", ) - maintenance_policy = proto.Field( proto.MESSAGE, number=23, message="MaintenancePolicy", ) - binary_authorization = proto.Field( proto.MESSAGE, number=24, message="BinaryAuthorization", ) - pod_security_policy_config = proto.Field( proto.MESSAGE, number=25, message="PodSecurityPolicyConfig", ) - autoscaling = proto.Field(proto.MESSAGE, number=26, message="ClusterAutoscaling",) - network_config = proto.Field(proto.MESSAGE, number=27, message="NetworkConfig",) - - private_cluster = proto.Field(proto.BOOL, number=28) - - master_ipv4_cidr_block = proto.Field(proto.STRING, number=29) - + private_cluster = proto.Field(proto.BOOL, number=28,) + master_ipv4_cidr_block = proto.Field(proto.STRING, number=29,) default_max_pods_constraint = proto.Field( proto.MESSAGE, number=30, message="MaxPodsConstraint", ) - resource_usage_export_config = proto.Field( proto.MESSAGE, number=33, message="ResourceUsageExportConfig", ) - authenticator_groups_config = proto.Field( proto.MESSAGE, number=34, message="AuthenticatorGroupsConfig", ) - private_cluster_config = proto.Field( proto.MESSAGE, number=37, message="PrivateClusterConfig", ) - vertical_pod_autoscaling = proto.Field( proto.MESSAGE, number=39, message="VerticalPodAutoscaling", ) - shielded_nodes = proto.Field(proto.MESSAGE, number=40, message="ShieldedNodes",) - release_channel = proto.Field(proto.MESSAGE, number=41, message="ReleaseChannel",) - workload_identity_config = proto.Field( proto.MESSAGE, number=43, message="WorkloadIdentityConfig", ) - cluster_telemetry = proto.Field( proto.MESSAGE, number=46, message="ClusterTelemetry", ) - tpu_config = proto.Field(proto.MESSAGE, number=47, message="TpuConfig",) - notification_config = proto.Field( proto.MESSAGE, number=49, message="NotificationConfig", ) - confidential_nodes = proto.Field( proto.MESSAGE, number=50, message="ConfidentialNodes", ) - - self_link = proto.Field(proto.STRING, number=100) - - zone = proto.Field(proto.STRING, number=101) - - endpoint = proto.Field(proto.STRING, number=102) - - initial_cluster_version = proto.Field(proto.STRING, number=103) - - current_master_version = proto.Field(proto.STRING, number=104) - - current_node_version = proto.Field(proto.STRING, number=105) - - create_time = proto.Field(proto.STRING, number=106) - + self_link = proto.Field(proto.STRING, number=100,) + zone = proto.Field(proto.STRING, number=101,) + endpoint = proto.Field(proto.STRING, number=102,) + initial_cluster_version = proto.Field(proto.STRING, number=103,) + current_master_version = proto.Field(proto.STRING, number=104,) + current_node_version = proto.Field(proto.STRING, number=105,) + create_time = proto.Field(proto.STRING, number=106,) status = proto.Field(proto.ENUM, number=107, enum=Status,) - - status_message = proto.Field(proto.STRING, number=108) - - node_ipv4_cidr_size = proto.Field(proto.INT32, number=109) - - services_ipv4_cidr = proto.Field(proto.STRING, number=110) - - instance_group_urls = proto.RepeatedField(proto.STRING, number=111) - - current_node_count = proto.Field(proto.INT32, number=112) - - expire_time = proto.Field(proto.STRING, number=113) - - location = proto.Field(proto.STRING, number=114) - - enable_tpu = proto.Field(proto.BOOL, number=115) - - tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=116) - + status_message = proto.Field(proto.STRING, number=108,) + node_ipv4_cidr_size = proto.Field(proto.INT32, number=109,) + services_ipv4_cidr = proto.Field(proto.STRING, number=110,) + instance_group_urls = proto.RepeatedField(proto.STRING, number=111,) + current_node_count = proto.Field(proto.INT32, number=112,) + expire_time = proto.Field(proto.STRING, number=113,) + location = proto.Field(proto.STRING, number=114,) + enable_tpu = proto.Field(proto.BOOL, number=115,) + tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=116,) database_encryption = proto.Field( proto.MESSAGE, number=38, message="DatabaseEncryption", ) - conditions = proto.RepeatedField( proto.MESSAGE, number=118, message="StatusCondition", ) - master = proto.Field(proto.MESSAGE, number=124, message="Master",) @@ -1868,94 +1722,68 @@ class ClusterUpdate(proto.Message): Configuration for master components. """ - desired_node_version = proto.Field(proto.STRING, number=4) - - desired_monitoring_service = proto.Field(proto.STRING, number=5) - + desired_node_version = proto.Field(proto.STRING, number=4,) + desired_monitoring_service = proto.Field(proto.STRING, number=5,) desired_addons_config = proto.Field( proto.MESSAGE, number=6, message="AddonsConfig", ) - - desired_node_pool_id = proto.Field(proto.STRING, number=7) - - desired_image_type = proto.Field(proto.STRING, number=8) - + desired_node_pool_id = proto.Field(proto.STRING, number=7,) + desired_image_type = proto.Field(proto.STRING, number=8,) desired_node_pool_autoscaling = proto.Field( proto.MESSAGE, number=9, message="NodePoolAutoscaling", ) - - desired_locations = proto.RepeatedField(proto.STRING, number=10) - + desired_locations = proto.RepeatedField(proto.STRING, number=10,) desired_master_authorized_networks_config = proto.Field( proto.MESSAGE, number=12, message="MasterAuthorizedNetworksConfig", ) - desired_pod_security_policy_config = proto.Field( proto.MESSAGE, number=14, message="PodSecurityPolicyConfig", ) - desired_cluster_autoscaling = proto.Field( proto.MESSAGE, number=15, message="ClusterAutoscaling", ) - desired_binary_authorization = proto.Field( proto.MESSAGE, number=16, message="BinaryAuthorization", ) - - desired_logging_service = proto.Field(proto.STRING, number=19) - + desired_logging_service = proto.Field(proto.STRING, number=19,) desired_resource_usage_export_config = proto.Field( proto.MESSAGE, number=21, message="ResourceUsageExportConfig", ) - desired_vertical_pod_autoscaling = proto.Field( proto.MESSAGE, number=22, message="VerticalPodAutoscaling", ) - desired_private_cluster_config = proto.Field( proto.MESSAGE, number=25, message="PrivateClusterConfig", ) - desired_intra_node_visibility_config = proto.Field( proto.MESSAGE, number=26, message="IntraNodeVisibilityConfig", ) - desired_default_snat_status = proto.Field( proto.MESSAGE, number=28, message="DefaultSnatStatus", ) - desired_cluster_telemetry = proto.Field( proto.MESSAGE, number=30, message="ClusterTelemetry", ) - desired_release_channel = proto.Field( proto.MESSAGE, number=31, message="ReleaseChannel", ) - desired_tpu_config = proto.Field(proto.MESSAGE, number=38, message="TpuConfig",) - desired_datapath_provider = proto.Field( proto.ENUM, number=50, enum="DatapathProvider", ) - desired_notification_config = proto.Field( proto.MESSAGE, number=55, message="NotificationConfig", ) - - desired_master_version = proto.Field(proto.STRING, number=100) - + desired_master_version = proto.Field(proto.STRING, number=100,) desired_database_encryption = proto.Field( proto.MESSAGE, number=46, message="DatabaseEncryption", ) - desired_workload_identity_config = proto.Field( proto.MESSAGE, number=47, message="WorkloadIdentityConfig", ) - desired_shielded_nodes = proto.Field( proto.MESSAGE, number=48, message="ShieldedNodes", ) - desired_master = proto.Field(proto.MESSAGE, number=52, message="Master",) @@ -2043,44 +1871,29 @@ class Type(proto.Enum): SET_NETWORK_POLICY = 15 SET_MAINTENANCE_POLICY = 16 - name = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - + name = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) operation_type = proto.Field(proto.ENUM, number=3, enum=Type,) - status = proto.Field(proto.ENUM, number=4, enum=Status,) - - detail = proto.Field(proto.STRING, number=8) - - status_message = proto.Field(proto.STRING, number=5) - - self_link = proto.Field(proto.STRING, number=6) - - target_link = proto.Field(proto.STRING, number=7) - - location = proto.Field(proto.STRING, number=9) - - start_time = proto.Field(proto.STRING, number=10) - - end_time = proto.Field(proto.STRING, number=11) - + detail = proto.Field(proto.STRING, number=8,) + status_message = proto.Field(proto.STRING, number=5,) + self_link = proto.Field(proto.STRING, number=6,) + target_link = proto.Field(proto.STRING, number=7,) + location = proto.Field(proto.STRING, number=9,) + start_time = proto.Field(proto.STRING, number=10,) + end_time = proto.Field(proto.STRING, number=11,) progress = proto.Field(proto.MESSAGE, number=12, message="OperationProgress",) - cluster_conditions = proto.RepeatedField( proto.MESSAGE, number=13, message="StatusCondition", ) - nodepool_conditions = proto.RepeatedField( proto.MESSAGE, number=14, message="StatusCondition", ) - - error = proto.Field(proto.MESSAGE, number=15, message=gr_status.Status,) + error = proto.Field(proto.MESSAGE, number=15, message=status_pb2.Status,) class OperationProgress(proto.Message): r"""Information about operation (or operation stage) progress. - Attributes: name (str): A non-parameterized string describing an @@ -2100,7 +1913,6 @@ class OperationProgress(proto.Message): class Metric(proto.Message): r"""Progress metric is (string, int|float|string) pair. - Attributes: name (str): Required. Metric name, e.g., "nodes total", @@ -2114,26 +1926,19 @@ class Metric(proto.Message): visual progress, etc.). """ - name = proto.Field(proto.STRING, number=1) - - int_value = proto.Field(proto.INT64, number=2, oneof="value") - - double_value = proto.Field(proto.DOUBLE, number=3, oneof="value") - - string_value = proto.Field(proto.STRING, number=4, oneof="value") - - name = proto.Field(proto.STRING, number=1) + name = proto.Field(proto.STRING, number=1,) + int_value = proto.Field(proto.INT64, number=2, oneof="value",) + double_value = proto.Field(proto.DOUBLE, number=3, oneof="value",) + string_value = proto.Field(proto.STRING, number=4, oneof="value",) + name = proto.Field(proto.STRING, number=1,) status = proto.Field(proto.ENUM, number=2, enum="Operation.Status",) - metrics = proto.RepeatedField(proto.MESSAGE, number=3, message=Metric,) - stages = proto.RepeatedField(proto.MESSAGE, number=4, message="OperationProgress",) class CreateClusterRequest(proto.Message): r"""CreateClusterRequest creates a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2154,18 +1959,14 @@ class CreateClusterRequest(proto.Message): created. Specified in the format ``projects/*/locations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) cluster = proto.Field(proto.MESSAGE, number=3, message="Cluster",) - - parent = proto.Field(proto.STRING, number=5) + parent = proto.Field(proto.STRING, number=5,) class GetClusterRequest(proto.Message): r"""GetClusterRequest gets the settings of a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2188,18 +1989,14 @@ class GetClusterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=5,) class UpdateClusterRequest(proto.Message): r"""UpdateClusterRequest updates the settings of a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2224,20 +2021,15 @@ class UpdateClusterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) update = proto.Field(proto.MESSAGE, number=4, message="ClusterUpdate",) - - name = proto.Field(proto.STRING, number=5) + name = proto.Field(proto.STRING, number=5,) class UpdateNodePoolRequest(proto.Message): r"""SetNodePoolVersionRequest updates the version of a node pool. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2299,34 +2091,23 @@ class UpdateNodePoolRequest(proto.Message): Node kubelet configs. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - node_version = proto.Field(proto.STRING, number=5) - - image_type = proto.Field(proto.STRING, number=6) - - locations = proto.RepeatedField(proto.STRING, number=13) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + node_version = proto.Field(proto.STRING, number=5,) + image_type = proto.Field(proto.STRING, number=6,) + locations = proto.RepeatedField(proto.STRING, number=13,) workload_metadata_config = proto.Field( proto.MESSAGE, number=14, message="WorkloadMetadataConfig", ) - - name = proto.Field(proto.STRING, number=8) - + name = proto.Field(proto.STRING, number=8,) upgrade_settings = proto.Field( proto.MESSAGE, number=15, message="NodePool.UpgradeSettings", ) - linux_node_config = proto.Field( proto.MESSAGE, number=19, message="LinuxNodeConfig", ) - kubelet_config = proto.Field(proto.MESSAGE, number=20, message="NodeKubeletConfig",) @@ -2363,17 +2144,12 @@ class SetNodePoolAutoscalingRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) autoscaling = proto.Field(proto.MESSAGE, number=5, message="NodePoolAutoscaling",) - - name = proto.Field(proto.STRING, number=6) + name = proto.Field(proto.STRING, number=6,) class SetLoggingServiceRequest(proto.Message): @@ -2416,15 +2192,11 @@ class SetLoggingServiceRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - logging_service = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + logging_service = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=5,) class SetMonitoringServiceRequest(proto.Message): @@ -2468,20 +2240,15 @@ class SetMonitoringServiceRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - monitoring_service = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + monitoring_service = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class SetAddonsConfigRequest(proto.Message): r"""SetAddonsRequest sets the addons associated with the cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2507,20 +2274,15 @@ class SetAddonsConfigRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) addons_config = proto.Field(proto.MESSAGE, number=4, message="AddonsConfig",) - - name = proto.Field(proto.STRING, number=6) + name = proto.Field(proto.STRING, number=6,) class SetLocationsRequest(proto.Message): r"""SetLocationsRequest sets the locations of the cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2552,20 +2314,15 @@ class SetLocationsRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - locations = proto.RepeatedField(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + locations = proto.RepeatedField(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class UpdateMasterRequest(proto.Message): r"""UpdateMasterRequest updates the master of the cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2601,20 +2358,15 @@ class UpdateMasterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - master_version = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + master_version = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=7,) class SetMasterAuthRequest(proto.Message): r"""SetMasterAuthRequest updates the admin password of a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2649,22 +2401,16 @@ class Action(proto.Enum): GENERATE_PASSWORD = 2 SET_USERNAME = 3 - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) action = proto.Field(proto.ENUM, number=4, enum=Action,) - update = proto.Field(proto.MESSAGE, number=5, message="MasterAuth",) - - name = proto.Field(proto.STRING, number=7) + name = proto.Field(proto.STRING, number=7,) class DeleteClusterRequest(proto.Message): r"""DeleteClusterRequest deletes a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2687,18 +2433,14 @@ class DeleteClusterRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=4,) class ListClustersRequest(proto.Message): r"""ListClustersRequest lists clusters. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2717,16 +2459,13 @@ class ListClustersRequest(proto.Message): Location "-" matches all zones and all regions. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - parent = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + parent = proto.Field(proto.STRING, number=4,) class ListClustersResponse(proto.Message): r"""ListClustersResponse is the result of ListClustersRequest. - Attributes: clusters (Sequence[google.cloud.container_v1beta1.types.Cluster]): A list of clusters in the project in the @@ -2737,13 +2476,11 @@ class ListClustersResponse(proto.Message): """ clusters = proto.RepeatedField(proto.MESSAGE, number=1, message="Cluster",) - - missing_zones = proto.RepeatedField(proto.STRING, number=2) + missing_zones = proto.RepeatedField(proto.STRING, number=2,) class GetOperationRequest(proto.Message): r"""GetOperationRequest gets a single operation. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2766,18 +2503,14 @@ class GetOperationRequest(proto.Message): ``projects/*/locations/*/operations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - operation_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + operation_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=5,) class ListOperationsRequest(proto.Message): r"""ListOperationsRequest lists operations. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2797,16 +2530,13 @@ class ListOperationsRequest(proto.Message): and all regions. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - parent = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + parent = proto.Field(proto.STRING, number=4,) class CancelOperationRequest(proto.Message): r"""CancelOperationRequest cancels a single operation. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2829,13 +2559,10 @@ class CancelOperationRequest(proto.Message): ``projects/*/locations/*/operations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - operation_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + operation_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=4,) class ListOperationsResponse(proto.Message): @@ -2853,13 +2580,11 @@ class ListOperationsResponse(proto.Message): """ operations = proto.RepeatedField(proto.MESSAGE, number=1, message="Operation",) - - missing_zones = proto.RepeatedField(proto.STRING, number=2) + missing_zones = proto.RepeatedField(proto.STRING, number=2,) class GetServerConfigRequest(proto.Message): r"""Gets the current Kubernetes Engine service configuration. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2877,16 +2602,13 @@ class GetServerConfigRequest(proto.Message): specified in the format ``projects/*/locations/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - name = proto.Field(proto.STRING, number=4) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + name = proto.Field(proto.STRING, number=4,) class ServerConfig(proto.Message): r"""Kubernetes Engine service configuration. - Attributes: default_cluster_version (str): Version of Kubernetes the service deploys by @@ -2925,7 +2647,6 @@ class ReleaseChannelConfig(proto.Message): class AvailableVersion(proto.Message): r"""Deprecated. - Attributes: version (str): Kubernetes version. @@ -2933,32 +2654,23 @@ class AvailableVersion(proto.Message): Reason for availability. """ - version = proto.Field(proto.STRING, number=1) - - reason = proto.Field(proto.STRING, number=2) + version = proto.Field(proto.STRING, number=1,) + reason = proto.Field(proto.STRING, number=2,) channel = proto.Field(proto.ENUM, number=1, enum="ReleaseChannel.Channel",) - - default_version = proto.Field(proto.STRING, number=2) - + default_version = proto.Field(proto.STRING, number=2,) available_versions = proto.RepeatedField( proto.MESSAGE, number=3, message="ServerConfig.ReleaseChannelConfig.AvailableVersion", ) + valid_versions = proto.RepeatedField(proto.STRING, number=4,) - valid_versions = proto.RepeatedField(proto.STRING, number=4) - - default_cluster_version = proto.Field(proto.STRING, number=1) - - valid_node_versions = proto.RepeatedField(proto.STRING, number=3) - - default_image_type = proto.Field(proto.STRING, number=4) - - valid_image_types = proto.RepeatedField(proto.STRING, number=5) - - valid_master_versions = proto.RepeatedField(proto.STRING, number=6) - + default_cluster_version = proto.Field(proto.STRING, number=1,) + valid_node_versions = proto.RepeatedField(proto.STRING, number=3,) + default_image_type = proto.Field(proto.STRING, number=4,) + valid_image_types = proto.RepeatedField(proto.STRING, number=5,) + valid_master_versions = proto.RepeatedField(proto.STRING, number=6,) channels = proto.RepeatedField( proto.MESSAGE, number=9, message=ReleaseChannelConfig, ) @@ -2966,7 +2678,6 @@ class AvailableVersion(proto.Message): class CreateNodePoolRequest(proto.Message): r"""CreateNodePoolRequest creates a node pool for a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -2991,20 +2702,15 @@ class CreateNodePoolRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) node_pool = proto.Field(proto.MESSAGE, number=4, message="NodePool",) - - parent = proto.Field(proto.STRING, number=6) + parent = proto.Field(proto.STRING, number=6,) class DeleteNodePoolRequest(proto.Message): r"""DeleteNodePoolRequest deletes a node pool for a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -3031,20 +2737,15 @@ class DeleteNodePoolRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class ListNodePoolsRequest(proto.Message): r"""ListNodePoolsRequest lists the node pool(s) for a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -3067,18 +2768,14 @@ class ListNodePoolsRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - parent = proto.Field(proto.STRING, number=5) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field(proto.STRING, number=5,) class GetNodePoolRequest(proto.Message): r"""GetNodePoolRequest retrieves a node pool for a cluster. - Attributes: project_id (str): Required. Deprecated. The Google Developers Console `project @@ -3105,15 +2802,11 @@ class GetNodePoolRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class NodePool(proto.Message): @@ -3231,42 +2924,27 @@ class UpgradeSettings(proto.Message): status is Ready. """ - max_surge = proto.Field(proto.INT32, number=1) - - max_unavailable = proto.Field(proto.INT32, number=2) - - name = proto.Field(proto.STRING, number=1) + max_surge = proto.Field(proto.INT32, number=1,) + max_unavailable = proto.Field(proto.INT32, number=2,) + name = proto.Field(proto.STRING, number=1,) config = proto.Field(proto.MESSAGE, number=2, message="NodeConfig",) - - initial_node_count = proto.Field(proto.INT32, number=3) - - locations = proto.RepeatedField(proto.STRING, number=13) - - self_link = proto.Field(proto.STRING, number=100) - - version = proto.Field(proto.STRING, number=101) - - instance_group_urls = proto.RepeatedField(proto.STRING, number=102) - + initial_node_count = proto.Field(proto.INT32, number=3,) + locations = proto.RepeatedField(proto.STRING, number=13,) + self_link = proto.Field(proto.STRING, number=100,) + version = proto.Field(proto.STRING, number=101,) + instance_group_urls = proto.RepeatedField(proto.STRING, number=102,) status = proto.Field(proto.ENUM, number=103, enum=Status,) - - status_message = proto.Field(proto.STRING, number=104) - + status_message = proto.Field(proto.STRING, number=104,) autoscaling = proto.Field(proto.MESSAGE, number=4, message="NodePoolAutoscaling",) - management = proto.Field(proto.MESSAGE, number=5, message="NodeManagement",) - max_pods_constraint = proto.Field( proto.MESSAGE, number=6, message="MaxPodsConstraint", ) - conditions = proto.RepeatedField( proto.MESSAGE, number=105, message="StatusCondition", ) - - pod_ipv4_cidr_size = proto.Field(proto.INT32, number=7) - + pod_ipv4_cidr_size = proto.Field(proto.INT32, number=7,) upgrade_settings = proto.Field(proto.MESSAGE, number=107, message=UpgradeSettings,) @@ -3286,10 +2964,8 @@ class NodeManagement(proto.Message): pool. """ - auto_upgrade = proto.Field(proto.BOOL, number=1) - - auto_repair = proto.Field(proto.BOOL, number=2) - + auto_upgrade = proto.Field(proto.BOOL, number=1,) + auto_repair = proto.Field(proto.BOOL, number=2,) upgrade_options = proto.Field( proto.MESSAGE, number=10, message="AutoUpgradeOptions", ) @@ -3310,9 +2986,8 @@ class AutoUpgradeOptions(proto.Message): commence with the description of the upgrade. """ - auto_upgrade_start_time = proto.Field(proto.STRING, number=1) - - description = proto.Field(proto.STRING, number=2) + auto_upgrade_start_time = proto.Field(proto.STRING, number=1,) + description = proto.Field(proto.STRING, number=2,) class MaintenancePolicy(proto.Message): @@ -3334,8 +3009,7 @@ class MaintenancePolicy(proto.Message): """ window = proto.Field(proto.MESSAGE, number=1, message="MaintenanceWindow",) - - resource_version = proto.Field(proto.STRING, number=3) + resource_version = proto.Field(proto.STRING, number=3,) class MaintenanceWindow(proto.Message): @@ -3361,11 +3035,9 @@ class MaintenanceWindow(proto.Message): daily_maintenance_window = proto.Field( proto.MESSAGE, number=2, oneof="policy", message="DailyMaintenanceWindow", ) - recurring_window = proto.Field( proto.MESSAGE, number=3, oneof="policy", message="RecurringTimeWindow", ) - maintenance_exclusions = proto.MapField( proto.STRING, proto.MESSAGE, number=4, message="TimeWindow", ) @@ -3373,7 +3045,6 @@ class MaintenanceWindow(proto.Message): class TimeWindow(proto.Message): r"""Represents an arbitrary window of time. - Attributes: start_time (google.protobuf.timestamp_pb2.Timestamp): The time that the window first starts. @@ -3382,14 +3053,12 @@ class TimeWindow(proto.Message): should take place after the start time. """ - start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) - - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) + start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) + end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) class RecurringTimeWindow(proto.Message): r"""Represents an arbitrary window of time that recurs. - Attributes: window (google.cloud.container_v1beta1.types.TimeWindow): The window of the first recurrence. @@ -3435,13 +3104,11 @@ class RecurringTimeWindow(proto.Message): """ window = proto.Field(proto.MESSAGE, number=1, message="TimeWindow",) - - recurrence = proto.Field(proto.STRING, number=2) + recurrence = proto.Field(proto.STRING, number=2,) class DailyMaintenanceWindow(proto.Message): r"""Time window specified for daily maintenance operations. - Attributes: start_time (str): Time within the maintenance window to start the maintenance @@ -3452,9 +3119,8 @@ class DailyMaintenanceWindow(proto.Message): chosen to be smallest possible in the given scenario. """ - start_time = proto.Field(proto.STRING, number=2) - - duration = proto.Field(proto.STRING, number=3) + start_time = proto.Field(proto.STRING, number=2,) + duration = proto.Field(proto.STRING, number=3,) class SetNodePoolManagementRequest(proto.Message): @@ -3490,17 +3156,12 @@ class SetNodePoolManagementRequest(proto.Message): format ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) management = proto.Field(proto.MESSAGE, number=5, message="NodeManagement",) - - name = proto.Field(proto.STRING, number=7) + name = proto.Field(proto.STRING, number=7,) class SetNodePoolSizeRequest(proto.Message): @@ -3536,17 +3197,12 @@ class SetNodePoolSizeRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - node_count = proto.Field(proto.INT32, number=5) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + node_count = proto.Field(proto.INT32, number=5,) + name = proto.Field(proto.STRING, number=7,) class RollbackNodePoolUpgradeRequest(proto.Message): @@ -3580,20 +3236,15 @@ class RollbackNodePoolUpgradeRequest(proto.Message): ``projects/*/locations/*/clusters/*/nodePools/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - node_pool_id = proto.Field(proto.STRING, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + node_pool_id = proto.Field(proto.STRING, number=4,) + name = proto.Field(proto.STRING, number=6,) class ListNodePoolsResponse(proto.Message): r"""ListNodePoolsResponse is the result of ListNodePoolsRequest. - Attributes: node_pools (Sequence[google.cloud.container_v1beta1.types.NodePool]): A list of node pools for a cluster. @@ -3632,19 +3283,15 @@ class AutoscalingProfile(proto.Enum): OPTIMIZE_UTILIZATION = 1 BALANCED = 2 - enable_node_autoprovisioning = proto.Field(proto.BOOL, number=1) - + enable_node_autoprovisioning = proto.Field(proto.BOOL, number=1,) resource_limits = proto.RepeatedField( proto.MESSAGE, number=2, message="ResourceLimit", ) - autoscaling_profile = proto.Field(proto.ENUM, number=3, enum=AutoscalingProfile,) - autoprovisioning_node_pool_defaults = proto.Field( proto.MESSAGE, number=4, message="AutoprovisioningNodePoolDefaults", ) - - autoprovisioning_locations = proto.RepeatedField(proto.STRING, number=5) + autoprovisioning_locations = proto.RepeatedField(proto.STRING, number=5,) class AutoprovisioningNodePoolDefaults(proto.Message): @@ -3714,27 +3361,19 @@ class AutoprovisioningNodePoolDefaults(proto.Message): https://cloud.google.com/compute/docs/disks/customer-managed-encryption """ - oauth_scopes = proto.RepeatedField(proto.STRING, number=1) - - service_account = proto.Field(proto.STRING, number=2) - + oauth_scopes = proto.RepeatedField(proto.STRING, number=1,) + service_account = proto.Field(proto.STRING, number=2,) upgrade_settings = proto.Field( proto.MESSAGE, number=3, message="NodePool.UpgradeSettings", ) - management = proto.Field(proto.MESSAGE, number=4, message="NodeManagement",) - - min_cpu_platform = proto.Field(proto.STRING, number=5) - - disk_size_gb = proto.Field(proto.INT32, number=6) - - disk_type = proto.Field(proto.STRING, number=7) - + min_cpu_platform = proto.Field(proto.STRING, number=5,) + disk_size_gb = proto.Field(proto.INT32, number=6,) + disk_type = proto.Field(proto.STRING, number=7,) shielded_instance_config = proto.Field( proto.MESSAGE, number=8, message="ShieldedInstanceConfig", ) - - boot_disk_kms_key = proto.Field(proto.STRING, number=9) + boot_disk_kms_key = proto.Field(proto.STRING, number=9,) class ResourceLimit(proto.Message): @@ -3753,11 +3392,9 @@ class ResourceLimit(proto.Message): cluster. """ - resource_type = proto.Field(proto.STRING, number=1) - - minimum = proto.Field(proto.INT64, number=2) - - maximum = proto.Field(proto.INT64, number=3) + resource_type = proto.Field(proto.STRING, number=1,) + minimum = proto.Field(proto.INT64, number=2,) + maximum = proto.Field(proto.INT64, number=3,) class NodePoolAutoscaling(proto.Message): @@ -3779,13 +3416,10 @@ class NodePoolAutoscaling(proto.Message): Can this node pool be deleted automatically. """ - enabled = proto.Field(proto.BOOL, number=1) - - min_node_count = proto.Field(proto.INT32, number=2) - - max_node_count = proto.Field(proto.INT32, number=3) - - autoprovisioned = proto.Field(proto.BOOL, number=4) + enabled = proto.Field(proto.BOOL, number=1,) + min_node_count = proto.Field(proto.INT32, number=2,) + max_node_count = proto.Field(proto.INT32, number=3,) + autoprovisioned = proto.Field(proto.BOOL, number=4,) class SetLabelsRequest(proto.Message): @@ -3825,17 +3459,12 @@ class SetLabelsRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - resource_labels = proto.MapField(proto.STRING, proto.STRING, number=4) - - label_fingerprint = proto.Field(proto.STRING, number=5) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + resource_labels = proto.MapField(proto.STRING, proto.STRING, number=4,) + label_fingerprint = proto.Field(proto.STRING, number=5,) + name = proto.Field(proto.STRING, number=7,) class SetLegacyAbacRequest(proto.Message): @@ -3867,15 +3496,11 @@ class SetLegacyAbacRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - enabled = proto.Field(proto.BOOL, number=4) - - name = proto.Field(proto.STRING, number=6) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + enabled = proto.Field(proto.BOOL, number=4,) + name = proto.Field(proto.STRING, number=6,) class StartIPRotationRequest(proto.Message): @@ -3908,15 +3533,11 @@ class StartIPRotationRequest(proto.Message): rotation. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=6) - - rotate_credentials = proto.Field(proto.BOOL, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=6,) + rotate_credentials = proto.Field(proto.BOOL, number=7,) class CompleteIPRotationRequest(proto.Message): @@ -3945,18 +3566,14 @@ class CompleteIPRotationRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - - name = proto.Field(proto.STRING, number=7) + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) + name = proto.Field(proto.STRING, number=7,) class AcceleratorConfig(proto.Message): r"""AcceleratorConfig represents a Hardware Accelerator request. - Attributes: accelerator_count (int): The number of the accelerator cards exposed @@ -3967,9 +3584,8 @@ class AcceleratorConfig(proto.Message): `here `__ """ - accelerator_count = proto.Field(proto.INT64, number=1) - - accelerator_type = proto.Field(proto.STRING, number=2) + accelerator_count = proto.Field(proto.INT64, number=1,) + accelerator_type = proto.Field(proto.STRING, number=2,) class WorkloadMetadataConfig(proto.Message): @@ -4004,7 +3620,6 @@ class Mode(proto.Enum): GKE_METADATA = 2 node_metadata = proto.Field(proto.ENUM, number=1, enum=NodeMetadata,) - mode = proto.Field(proto.ENUM, number=2, enum=Mode,) @@ -4037,15 +3652,11 @@ class SetNetworkPolicyRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) network_policy = proto.Field(proto.MESSAGE, number=4, message="NetworkPolicy",) - - name = proto.Field(proto.STRING, number=6) + name = proto.Field(proto.STRING, number=6,) class SetMaintenancePolicyRequest(proto.Message): @@ -4073,17 +3684,13 @@ class SetMaintenancePolicyRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - project_id = proto.Field(proto.STRING, number=1) - - zone = proto.Field(proto.STRING, number=2) - - cluster_id = proto.Field(proto.STRING, number=3) - + project_id = proto.Field(proto.STRING, number=1,) + zone = proto.Field(proto.STRING, number=2,) + cluster_id = proto.Field(proto.STRING, number=3,) maintenance_policy = proto.Field( proto.MESSAGE, number=4, message="MaintenancePolicy", ) - - name = proto.Field(proto.STRING, number=5) + name = proto.Field(proto.STRING, number=5,) class ListLocationsRequest(proto.Message): @@ -4096,7 +3703,7 @@ class ListLocationsRequest(proto.Message): Specified in the format ``projects/*``. """ - parent = proto.Field(proto.STRING, number=1) + parent = proto.Field(proto.STRING, number=1,) class ListLocationsResponse(proto.Message): @@ -4119,8 +3726,7 @@ def raw_page(self): return self locations = proto.RepeatedField(proto.MESSAGE, number=1, message="Location",) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = proto.Field(proto.STRING, number=2,) class Location(proto.Message): @@ -4146,10 +3752,8 @@ class LocationType(proto.Enum): REGION = 2 type_ = proto.Field(proto.ENUM, number=1, enum=LocationType,) - - name = proto.Field(proto.STRING, number=2) - - recommended = proto.Field(proto.BOOL, number=3) + name = proto.Field(proto.STRING, number=2,) + recommended = proto.Field(proto.BOOL, number=3,) class StatusCondition(proto.Message): @@ -4177,10 +3781,8 @@ class Code(proto.Enum): CLOUD_KMS_KEY_ERROR = 7 code = proto.Field(proto.ENUM, number=1, enum=Code,) - - message = proto.Field(proto.STRING, number=2) - - canonical_code = proto.Field(proto.ENUM, number=3, enum=gr_code.Code,) + message = proto.Field(proto.STRING, number=2,) + canonical_code = proto.Field(proto.ENUM, number=3, enum=code_pb2.Code,) class NetworkConfig(proto.Message): @@ -4214,16 +3816,12 @@ class NetworkConfig(proto.Message): kube-proxy implementation. """ - network = proto.Field(proto.STRING, number=1) - - subnetwork = proto.Field(proto.STRING, number=2) - - enable_intra_node_visibility = proto.Field(proto.BOOL, number=5) - + network = proto.Field(proto.STRING, number=1,) + subnetwork = proto.Field(proto.STRING, number=2,) + enable_intra_node_visibility = proto.Field(proto.BOOL, number=5,) default_snat_status = proto.Field( proto.MESSAGE, number=7, message="DefaultSnatStatus", ) - datapath_provider = proto.Field(proto.ENUM, number=11, enum="DatapathProvider",) @@ -4254,13 +3852,10 @@ class ListUsableSubnetworksRequest(proto.Message): requests to get the next page of results. """ - parent = proto.Field(proto.STRING, number=1) - - filter = proto.Field(proto.STRING, number=2) - - page_size = proto.Field(proto.INT32, number=3) - - page_token = proto.Field(proto.STRING, number=4) + parent = proto.Field(proto.STRING, number=1,) + filter = proto.Field(proto.STRING, number=2,) + page_size = proto.Field(proto.INT32, number=3,) + page_token = proto.Field(proto.STRING, number=4,) class ListUsableSubnetworksResponse(proto.Message): @@ -4286,13 +3881,11 @@ def raw_page(self): subnetworks = proto.RepeatedField( proto.MESSAGE, number=1, message="UsableSubnetwork", ) - - next_page_token = proto.Field(proto.STRING, number=2) + next_page_token = proto.Field(proto.STRING, number=2,) class UsableSubnetworkSecondaryRange(proto.Message): r"""Secondary IP range of a usable subnetwork. - Attributes: range_name (str): The name associated with this subnetwork @@ -4314,10 +3907,8 @@ class Status(proto.Enum): IN_USE_SHAREABLE_POD = 3 IN_USE_MANAGED_POD = 4 - range_name = proto.Field(proto.STRING, number=1) - - ip_cidr_range = proto.Field(proto.STRING, number=2) - + range_name = proto.Field(proto.STRING, number=1,) + ip_cidr_range = proto.Field(proto.STRING, number=2,) status = proto.Field(proto.ENUM, number=3, enum=Status,) @@ -4347,17 +3938,13 @@ class UsableSubnetwork(proto.Message): message will be given by status_message. """ - subnetwork = proto.Field(proto.STRING, number=1) - - network = proto.Field(proto.STRING, number=2) - - ip_cidr_range = proto.Field(proto.STRING, number=3) - + subnetwork = proto.Field(proto.STRING, number=1,) + network = proto.Field(proto.STRING, number=2,) + ip_cidr_range = proto.Field(proto.STRING, number=3,) secondary_ip_ranges = proto.RepeatedField( proto.MESSAGE, number=4, message="UsableSubnetworkSecondaryRange", ) - - status_message = proto.Field(proto.STRING, number=5) + status_message = proto.Field(proto.STRING, number=5,) class VerticalPodAutoscaling(proto.Message): @@ -4370,7 +3957,7 @@ class VerticalPodAutoscaling(proto.Message): Enables vertical pod autoscaling. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class DefaultSnatStatus(proto.Message): @@ -4382,7 +3969,7 @@ class DefaultSnatStatus(proto.Message): Disables cluster default sNAT rules. """ - disabled = proto.Field(proto.BOOL, number=1) + disabled = proto.Field(proto.BOOL, number=1,) class IntraNodeVisibilityConfig(proto.Message): @@ -4395,19 +3982,18 @@ class IntraNodeVisibilityConfig(proto.Message): cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class MaxPodsConstraint(proto.Message): r"""Constraints applied to pods. - Attributes: max_pods_per_node (int): Constraint enforced on the max num of pods per node. """ - max_pods_per_node = proto.Field(proto.INT64, number=1) + max_pods_per_node = proto.Field(proto.INT64, number=1,) class WorkloadIdentityConfig(proto.Message): @@ -4426,16 +4012,13 @@ class WorkloadIdentityConfig(proto.Message): provider. """ - identity_namespace = proto.Field(proto.STRING, number=1) - - workload_pool = proto.Field(proto.STRING, number=2) - - identity_provider = proto.Field(proto.STRING, number=3) + identity_namespace = proto.Field(proto.STRING, number=1,) + workload_pool = proto.Field(proto.STRING, number=2,) + identity_provider = proto.Field(proto.STRING, number=3,) class DatabaseEncryption(proto.Message): r"""Configuration of etcd encryption. - Attributes: state (google.cloud.container_v1beta1.types.DatabaseEncryption.State): Denotes the state of etcd encryption. @@ -4453,13 +4036,11 @@ class State(proto.Enum): DECRYPTED = 2 state = proto.Field(proto.ENUM, number=2, enum=State,) - - key_name = proto.Field(proto.STRING, number=1) + key_name = proto.Field(proto.STRING, number=1,) class ResourceUsageExportConfig(proto.Message): r"""Configuration for exporting cluster resource usages. - Attributes: bigquery_destination (google.cloud.container_v1beta1.types.ResourceUsageExportConfig.BigQueryDestination): Configuration to use BigQuery as usage export @@ -4483,11 +4064,10 @@ class BigQueryDestination(proto.Message): The ID of a BigQuery Dataset. """ - dataset_id = proto.Field(proto.STRING, number=1) + dataset_id = proto.Field(proto.STRING, number=1,) class ConsumptionMeteringConfig(proto.Message): r"""Parameters for controlling consumption metering. - Attributes: enabled (bool): Whether to enable consumption metering for @@ -4496,14 +4076,12 @@ class ConsumptionMeteringConfig(proto.Message): consumption records. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) bigquery_destination = proto.Field( proto.MESSAGE, number=1, message=BigQueryDestination, ) - - enable_network_egress_metering = proto.Field(proto.BOOL, number=2) - + enable_network_egress_metering = proto.Field(proto.BOOL, number=2,) consumption_metering_config = proto.Field( proto.MESSAGE, number=3, message=ConsumptionMeteringConfig, ) @@ -4511,14 +4089,13 @@ class ConsumptionMeteringConfig(proto.Message): class ShieldedNodes(proto.Message): r"""Configuration of Shielded Nodes feature. - Attributes: enabled (bool): Whether Shielded Nodes features are enabled on all nodes in this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class GetOpenIDConfigRequest(proto.Message): @@ -4533,7 +4110,7 @@ class GetOpenIDConfigRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - parent = proto.Field(proto.STRING, number=1) + parent = proto.Field(proto.STRING, number=1,) class GetOpenIDConfigResponse(proto.Message): @@ -4558,19 +4135,13 @@ class GetOpenIDConfigResponse(proto.Message): Supported grant types. """ - issuer = proto.Field(proto.STRING, number=1) - - jwks_uri = proto.Field(proto.STRING, number=2) - - response_types_supported = proto.RepeatedField(proto.STRING, number=3) - - subject_types_supported = proto.RepeatedField(proto.STRING, number=4) - - id_token_signing_alg_values_supported = proto.RepeatedField(proto.STRING, number=5) - - claims_supported = proto.RepeatedField(proto.STRING, number=6) - - grant_types = proto.RepeatedField(proto.STRING, number=7) + issuer = proto.Field(proto.STRING, number=1,) + jwks_uri = proto.Field(proto.STRING, number=2,) + response_types_supported = proto.RepeatedField(proto.STRING, number=3,) + subject_types_supported = proto.RepeatedField(proto.STRING, number=4,) + id_token_signing_alg_values_supported = proto.RepeatedField(proto.STRING, number=5,) + claims_supported = proto.RepeatedField(proto.STRING, number=6,) + grant_types = proto.RepeatedField(proto.STRING, number=7,) class GetJSONWebKeysRequest(proto.Message): @@ -4586,12 +4157,11 @@ class GetJSONWebKeysRequest(proto.Message): ``projects/*/locations/*/clusters/*``. """ - parent = proto.Field(proto.STRING, number=1) + parent = proto.Field(proto.STRING, number=1,) class Jwk(proto.Message): r"""Jwk is a JSON Web Key as specified in RFC 7517 - Attributes: kty (str): Key Type. @@ -4613,23 +4183,15 @@ class Jwk(proto.Message): Used for ECDSA keys. """ - kty = proto.Field(proto.STRING, number=1) - - alg = proto.Field(proto.STRING, number=2) - - use = proto.Field(proto.STRING, number=3) - - kid = proto.Field(proto.STRING, number=4) - - n = proto.Field(proto.STRING, number=5) - - e = proto.Field(proto.STRING, number=6) - - x = proto.Field(proto.STRING, number=7) - - y = proto.Field(proto.STRING, number=8) - - crv = proto.Field(proto.STRING, number=9) + kty = proto.Field(proto.STRING, number=1,) + alg = proto.Field(proto.STRING, number=2,) + use = proto.Field(proto.STRING, number=3,) + kid = proto.Field(proto.STRING, number=4,) + n = proto.Field(proto.STRING, number=5,) + e = proto.Field(proto.STRING, number=6,) + x = proto.Field(proto.STRING, number=7,) + y = proto.Field(proto.STRING, number=8,) + crv = proto.Field(proto.STRING, number=9,) class GetJSONWebKeysResponse(proto.Message): @@ -4670,7 +4232,6 @@ class Channel(proto.Enum): class TpuConfig(proto.Message): r"""Configuration for Cloud TPU. - Attributes: enabled (bool): Whether Cloud TPU integration is enabled or @@ -4683,20 +4244,17 @@ class TpuConfig(proto.Message): VPC. """ - enabled = proto.Field(proto.BOOL, number=1) - - use_service_networking = proto.Field(proto.BOOL, number=2) - - ipv4_cidr_block = proto.Field(proto.STRING, number=3) + enabled = proto.Field(proto.BOOL, number=1,) + use_service_networking = proto.Field(proto.BOOL, number=2,) + ipv4_cidr_block = proto.Field(proto.STRING, number=3,) class Master(proto.Message): - r"""Master is the configuration for components on master.""" + r"""Master is the configuration for components on master. """ class NotificationConfig(proto.Message): r"""NotificationConfig is the configuration of notifications. - Attributes: pubsub (google.cloud.container_v1beta1.types.NotificationConfig.PubSub): Notification config for Pub/Sub. @@ -4704,7 +4262,6 @@ class NotificationConfig(proto.Message): class PubSub(proto.Message): r"""Pub/Sub specific notification config. - Attributes: enabled (bool): Enable notifications for Pub/Sub. @@ -4714,9 +4271,8 @@ class PubSub(proto.Message): ``projects/{project}/topics/{topic}``. """ - enabled = proto.Field(proto.BOOL, number=1) - - topic = proto.Field(proto.STRING, number=2) + enabled = proto.Field(proto.BOOL, number=1,) + topic = proto.Field(proto.STRING, number=2,) pubsub = proto.Field(proto.MESSAGE, number=1, message=PubSub,) @@ -4731,7 +4287,7 @@ class ConfidentialNodes(proto.Message): for all nodes in this cluster. """ - enabled = proto.Field(proto.BOOL, number=1) + enabled = proto.Field(proto.BOOL, number=1,) class UpgradeEvent(proto.Message): @@ -4760,18 +4316,13 @@ class UpgradeEvent(proto.Message): """ resource_type = proto.Field(proto.ENUM, number=1, enum="UpgradeResourceType",) - - operation = proto.Field(proto.STRING, number=2) - + operation = proto.Field(proto.STRING, number=2,) operation_start_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp.Timestamp, + proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - - current_version = proto.Field(proto.STRING, number=4) - - target_version = proto.Field(proto.STRING, number=5) - - resource = proto.Field(proto.STRING, number=6) + current_version = proto.Field(proto.STRING, number=4,) + target_version = proto.Field(proto.STRING, number=5,) + resource = proto.Field(proto.STRING, number=6,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/scripts/fixup_container_v1_keywords.py b/scripts/fixup_container_v1_keywords.py index 25973d5e..308cef05 100644 --- a/scripts/fixup_container_v1_keywords.py +++ b/scripts/fixup_container_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,39 +39,38 @@ def partition( class containerCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), - 'create_cluster': ('cluster', 'project_id', 'zone', 'parent', ), - 'create_node_pool': ('node_pool', 'project_id', 'zone', 'cluster_id', 'parent', ), - 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'get_json_web_keys': ('parent', ), - 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'get_server_config': ('project_id', 'zone', 'name', ), - 'list_clusters': ('project_id', 'zone', 'parent', ), - 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), - 'list_operations': ('project_id', 'zone', 'parent', ), - 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), - 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'set_addons_config': ('addons_config', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_labels': ('resource_labels', 'label_fingerprint', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_legacy_abac': ('enabled', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_locations': ('locations', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_logging_service': ('logging_service', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), - 'set_master_auth': ('action', 'update', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_monitoring_service': ('monitoring_service', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_network_policy': ('network_policy', 'project_id', 'zone', 'cluster_id', 'name', ), - 'set_node_pool_autoscaling': ('autoscaling', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'set_node_pool_management': ('management', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'set_node_pool_size': ('node_count', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), - 'update_cluster': ('update', 'project_id', 'zone', 'cluster_id', 'name', ), - 'update_master': ('master_version', 'project_id', 'zone', 'cluster_id', 'name', ), - 'update_node_pool': ('node_version', 'image_type', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'locations', 'workload_metadata_config', 'upgrade_settings', ), - + 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), + 'create_cluster': ('cluster', 'project_id', 'zone', 'parent', ), + 'create_node_pool': ('node_pool', 'project_id', 'zone', 'cluster_id', 'parent', ), + 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'get_json_web_keys': ('parent', ), + 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'get_server_config': ('project_id', 'zone', 'name', ), + 'list_clusters': ('project_id', 'zone', 'parent', ), + 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), + 'list_operations': ('project_id', 'zone', 'parent', ), + 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), + 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'set_addons_config': ('addons_config', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_labels': ('resource_labels', 'label_fingerprint', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_legacy_abac': ('enabled', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_locations': ('locations', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_logging_service': ('logging_service', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), + 'set_master_auth': ('action', 'update', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_monitoring_service': ('monitoring_service', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_network_policy': ('network_policy', 'project_id', 'zone', 'cluster_id', 'name', ), + 'set_node_pool_autoscaling': ('autoscaling', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'set_node_pool_management': ('management', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'set_node_pool_size': ('node_count', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), + 'update_cluster': ('update', 'project_id', 'zone', 'cluster_id', 'name', ), + 'update_master': ('master_version', 'project_id', 'zone', 'cluster_id', 'name', ), + 'update_node_pool': ('node_version', 'image_type', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'locations', 'workload_metadata_config', 'upgrade_settings', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: @@ -104,7 +101,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/scripts/fixup_container_v1beta1_keywords.py b/scripts/fixup_container_v1beta1_keywords.py index 5865b51c..fcd6cd36 100644 --- a/scripts/fixup_container_v1beta1_keywords.py +++ b/scripts/fixup_container_v1beta1_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,40 +39,39 @@ def partition( class containerCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), - 'create_cluster': ('project_id', 'zone', 'cluster', 'parent', ), - 'create_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool', 'parent', ), - 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), - 'get_json_web_keys': ('parent', ), - 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), - 'get_server_config': ('project_id', 'zone', 'name', ), - 'list_clusters': ('project_id', 'zone', 'parent', ), - 'list_locations': ('parent', ), - 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), - 'list_operations': ('project_id', 'zone', 'parent', ), - 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), - 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), - 'set_addons_config': ('project_id', 'zone', 'cluster_id', 'addons_config', 'name', ), - 'set_labels': ('project_id', 'zone', 'cluster_id', 'resource_labels', 'label_fingerprint', 'name', ), - 'set_legacy_abac': ('project_id', 'zone', 'cluster_id', 'enabled', 'name', ), - 'set_locations': ('project_id', 'zone', 'cluster_id', 'locations', 'name', ), - 'set_logging_service': ('project_id', 'zone', 'cluster_id', 'logging_service', 'name', ), - 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), - 'set_master_auth': ('project_id', 'zone', 'cluster_id', 'action', 'update', 'name', ), - 'set_monitoring_service': ('project_id', 'zone', 'cluster_id', 'monitoring_service', 'name', ), - 'set_network_policy': ('project_id', 'zone', 'cluster_id', 'network_policy', 'name', ), - 'set_node_pool_autoscaling': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'autoscaling', 'name', ), - 'set_node_pool_management': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'management', 'name', ), - 'set_node_pool_size': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_count', 'name', ), - 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), - 'update_cluster': ('project_id', 'zone', 'cluster_id', 'update', 'name', ), - 'update_master': ('project_id', 'zone', 'cluster_id', 'master_version', 'name', ), - 'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'linux_node_config', 'kubelet_config', ), - + 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), + 'create_cluster': ('project_id', 'zone', 'cluster', 'parent', ), + 'create_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool', 'parent', ), + 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'delete_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), + 'get_json_web_keys': ('parent', ), + 'get_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'get_operation': ('project_id', 'zone', 'operation_id', 'name', ), + 'get_server_config': ('project_id', 'zone', 'name', ), + 'list_clusters': ('project_id', 'zone', 'parent', ), + 'list_locations': ('parent', ), + 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), + 'list_operations': ('project_id', 'zone', 'parent', ), + 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), + 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'set_addons_config': ('project_id', 'zone', 'cluster_id', 'addons_config', 'name', ), + 'set_labels': ('project_id', 'zone', 'cluster_id', 'resource_labels', 'label_fingerprint', 'name', ), + 'set_legacy_abac': ('project_id', 'zone', 'cluster_id', 'enabled', 'name', ), + 'set_locations': ('project_id', 'zone', 'cluster_id', 'locations', 'name', ), + 'set_logging_service': ('project_id', 'zone', 'cluster_id', 'logging_service', 'name', ), + 'set_maintenance_policy': ('project_id', 'zone', 'cluster_id', 'maintenance_policy', 'name', ), + 'set_master_auth': ('project_id', 'zone', 'cluster_id', 'action', 'update', 'name', ), + 'set_monitoring_service': ('project_id', 'zone', 'cluster_id', 'monitoring_service', 'name', ), + 'set_network_policy': ('project_id', 'zone', 'cluster_id', 'network_policy', 'name', ), + 'set_node_pool_autoscaling': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'autoscaling', 'name', ), + 'set_node_pool_management': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'management', 'name', ), + 'set_node_pool_size': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_count', 'name', ), + 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), + 'update_cluster': ('project_id', 'zone', 'cluster_id', 'update', 'name', ), + 'update_master': ('project_id', 'zone', 'cluster_id', 'master_version', 'name', ), + 'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'linux_node_config', 'kubelet_config', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: @@ -105,7 +102,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 00000000..4de65971 --- /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 00000000..4de65971 --- /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 00000000..4de65971 --- /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/container_v1/__init__.py b/tests/unit/gapic/container_v1/__init__.py index 42ffdf2b..4de65971 100644 --- a/tests/unit/gapic/container_v1/__init__.py +++ b/tests/unit/gapic/container_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/container_v1/test_cluster_manager.py b/tests/unit/gapic/container_v1/test_cluster_manager.py index c39da460..82b81b14 100644 --- a/tests/unit/gapic/container_v1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1/test_cluster_manager.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,51 @@ 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.container_v1.services.cluster_manager import ClusterManagerAsyncClient from google.cloud.container_v1.services.cluster_manager import ClusterManagerClient from google.cloud.container_v1.services.cluster_manager import pagers from google.cloud.container_v1.services.cluster_manager import transports +from google.cloud.container_v1.services.cluster_manager.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.container_v1.services.cluster_manager.transports.base import ( + _GOOGLE_AUTH_VERSION, +) from google.cloud.container_v1.types import cluster_service 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(): @@ -89,7 +118,7 @@ def test__get_default_mtls_endpoint(): "client_class", [ClusterManagerClient, ClusterManagerAsyncClient,] ) def test_cluster_manager_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: @@ -106,7 +135,7 @@ def test_cluster_manager_client_from_service_account_info(client_class): "client_class", [ClusterManagerClient, ClusterManagerAsyncClient,] ) def test_cluster_manager_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: @@ -159,7 +188,7 @@ def test_cluster_manager_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ClusterManagerClient, "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() @@ -447,7 +476,7 @@ def test_list_clusters( transport: str = "grpc", request_type=cluster_service.ListClustersRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -460,19 +489,15 @@ def test_list_clusters( call.return_value = cluster_service.ListClustersResponse( missing_zones=["missing_zones_value"], ) - response = client.list_clusters(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -484,7 +509,7 @@ def test_list_clusters_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -492,7 +517,6 @@ def test_list_clusters_empty_call(): client.list_clusters() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest() @@ -501,7 +525,7 @@ async def test_list_clusters_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListClustersRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -514,18 +538,15 @@ async def test_list_clusters_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListClustersResponse(missing_zones=["missing_zones_value"],) ) - response = await client.list_clusters(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -535,17 +556,17 @@ async def test_list_clusters_async_from_dict(): def test_list_clusters_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListClustersRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: call.return_value = cluster_service.ListClustersResponse() - client.list_clusters(request) # Establish that the underlying gRPC stub method was called. @@ -560,11 +581,14 @@ def test_list_clusters_field_headers(): @pytest.mark.asyncio async def test_list_clusters_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListClustersRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -572,7 +596,6 @@ async def test_list_clusters_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListClustersResponse() ) - await client.list_clusters(request) # Establish that the underlying gRPC stub method was called. @@ -586,13 +609,12 @@ async def test_list_clusters_field_headers_async(): def test_list_clusters_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListClustersResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_clusters( @@ -603,16 +625,13 @@ def test_list_clusters_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].parent == "parent_value" def test_list_clusters_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -627,7 +646,9 @@ def test_list_clusters_flattened_error(): @pytest.mark.asyncio async def test_list_clusters_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: @@ -647,17 +668,16 @@ async def test_list_clusters_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_clusters_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -674,7 +694,7 @@ def test_get_cluster( transport: str = "grpc", request_type=cluster_service.GetClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -714,73 +734,42 @@ def test_get_cluster( enable_tpu=True, tpu_ipv4_cidr_block="tpu_ipv4_cidr_block_value", ) - response = client.get_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Cluster) - assert response.name == "name_value" - assert response.description == "description_value" - assert response.initial_node_count == 1911 - assert response.logging_service == "logging_service_value" - assert response.monitoring_service == "monitoring_service_value" - assert response.network == "network_value" - assert response.cluster_ipv4_cidr == "cluster_ipv4_cidr_value" - assert response.subnetwork == "subnetwork_value" - assert response.locations == ["locations_value"] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == "label_fingerprint_value" - assert response.self_link == "self_link_value" - assert response.zone == "zone_value" - assert response.endpoint == "endpoint_value" - assert response.initial_cluster_version == "initial_cluster_version_value" - assert response.current_master_version == "current_master_version_value" - assert response.current_node_version == "current_node_version_value" - assert response.create_time == "create_time_value" - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == "services_ipv4_cidr_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.current_node_count == 1936 - assert response.expire_time == "expire_time_value" - assert response.location == "location_value" - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == "tpu_ipv4_cidr_block_value" @@ -792,7 +781,7 @@ def test_get_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -800,7 +789,6 @@ def test_get_cluster_empty_call(): client.get_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest() @@ -809,7 +797,7 @@ async def test_get_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -851,72 +839,42 @@ async def test_get_cluster_async( tpu_ipv4_cidr_block="tpu_ipv4_cidr_block_value", ) ) - response = await client.get_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Cluster) - assert response.name == "name_value" - assert response.description == "description_value" - assert response.initial_node_count == 1911 - assert response.logging_service == "logging_service_value" - assert response.monitoring_service == "monitoring_service_value" - assert response.network == "network_value" - assert response.cluster_ipv4_cidr == "cluster_ipv4_cidr_value" - assert response.subnetwork == "subnetwork_value" - assert response.locations == ["locations_value"] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == "label_fingerprint_value" - assert response.self_link == "self_link_value" - assert response.zone == "zone_value" - assert response.endpoint == "endpoint_value" - assert response.initial_cluster_version == "initial_cluster_version_value" - assert response.current_master_version == "current_master_version_value" - assert response.current_node_version == "current_node_version_value" - assert response.create_time == "create_time_value" - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == "services_ipv4_cidr_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.current_node_count == 1936 - assert response.expire_time == "expire_time_value" - assert response.location == "location_value" - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == "tpu_ipv4_cidr_block_value" @@ -926,17 +884,17 @@ async def test_get_cluster_async_from_dict(): def test_get_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: call.return_value = cluster_service.Cluster() - client.get_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -951,11 +909,14 @@ def test_get_cluster_field_headers(): @pytest.mark.asyncio async def test_get_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -963,7 +924,6 @@ async def test_get_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Cluster() ) - await client.get_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -977,13 +937,12 @@ async def test_get_cluster_field_headers_async(): def test_get_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Cluster() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_cluster( @@ -997,18 +956,14 @@ def test_get_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" def test_get_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1024,7 +979,9 @@ def test_get_cluster_flattened_error(): @pytest.mark.asyncio async def test_get_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: @@ -1047,19 +1004,17 @@ async def test_get_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1077,7 +1032,7 @@ def test_create_cluster( transport: str = "grpc", request_type=cluster_service.CreateClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1100,39 +1055,25 @@ def test_create_cluster( start_time="start_time_value", end_time="end_time_value", ) - response = client.create_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1144,7 +1085,7 @@ def test_create_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1152,7 +1093,6 @@ def test_create_cluster_empty_call(): client.create_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest() @@ -1161,7 +1101,7 @@ async def test_create_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1186,38 +1126,25 @@ async def test_create_cluster_async( end_time="end_time_value", ) ) - response = await client.create_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1227,17 +1154,17 @@ async def test_create_cluster_async_from_dict(): def test_create_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CreateClusterRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: call.return_value = cluster_service.Operation() - client.create_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1252,11 +1179,14 @@ def test_create_cluster_field_headers(): @pytest.mark.asyncio async def test_create_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CreateClusterRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1264,7 +1194,6 @@ async def test_create_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.create_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1278,13 +1207,12 @@ async def test_create_cluster_field_headers_async(): def test_create_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_cluster( @@ -1298,18 +1226,14 @@ def test_create_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster == cluster_service.Cluster(name="name_value") - assert args[0].parent == "parent_value" def test_create_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1325,7 +1249,9 @@ def test_create_cluster_flattened_error(): @pytest.mark.asyncio async def test_create_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: @@ -1348,19 +1274,17 @@ async def test_create_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster == cluster_service.Cluster(name="name_value") - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_create_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1378,7 +1302,7 @@ def test_update_cluster( transport: str = "grpc", request_type=cluster_service.UpdateClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1401,39 +1325,25 @@ def test_update_cluster( start_time="start_time_value", end_time="end_time_value", ) - response = client.update_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1445,7 +1355,7 @@ def test_update_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1453,7 +1363,6 @@ def test_update_cluster_empty_call(): client.update_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest() @@ -1462,7 +1371,7 @@ async def test_update_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1487,38 +1396,25 @@ async def test_update_cluster_async( end_time="end_time_value", ) ) - response = await client.update_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1528,17 +1424,17 @@ async def test_update_cluster_async_from_dict(): def test_update_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.UpdateClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: call.return_value = cluster_service.Operation() - client.update_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1553,11 +1449,14 @@ def test_update_cluster_field_headers(): @pytest.mark.asyncio async def test_update_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.UpdateClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1565,7 +1464,6 @@ async def test_update_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.update_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1579,13 +1477,12 @@ async def test_update_cluster_field_headers_async(): def test_update_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_cluster( @@ -1602,22 +1499,17 @@ def test_update_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].update == cluster_service.ClusterUpdate( desired_node_version="desired_node_version_value" ) - assert args[0].name == "name_value" def test_update_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1636,7 +1528,9 @@ def test_update_cluster_flattened_error(): @pytest.mark.asyncio async def test_update_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: @@ -1662,23 +1556,20 @@ async def test_update_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].update == cluster_service.ClusterUpdate( desired_node_version="desired_node_version_value" ) - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_update_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1699,7 +1590,7 @@ def test_update_node_pool( transport: str = "grpc", request_type=cluster_service.UpdateNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1722,39 +1613,25 @@ def test_update_node_pool( start_time="start_time_value", end_time="end_time_value", ) - response = client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1766,7 +1643,7 @@ def test_update_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1774,7 +1651,6 @@ def test_update_node_pool_empty_call(): client.update_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest() @@ -1783,7 +1659,7 @@ async def test_update_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1808,38 +1684,25 @@ async def test_update_node_pool_async( end_time="end_time_value", ) ) - response = await client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1849,17 +1712,17 @@ async def test_update_node_pool_async_from_dict(): def test_update_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.UpdateNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_node_pool), "__call__") as call: call.return_value = cluster_service.Operation() - client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -1874,11 +1737,14 @@ def test_update_node_pool_field_headers(): @pytest.mark.asyncio async def test_update_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.UpdateNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1886,7 +1752,6 @@ async def test_update_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -1903,7 +1768,7 @@ def test_set_node_pool_autoscaling( transport: str = "grpc", request_type=cluster_service.SetNodePoolAutoscalingRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1928,39 +1793,25 @@ def test_set_node_pool_autoscaling( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1972,7 +1823,7 @@ def test_set_node_pool_autoscaling_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1982,7 +1833,6 @@ def test_set_node_pool_autoscaling_empty_call(): client.set_node_pool_autoscaling() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() @@ -1992,7 +1842,7 @@ async def test_set_node_pool_autoscaling_async( request_type=cluster_service.SetNodePoolAutoscalingRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2019,38 +1869,25 @@ async def test_set_node_pool_autoscaling_async( end_time="end_time_value", ) ) - response = await client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2060,11 +1897,12 @@ async def test_set_node_pool_autoscaling_async_from_dict(): def test_set_node_pool_autoscaling_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNodePoolAutoscalingRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2072,7 +1910,6 @@ def test_set_node_pool_autoscaling_field_headers(): type(client.transport.set_node_pool_autoscaling), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. @@ -2087,11 +1924,14 @@ def test_set_node_pool_autoscaling_field_headers(): @pytest.mark.asyncio async def test_set_node_pool_autoscaling_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNodePoolAutoscalingRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2101,7 +1941,6 @@ async def test_set_node_pool_autoscaling_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. @@ -2118,7 +1957,7 @@ def test_set_logging_service( transport: str = "grpc", request_type=cluster_service.SetLoggingServiceRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2143,39 +1982,25 @@ def test_set_logging_service( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_logging_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] == cluster_service.SetLoggingServiceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2187,7 +2012,7 @@ def test_set_logging_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2197,7 +2022,6 @@ def test_set_logging_service_empty_call(): client.set_logging_service() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest() @@ -2207,7 +2031,7 @@ async def test_set_logging_service_async( request_type=cluster_service.SetLoggingServiceRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2234,38 +2058,25 @@ async def test_set_logging_service_async( end_time="end_time_value", ) ) - response = await client.set_logging_service(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2275,11 +2086,12 @@ async def test_set_logging_service_async_from_dict(): def test_set_logging_service_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLoggingServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2287,7 +2099,6 @@ def test_set_logging_service_field_headers(): type(client.transport.set_logging_service), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_logging_service(request) # Establish that the underlying gRPC stub method was called. @@ -2302,11 +2113,14 @@ def test_set_logging_service_field_headers(): @pytest.mark.asyncio async def test_set_logging_service_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLoggingServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2316,7 +2130,6 @@ async def test_set_logging_service_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_logging_service(request) # Establish that the underlying gRPC stub method was called. @@ -2330,7 +2143,7 @@ async def test_set_logging_service_field_headers_async(): def test_set_logging_service_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2338,7 +2151,6 @@ def test_set_logging_service_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_logging_service( @@ -2353,20 +2165,15 @@ def test_set_logging_service_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].logging_service == "logging_service_value" - assert args[0].name == "name_value" def test_set_logging_service_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2383,7 +2190,9 @@ def test_set_logging_service_flattened_error(): @pytest.mark.asyncio async def test_set_logging_service_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2409,21 +2218,18 @@ async def test_set_logging_service_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].logging_service == "logging_service_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_set_logging_service_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2442,7 +2248,7 @@ def test_set_monitoring_service( transport: str = "grpc", request_type=cluster_service.SetMonitoringServiceRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2467,39 +2273,25 @@ def test_set_monitoring_service( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_monitoring_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] == cluster_service.SetMonitoringServiceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2511,7 +2303,7 @@ def test_set_monitoring_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2521,7 +2313,6 @@ def test_set_monitoring_service_empty_call(): client.set_monitoring_service() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest() @@ -2531,7 +2322,7 @@ async def test_set_monitoring_service_async( request_type=cluster_service.SetMonitoringServiceRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2558,38 +2349,25 @@ async def test_set_monitoring_service_async( end_time="end_time_value", ) ) - response = await client.set_monitoring_service(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2599,11 +2377,12 @@ async def test_set_monitoring_service_async_from_dict(): def test_set_monitoring_service_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetMonitoringServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2611,7 +2390,6 @@ def test_set_monitoring_service_field_headers(): type(client.transport.set_monitoring_service), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_monitoring_service(request) # Establish that the underlying gRPC stub method was called. @@ -2626,11 +2404,14 @@ def test_set_monitoring_service_field_headers(): @pytest.mark.asyncio async def test_set_monitoring_service_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetMonitoringServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2640,7 +2421,6 @@ async def test_set_monitoring_service_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_monitoring_service(request) # Establish that the underlying gRPC stub method was called. @@ -2654,7 +2434,7 @@ async def test_set_monitoring_service_field_headers_async(): def test_set_monitoring_service_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2662,7 +2442,6 @@ def test_set_monitoring_service_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_monitoring_service( @@ -2677,20 +2456,15 @@ def test_set_monitoring_service_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].monitoring_service == "monitoring_service_value" - assert args[0].name == "name_value" def test_set_monitoring_service_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2707,7 +2481,9 @@ def test_set_monitoring_service_flattened_error(): @pytest.mark.asyncio async def test_set_monitoring_service_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2733,21 +2509,18 @@ async def test_set_monitoring_service_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].monitoring_service == "monitoring_service_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_set_monitoring_service_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2766,7 +2539,7 @@ def test_set_addons_config( transport: str = "grpc", request_type=cluster_service.SetAddonsConfigRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2791,39 +2564,25 @@ def test_set_addons_config( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2835,7 +2594,7 @@ def test_set_addons_config_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2845,7 +2604,6 @@ def test_set_addons_config_empty_call(): client.set_addons_config() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest() @@ -2854,7 +2612,7 @@ async def test_set_addons_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetAddonsConfigRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2881,38 +2639,25 @@ async def test_set_addons_config_async( end_time="end_time_value", ) ) - response = await client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2922,11 +2667,12 @@ async def test_set_addons_config_async_from_dict(): def test_set_addons_config_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetAddonsConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2934,7 +2680,6 @@ def test_set_addons_config_field_headers(): type(client.transport.set_addons_config), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. @@ -2949,11 +2694,14 @@ def test_set_addons_config_field_headers(): @pytest.mark.asyncio async def test_set_addons_config_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetAddonsConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2963,7 +2711,6 @@ async def test_set_addons_config_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. @@ -2977,7 +2724,7 @@ async def test_set_addons_config_field_headers_async(): def test_set_addons_config_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2985,7 +2732,6 @@ def test_set_addons_config_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_addons_config( @@ -3002,22 +2748,17 @@ def test_set_addons_config_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].addons_config == cluster_service.AddonsConfig( http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True) ) - assert args[0].name == "name_value" def test_set_addons_config_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3036,7 +2777,9 @@ def test_set_addons_config_flattened_error(): @pytest.mark.asyncio async def test_set_addons_config_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3064,23 +2807,20 @@ async def test_set_addons_config_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].addons_config == cluster_service.AddonsConfig( http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True) ) - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_set_addons_config_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3101,7 +2841,7 @@ def test_set_locations( transport: str = "grpc", request_type=cluster_service.SetLocationsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3124,39 +2864,25 @@ def test_set_locations( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_locations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3168,7 +2894,7 @@ def test_set_locations_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3176,7 +2902,6 @@ def test_set_locations_empty_call(): client.set_locations() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest() @@ -3185,7 +2910,7 @@ async def test_set_locations_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLocationsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3210,38 +2935,25 @@ async def test_set_locations_async( end_time="end_time_value", ) ) - response = await client.set_locations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3251,17 +2963,17 @@ async def test_set_locations_async_from_dict(): def test_set_locations_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLocationsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_locations), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_locations(request) # Establish that the underlying gRPC stub method was called. @@ -3276,11 +2988,14 @@ def test_set_locations_field_headers(): @pytest.mark.asyncio async def test_set_locations_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLocationsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3288,7 +3003,6 @@ async def test_set_locations_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_locations(request) # Establish that the underlying gRPC stub method was called. @@ -3302,13 +3016,12 @@ async def test_set_locations_field_headers_async(): def test_set_locations_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_locations), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_locations( @@ -3323,20 +3036,15 @@ def test_set_locations_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].locations == ["locations_value"] - assert args[0].name == "name_value" def test_set_locations_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3353,7 +3061,9 @@ def test_set_locations_flattened_error(): @pytest.mark.asyncio async def test_set_locations_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_locations), "__call__") as call: @@ -3377,21 +3087,18 @@ async def test_set_locations_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].locations == ["locations_value"] - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_set_locations_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3410,7 +3117,7 @@ def test_update_master( transport: str = "grpc", request_type=cluster_service.UpdateMasterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3433,39 +3140,25 @@ def test_update_master( start_time="start_time_value", end_time="end_time_value", ) - response = client.update_master(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3477,7 +3170,7 @@ def test_update_master_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3485,7 +3178,6 @@ def test_update_master_empty_call(): client.update_master() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest() @@ -3494,7 +3186,7 @@ async def test_update_master_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateMasterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3519,38 +3211,25 @@ async def test_update_master_async( end_time="end_time_value", ) ) - response = await client.update_master(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3560,17 +3239,17 @@ async def test_update_master_async_from_dict(): def test_update_master_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.UpdateMasterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_master), "__call__") as call: call.return_value = cluster_service.Operation() - client.update_master(request) # Establish that the underlying gRPC stub method was called. @@ -3585,11 +3264,14 @@ def test_update_master_field_headers(): @pytest.mark.asyncio async def test_update_master_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.UpdateMasterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3597,7 +3279,6 @@ async def test_update_master_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.update_master(request) # Establish that the underlying gRPC stub method was called. @@ -3611,13 +3292,12 @@ async def test_update_master_field_headers_async(): def test_update_master_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_master), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_master( @@ -3632,20 +3312,15 @@ def test_update_master_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].master_version == "master_version_value" - assert args[0].name == "name_value" def test_update_master_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3662,7 +3337,9 @@ def test_update_master_flattened_error(): @pytest.mark.asyncio async def test_update_master_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_master), "__call__") as call: @@ -3686,21 +3363,18 @@ async def test_update_master_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].master_version == "master_version_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_update_master_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3719,7 +3393,7 @@ def test_set_master_auth( transport: str = "grpc", request_type=cluster_service.SetMasterAuthRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3742,39 +3416,25 @@ def test_set_master_auth( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3786,7 +3446,7 @@ def test_set_master_auth_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3794,7 +3454,6 @@ def test_set_master_auth_empty_call(): client.set_master_auth() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest() @@ -3803,7 +3462,7 @@ async def test_set_master_auth_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetMasterAuthRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3828,38 +3487,25 @@ async def test_set_master_auth_async( end_time="end_time_value", ) ) - response = await client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3869,17 +3515,17 @@ async def test_set_master_auth_async_from_dict(): def test_set_master_auth_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetMasterAuthRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_master_auth), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. @@ -3894,11 +3540,14 @@ def test_set_master_auth_field_headers(): @pytest.mark.asyncio async def test_set_master_auth_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetMasterAuthRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3906,7 +3555,6 @@ async def test_set_master_auth_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. @@ -3923,7 +3571,7 @@ def test_delete_cluster( transport: str = "grpc", request_type=cluster_service.DeleteClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3946,39 +3594,25 @@ def test_delete_cluster( start_time="start_time_value", end_time="end_time_value", ) - response = client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3990,7 +3624,7 @@ def test_delete_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3998,7 +3632,6 @@ def test_delete_cluster_empty_call(): client.delete_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest() @@ -4007,7 +3640,7 @@ async def test_delete_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4032,38 +3665,25 @@ async def test_delete_cluster_async( end_time="end_time_value", ) ) - response = await client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -4073,17 +3693,17 @@ async def test_delete_cluster_async_from_dict(): def test_delete_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.DeleteClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: call.return_value = cluster_service.Operation() - client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -4098,11 +3718,14 @@ def test_delete_cluster_field_headers(): @pytest.mark.asyncio async def test_delete_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.DeleteClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4110,7 +3733,6 @@ async def test_delete_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -4124,13 +3746,12 @@ async def test_delete_cluster_field_headers_async(): def test_delete_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_cluster( @@ -4144,18 +3765,14 @@ def test_delete_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" def test_delete_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4171,7 +3788,9 @@ def test_delete_cluster_flattened_error(): @pytest.mark.asyncio async def test_delete_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: @@ -4194,19 +3813,17 @@ async def test_delete_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_delete_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4224,7 +3841,7 @@ def test_list_operations( transport: str = "grpc", request_type=cluster_service.ListOperationsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4237,19 +3854,15 @@ def test_list_operations( call.return_value = cluster_service.ListOperationsResponse( missing_zones=["missing_zones_value"], ) - response = client.list_operations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -4261,7 +3874,7 @@ def test_list_operations_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4269,7 +3882,6 @@ def test_list_operations_empty_call(): client.list_operations() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest() @@ -4278,7 +3890,7 @@ async def test_list_operations_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListOperationsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4293,18 +3905,15 @@ async def test_list_operations_async( missing_zones=["missing_zones_value"], ) ) - response = await client.list_operations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -4314,17 +3923,17 @@ async def test_list_operations_async_from_dict(): def test_list_operations_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListOperationsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: call.return_value = cluster_service.ListOperationsResponse() - client.list_operations(request) # Establish that the underlying gRPC stub method was called. @@ -4339,11 +3948,14 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListOperationsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4351,7 +3963,6 @@ async def test_list_operations_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListOperationsResponse() ) - await client.list_operations(request) # Establish that the underlying gRPC stub method was called. @@ -4365,13 +3976,12 @@ async def test_list_operations_field_headers_async(): def test_list_operations_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListOperationsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_operations( @@ -4382,14 +3992,12 @@ def test_list_operations_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" def test_list_operations_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4403,7 +4011,9 @@ def test_list_operations_flattened_error(): @pytest.mark.asyncio async def test_list_operations_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4423,15 +4033,15 @@ async def test_list_operations_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" @pytest.mark.asyncio async def test_list_operations_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4447,7 +4057,7 @@ def test_get_operation( transport: str = "grpc", request_type=cluster_service.GetOperationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4470,39 +4080,25 @@ def test_get_operation( start_time="start_time_value", end_time="end_time_value", ) - response = client.get_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -4514,7 +4110,7 @@ def test_get_operation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4522,7 +4118,6 @@ def test_get_operation_empty_call(): client.get_operation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest() @@ -4531,7 +4126,7 @@ async def test_get_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetOperationRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4556,38 +4151,25 @@ async def test_get_operation_async( end_time="end_time_value", ) ) - response = await client.get_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -4597,17 +4179,17 @@ async def test_get_operation_async_from_dict(): def test_get_operation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: call.return_value = cluster_service.Operation() - client.get_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4622,11 +4204,14 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4634,7 +4219,6 @@ async def test_get_operation_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.get_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4648,13 +4232,12 @@ async def test_get_operation_field_headers_async(): def test_get_operation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_operation( @@ -4668,18 +4251,14 @@ def test_get_operation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" - assert args[0].name == "name_value" def test_get_operation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4695,7 +4274,9 @@ def test_get_operation_flattened_error(): @pytest.mark.asyncio async def test_get_operation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4718,19 +4299,17 @@ async def test_get_operation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_operation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4748,7 +4327,7 @@ def test_cancel_operation( transport: str = "grpc", request_type=cluster_service.CancelOperationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4759,13 +4338,11 @@ def test_cancel_operation( with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = None - response = client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest() # Establish that the response is the type that we expect. @@ -4780,7 +4357,7 @@ def test_cancel_operation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4788,7 +4365,6 @@ def test_cancel_operation_empty_call(): client.cancel_operation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest() @@ -4797,7 +4373,7 @@ async def test_cancel_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.CancelOperationRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4808,13 +4384,11 @@ async def test_cancel_operation_async( with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest() # Establish that the response is the type that we expect. @@ -4827,17 +4401,17 @@ async def test_cancel_operation_async_from_dict(): def test_cancel_operation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CancelOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: call.return_value = None - client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4852,17 +4426,19 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CancelOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4876,13 +4452,12 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = None - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.cancel_operation( @@ -4896,18 +4471,14 @@ def test_cancel_operation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" - assert args[0].name == "name_value" def test_cancel_operation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4923,7 +4494,9 @@ def test_cancel_operation_flattened_error(): @pytest.mark.asyncio async def test_cancel_operation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -4944,19 +4517,17 @@ async def test_cancel_operation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_cancel_operation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4974,7 +4545,7 @@ def test_get_server_config( transport: str = "grpc", request_type=cluster_service.GetServerConfigRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4993,27 +4564,19 @@ def test_get_server_config( valid_image_types=["valid_image_types_value"], valid_master_versions=["valid_master_versions_value"], ) - response = client.get_server_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == "default_cluster_version_value" - assert response.valid_node_versions == ["valid_node_versions_value"] - assert response.default_image_type == "default_image_type_value" - assert response.valid_image_types == ["valid_image_types_value"] - assert response.valid_master_versions == ["valid_master_versions_value"] @@ -5025,7 +4588,7 @@ def test_get_server_config_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5035,7 +4598,6 @@ def test_get_server_config_empty_call(): client.get_server_config() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest() @@ -5044,7 +4606,7 @@ async def test_get_server_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetServerConfigRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5065,26 +4627,19 @@ async def test_get_server_config_async( valid_master_versions=["valid_master_versions_value"], ) ) - response = await client.get_server_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == "default_cluster_version_value" - assert response.valid_node_versions == ["valid_node_versions_value"] - assert response.default_image_type == "default_image_type_value" - assert response.valid_image_types == ["valid_image_types_value"] - assert response.valid_master_versions == ["valid_master_versions_value"] @@ -5094,11 +4649,12 @@ async def test_get_server_config_async_from_dict(): def test_get_server_config_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetServerConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5106,7 +4662,6 @@ def test_get_server_config_field_headers(): type(client.transport.get_server_config), "__call__" ) as call: call.return_value = cluster_service.ServerConfig() - client.get_server_config(request) # Establish that the underlying gRPC stub method was called. @@ -5121,11 +4676,14 @@ def test_get_server_config_field_headers(): @pytest.mark.asyncio async def test_get_server_config_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetServerConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5135,7 +4693,6 @@ async def test_get_server_config_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ServerConfig() ) - await client.get_server_config(request) # Establish that the underlying gRPC stub method was called. @@ -5149,7 +4706,7 @@ async def test_get_server_config_field_headers_async(): def test_get_server_config_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5157,7 +4714,6 @@ def test_get_server_config_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ServerConfig() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_server_config( @@ -5168,16 +4724,13 @@ def test_get_server_config_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].name == "name_value" def test_get_server_config_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5192,7 +4745,9 @@ def test_get_server_config_flattened_error(): @pytest.mark.asyncio async def test_get_server_config_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5214,17 +4769,16 @@ async def test_get_server_config_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_server_config_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5241,7 +4795,7 @@ def test_get_json_web_keys( transport: str = "grpc", request_type=cluster_service.GetJSONWebKeysRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5254,17 +4808,14 @@ def test_get_json_web_keys( ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.GetJSONWebKeysResponse() - response = client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.GetJSONWebKeysResponse) @@ -5276,7 +4827,7 @@ def test_get_json_web_keys_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5286,7 +4837,6 @@ def test_get_json_web_keys_empty_call(): client.get_json_web_keys() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest() @@ -5295,7 +4845,7 @@ async def test_get_json_web_keys_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetJSONWebKeysRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5310,13 +4860,11 @@ async def test_get_json_web_keys_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.GetJSONWebKeysResponse() ) - response = await client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest() # Establish that the response is the type that we expect. @@ -5329,11 +4877,12 @@ async def test_get_json_web_keys_async_from_dict(): def test_get_json_web_keys_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetJSONWebKeysRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5341,7 +4890,6 @@ def test_get_json_web_keys_field_headers(): type(client.transport.get_json_web_keys), "__call__" ) as call: call.return_value = cluster_service.GetJSONWebKeysResponse() - client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. @@ -5356,11 +4904,14 @@ def test_get_json_web_keys_field_headers(): @pytest.mark.asyncio async def test_get_json_web_keys_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetJSONWebKeysRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5370,7 +4921,6 @@ async def test_get_json_web_keys_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.GetJSONWebKeysResponse() ) - await client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. @@ -5387,7 +4937,7 @@ def test_list_node_pools( transport: str = "grpc", request_type=cluster_service.ListNodePoolsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5398,17 +4948,14 @@ def test_list_node_pools( with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListNodePoolsResponse() - response = client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListNodePoolsResponse) @@ -5420,7 +4967,7 @@ def test_list_node_pools_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5428,7 +4975,6 @@ def test_list_node_pools_empty_call(): client.list_node_pools() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest() @@ -5437,7 +4983,7 @@ async def test_list_node_pools_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListNodePoolsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5450,13 +4996,11 @@ async def test_list_node_pools_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListNodePoolsResponse() ) - response = await client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest() # Establish that the response is the type that we expect. @@ -5469,17 +5013,17 @@ async def test_list_node_pools_async_from_dict(): def test_list_node_pools_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListNodePoolsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: call.return_value = cluster_service.ListNodePoolsResponse() - client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. @@ -5494,11 +5038,14 @@ def test_list_node_pools_field_headers(): @pytest.mark.asyncio async def test_list_node_pools_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListNodePoolsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5506,7 +5053,6 @@ async def test_list_node_pools_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListNodePoolsResponse() ) - await client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. @@ -5520,13 +5066,12 @@ async def test_list_node_pools_field_headers_async(): def test_list_node_pools_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListNodePoolsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_node_pools( @@ -5540,18 +5085,14 @@ def test_list_node_pools_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].parent == "parent_value" def test_list_node_pools_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5567,7 +5108,9 @@ def test_list_node_pools_flattened_error(): @pytest.mark.asyncio async def test_list_node_pools_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: @@ -5590,19 +5133,17 @@ async def test_list_node_pools_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_node_pools_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5620,7 +5161,7 @@ def test_get_node_pool( transport: str = "grpc", request_type=cluster_service.GetNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5641,35 +5182,23 @@ def test_get_node_pool( status_message="status_message_value", pod_ipv4_cidr_size=1856, ) - response = client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.NodePool) - assert response.name == "name_value" - assert response.initial_node_count == 1911 - assert response.locations == ["locations_value"] - assert response.self_link == "self_link_value" - assert response.version == "version_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.pod_ipv4_cidr_size == 1856 @@ -5681,7 +5210,7 @@ def test_get_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5689,7 +5218,6 @@ def test_get_node_pool_empty_call(): client.get_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest() @@ -5698,7 +5226,7 @@ async def test_get_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5721,34 +5249,23 @@ async def test_get_node_pool_async( pod_ipv4_cidr_size=1856, ) ) - response = await client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.NodePool) - assert response.name == "name_value" - assert response.initial_node_count == 1911 - assert response.locations == ["locations_value"] - assert response.self_link == "self_link_value" - assert response.version == "version_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.pod_ipv4_cidr_size == 1856 @@ -5758,17 +5275,17 @@ async def test_get_node_pool_async_from_dict(): def test_get_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: call.return_value = cluster_service.NodePool() - client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5783,11 +5300,14 @@ def test_get_node_pool_field_headers(): @pytest.mark.asyncio async def test_get_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5795,7 +5315,6 @@ async def test_get_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.NodePool() ) - await client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5809,13 +5328,12 @@ async def test_get_node_pool_field_headers_async(): def test_get_node_pool_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.NodePool() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_node_pool( @@ -5830,20 +5348,15 @@ def test_get_node_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].name == "name_value" def test_get_node_pool_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5860,7 +5373,9 @@ def test_get_node_pool_flattened_error(): @pytest.mark.asyncio async def test_get_node_pool_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: @@ -5884,21 +5399,18 @@ async def test_get_node_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_get_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5917,7 +5429,7 @@ def test_create_node_pool( transport: str = "grpc", request_type=cluster_service.CreateNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5940,39 +5452,25 @@ def test_create_node_pool( start_time="start_time_value", end_time="end_time_value", ) - response = client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -5984,7 +5482,7 @@ def test_create_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5992,7 +5490,6 @@ def test_create_node_pool_empty_call(): client.create_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest() @@ -6001,7 +5498,7 @@ async def test_create_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6026,38 +5523,25 @@ async def test_create_node_pool_async( end_time="end_time_value", ) ) - response = await client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6067,17 +5551,17 @@ async def test_create_node_pool_async_from_dict(): def test_create_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CreateNodePoolRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: call.return_value = cluster_service.Operation() - client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -6092,11 +5576,14 @@ def test_create_node_pool_field_headers(): @pytest.mark.asyncio async def test_create_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CreateNodePoolRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6104,7 +5591,6 @@ async def test_create_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -6118,13 +5604,12 @@ async def test_create_node_pool_field_headers_async(): def test_create_node_pool_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_node_pool( @@ -6139,20 +5624,15 @@ def test_create_node_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool == cluster_service.NodePool(name="name_value") - assert args[0].parent == "parent_value" def test_create_node_pool_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6169,7 +5649,9 @@ def test_create_node_pool_flattened_error(): @pytest.mark.asyncio async def test_create_node_pool_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: @@ -6193,21 +5675,18 @@ async def test_create_node_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool == cluster_service.NodePool(name="name_value") - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_create_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6226,7 +5705,7 @@ def test_delete_node_pool( transport: str = "grpc", request_type=cluster_service.DeleteNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6249,39 +5728,25 @@ def test_delete_node_pool( start_time="start_time_value", end_time="end_time_value", ) - response = client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6293,7 +5758,7 @@ def test_delete_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6301,7 +5766,6 @@ def test_delete_node_pool_empty_call(): client.delete_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest() @@ -6310,7 +5774,7 @@ async def test_delete_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6335,38 +5799,25 @@ async def test_delete_node_pool_async( end_time="end_time_value", ) ) - response = await client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6376,17 +5827,17 @@ async def test_delete_node_pool_async_from_dict(): def test_delete_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.DeleteNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: call.return_value = cluster_service.Operation() - client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -6401,11 +5852,14 @@ def test_delete_node_pool_field_headers(): @pytest.mark.asyncio async def test_delete_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.DeleteNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6413,7 +5867,6 @@ async def test_delete_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -6427,13 +5880,12 @@ async def test_delete_node_pool_field_headers_async(): def test_delete_node_pool_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_node_pool( @@ -6448,20 +5900,15 @@ def test_delete_node_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].name == "name_value" def test_delete_node_pool_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6478,7 +5925,9 @@ def test_delete_node_pool_flattened_error(): @pytest.mark.asyncio async def test_delete_node_pool_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: @@ -6502,21 +5951,18 @@ async def test_delete_node_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_delete_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6535,7 +5981,7 @@ def test_rollback_node_pool_upgrade( transport: str = "grpc", request_type=cluster_service.RollbackNodePoolUpgradeRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6560,39 +6006,25 @@ def test_rollback_node_pool_upgrade( start_time="start_time_value", end_time="end_time_value", ) - response = client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6604,7 +6036,7 @@ def test_rollback_node_pool_upgrade_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6614,7 +6046,6 @@ def test_rollback_node_pool_upgrade_empty_call(): client.rollback_node_pool_upgrade() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() @@ -6624,7 +6055,7 @@ async def test_rollback_node_pool_upgrade_async( request_type=cluster_service.RollbackNodePoolUpgradeRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6651,38 +6082,25 @@ async def test_rollback_node_pool_upgrade_async( end_time="end_time_value", ) ) - response = await client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6692,11 +6110,12 @@ async def test_rollback_node_pool_upgrade_async_from_dict(): def test_rollback_node_pool_upgrade_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.RollbackNodePoolUpgradeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6704,7 +6123,6 @@ def test_rollback_node_pool_upgrade_field_headers(): type(client.transport.rollback_node_pool_upgrade), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. @@ -6719,11 +6137,14 @@ def test_rollback_node_pool_upgrade_field_headers(): @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.RollbackNodePoolUpgradeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6733,7 +6154,6 @@ async def test_rollback_node_pool_upgrade_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. @@ -6747,7 +6167,7 @@ async def test_rollback_node_pool_upgrade_field_headers_async(): def test_rollback_node_pool_upgrade_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6755,7 +6175,6 @@ def test_rollback_node_pool_upgrade_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.rollback_node_pool_upgrade( @@ -6770,20 +6189,15 @@ def test_rollback_node_pool_upgrade_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].name == "name_value" def test_rollback_node_pool_upgrade_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6800,7 +6214,9 @@ def test_rollback_node_pool_upgrade_flattened_error(): @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6826,21 +6242,18 @@ async def test_rollback_node_pool_upgrade_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6859,7 +6272,7 @@ def test_set_node_pool_management( transport: str = "grpc", request_type=cluster_service.SetNodePoolManagementRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6884,39 +6297,25 @@ def test_set_node_pool_management( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6928,7 +6327,7 @@ def test_set_node_pool_management_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6938,7 +6337,6 @@ def test_set_node_pool_management_empty_call(): client.set_node_pool_management() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest() @@ -6948,7 +6346,7 @@ async def test_set_node_pool_management_async( request_type=cluster_service.SetNodePoolManagementRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6975,38 +6373,25 @@ async def test_set_node_pool_management_async( end_time="end_time_value", ) ) - response = await client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7016,11 +6401,12 @@ async def test_set_node_pool_management_async_from_dict(): def test_set_node_pool_management_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNodePoolManagementRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7028,7 +6414,6 @@ def test_set_node_pool_management_field_headers(): type(client.transport.set_node_pool_management), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. @@ -7043,11 +6428,14 @@ def test_set_node_pool_management_field_headers(): @pytest.mark.asyncio async def test_set_node_pool_management_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNodePoolManagementRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7057,7 +6445,6 @@ async def test_set_node_pool_management_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. @@ -7074,7 +6461,7 @@ def test_set_labels( transport: str = "grpc", request_type=cluster_service.SetLabelsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7097,39 +6484,25 @@ def test_set_labels( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_labels(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7141,7 +6514,7 @@ def test_set_labels_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7149,7 +6522,6 @@ def test_set_labels_empty_call(): client.set_labels() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest() @@ -7158,7 +6530,7 @@ async def test_set_labels_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLabelsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7183,38 +6555,25 @@ async def test_set_labels_async( end_time="end_time_value", ) ) - response = await client.set_labels(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7224,17 +6583,17 @@ async def test_set_labels_async_from_dict(): def test_set_labels_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLabelsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_labels), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_labels(request) # Establish that the underlying gRPC stub method was called. @@ -7249,11 +6608,14 @@ def test_set_labels_field_headers(): @pytest.mark.asyncio async def test_set_labels_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLabelsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7261,7 +6623,6 @@ async def test_set_labels_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_labels(request) # Establish that the underlying gRPC stub method was called. @@ -7278,7 +6639,7 @@ def test_set_legacy_abac( transport: str = "grpc", request_type=cluster_service.SetLegacyAbacRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7301,39 +6662,25 @@ def test_set_legacy_abac( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7345,7 +6692,7 @@ def test_set_legacy_abac_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7353,7 +6700,6 @@ def test_set_legacy_abac_empty_call(): client.set_legacy_abac() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest() @@ -7362,7 +6708,7 @@ async def test_set_legacy_abac_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLegacyAbacRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7387,38 +6733,25 @@ async def test_set_legacy_abac_async( end_time="end_time_value", ) ) - response = await client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7428,17 +6761,17 @@ async def test_set_legacy_abac_async_from_dict(): def test_set_legacy_abac_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLegacyAbacRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. @@ -7453,11 +6786,14 @@ def test_set_legacy_abac_field_headers(): @pytest.mark.asyncio async def test_set_legacy_abac_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLegacyAbacRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7465,7 +6801,6 @@ async def test_set_legacy_abac_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. @@ -7479,13 +6814,12 @@ async def test_set_legacy_abac_field_headers_async(): def test_set_legacy_abac_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_legacy_abac( @@ -7500,20 +6834,15 @@ def test_set_legacy_abac_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].enabled == True - assert args[0].name == "name_value" def test_set_legacy_abac_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7530,7 +6859,9 @@ def test_set_legacy_abac_flattened_error(): @pytest.mark.asyncio async def test_set_legacy_abac_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: @@ -7554,21 +6885,18 @@ async def test_set_legacy_abac_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].enabled == True - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_set_legacy_abac_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7587,7 +6915,7 @@ def test_start_ip_rotation( transport: str = "grpc", request_type=cluster_service.StartIPRotationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7612,39 +6940,25 @@ def test_start_ip_rotation( start_time="start_time_value", end_time="end_time_value", ) - response = client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7656,7 +6970,7 @@ def test_start_ip_rotation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7666,7 +6980,6 @@ def test_start_ip_rotation_empty_call(): client.start_ip_rotation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest() @@ -7675,7 +6988,7 @@ async def test_start_ip_rotation_async( transport: str = "grpc_asyncio", request_type=cluster_service.StartIPRotationRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7702,38 +7015,25 @@ async def test_start_ip_rotation_async( end_time="end_time_value", ) ) - response = await client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7743,11 +7043,12 @@ async def test_start_ip_rotation_async_from_dict(): def test_start_ip_rotation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.StartIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7755,7 +7056,6 @@ def test_start_ip_rotation_field_headers(): type(client.transport.start_ip_rotation), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -7770,11 +7070,14 @@ def test_start_ip_rotation_field_headers(): @pytest.mark.asyncio async def test_start_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.StartIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7784,7 +7087,6 @@ async def test_start_ip_rotation_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -7798,7 +7100,7 @@ async def test_start_ip_rotation_field_headers_async(): def test_start_ip_rotation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7806,7 +7108,6 @@ def test_start_ip_rotation_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.start_ip_rotation( @@ -7820,18 +7121,14 @@ def test_start_ip_rotation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" def test_start_ip_rotation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7847,7 +7144,9 @@ def test_start_ip_rotation_flattened_error(): @pytest.mark.asyncio async def test_start_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7872,19 +7171,17 @@ async def test_start_ip_rotation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_start_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7902,7 +7199,7 @@ def test_complete_ip_rotation( transport: str = "grpc", request_type=cluster_service.CompleteIPRotationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7927,39 +7224,25 @@ def test_complete_ip_rotation( start_time="start_time_value", end_time="end_time_value", ) - response = client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7971,7 +7254,7 @@ def test_complete_ip_rotation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7981,7 +7264,6 @@ def test_complete_ip_rotation_empty_call(): client.complete_ip_rotation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest() @@ -7991,7 +7273,7 @@ async def test_complete_ip_rotation_async( request_type=cluster_service.CompleteIPRotationRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8018,38 +7300,25 @@ async def test_complete_ip_rotation_async( end_time="end_time_value", ) ) - response = await client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8059,11 +7328,12 @@ async def test_complete_ip_rotation_async_from_dict(): def test_complete_ip_rotation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CompleteIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8071,7 +7341,6 @@ def test_complete_ip_rotation_field_headers(): type(client.transport.complete_ip_rotation), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -8086,11 +7355,14 @@ def test_complete_ip_rotation_field_headers(): @pytest.mark.asyncio async def test_complete_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CompleteIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8100,7 +7372,6 @@ async def test_complete_ip_rotation_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -8114,7 +7385,7 @@ async def test_complete_ip_rotation_field_headers_async(): def test_complete_ip_rotation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8122,7 +7393,6 @@ def test_complete_ip_rotation_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.complete_ip_rotation( @@ -8136,18 +7406,14 @@ def test_complete_ip_rotation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" def test_complete_ip_rotation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8163,7 +7429,9 @@ def test_complete_ip_rotation_flattened_error(): @pytest.mark.asyncio async def test_complete_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8188,19 +7456,17 @@ async def test_complete_ip_rotation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_complete_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8218,7 +7484,7 @@ def test_set_node_pool_size( transport: str = "grpc", request_type=cluster_service.SetNodePoolSizeRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8243,39 +7509,25 @@ def test_set_node_pool_size( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8287,7 +7539,7 @@ def test_set_node_pool_size_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8297,7 +7549,6 @@ def test_set_node_pool_size_empty_call(): client.set_node_pool_size() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest() @@ -8306,7 +7557,7 @@ async def test_set_node_pool_size_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetNodePoolSizeRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8333,38 +7584,25 @@ async def test_set_node_pool_size_async( end_time="end_time_value", ) ) - response = await client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8374,11 +7612,12 @@ async def test_set_node_pool_size_async_from_dict(): def test_set_node_pool_size_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNodePoolSizeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8386,7 +7625,6 @@ def test_set_node_pool_size_field_headers(): type(client.transport.set_node_pool_size), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. @@ -8401,11 +7639,14 @@ def test_set_node_pool_size_field_headers(): @pytest.mark.asyncio async def test_set_node_pool_size_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNodePoolSizeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8415,7 +7656,6 @@ async def test_set_node_pool_size_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. @@ -8432,7 +7672,7 @@ def test_set_network_policy( transport: str = "grpc", request_type=cluster_service.SetNetworkPolicyRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8457,39 +7697,25 @@ def test_set_network_policy( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8501,7 +7727,7 @@ def test_set_network_policy_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8511,7 +7737,6 @@ def test_set_network_policy_empty_call(): client.set_network_policy() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest() @@ -8521,7 +7746,7 @@ async def test_set_network_policy_async( request_type=cluster_service.SetNetworkPolicyRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8548,38 +7773,25 @@ async def test_set_network_policy_async( end_time="end_time_value", ) ) - response = await client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8589,11 +7801,12 @@ async def test_set_network_policy_async_from_dict(): def test_set_network_policy_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNetworkPolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8601,7 +7814,6 @@ def test_set_network_policy_field_headers(): type(client.transport.set_network_policy), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. @@ -8616,11 +7828,14 @@ def test_set_network_policy_field_headers(): @pytest.mark.asyncio async def test_set_network_policy_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNetworkPolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8630,7 +7845,6 @@ async def test_set_network_policy_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. @@ -8644,7 +7858,7 @@ async def test_set_network_policy_field_headers_async(): def test_set_network_policy_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8652,7 +7866,6 @@ def test_set_network_policy_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_network_policy( @@ -8669,22 +7882,17 @@ def test_set_network_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].network_policy == cluster_service.NetworkPolicy( provider=cluster_service.NetworkPolicy.Provider.CALICO ) - assert args[0].name == "name_value" def test_set_network_policy_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8703,7 +7911,9 @@ def test_set_network_policy_flattened_error(): @pytest.mark.asyncio async def test_set_network_policy_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8731,23 +7941,20 @@ async def test_set_network_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].network_policy == cluster_service.NetworkPolicy( provider=cluster_service.NetworkPolicy.Provider.CALICO ) - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_set_network_policy_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8768,7 +7975,7 @@ def test_set_maintenance_policy( transport: str = "grpc", request_type=cluster_service.SetMaintenancePolicyRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8793,39 +8000,25 @@ def test_set_maintenance_policy( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8837,7 +8030,7 @@ def test_set_maintenance_policy_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8847,7 +8040,6 @@ def test_set_maintenance_policy_empty_call(): client.set_maintenance_policy() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest() @@ -8857,7 +8049,7 @@ async def test_set_maintenance_policy_async( request_type=cluster_service.SetMaintenancePolicyRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8884,38 +8076,25 @@ async def test_set_maintenance_policy_async( end_time="end_time_value", ) ) - response = await client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8925,11 +8104,12 @@ async def test_set_maintenance_policy_async_from_dict(): def test_set_maintenance_policy_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetMaintenancePolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8937,7 +8117,6 @@ def test_set_maintenance_policy_field_headers(): type(client.transport.set_maintenance_policy), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. @@ -8952,11 +8131,14 @@ def test_set_maintenance_policy_field_headers(): @pytest.mark.asyncio async def test_set_maintenance_policy_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetMaintenancePolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8966,7 +8148,6 @@ async def test_set_maintenance_policy_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. @@ -8980,7 +8161,7 @@ async def test_set_maintenance_policy_field_headers_async(): def test_set_maintenance_policy_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8988,7 +8169,6 @@ def test_set_maintenance_policy_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_maintenance_policy( @@ -9009,13 +8189,9 @@ def test_set_maintenance_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].maintenance_policy == cluster_service.MaintenancePolicy( window=cluster_service.MaintenanceWindow( daily_maintenance_window=cluster_service.DailyMaintenanceWindow( @@ -9023,12 +8199,11 @@ def test_set_maintenance_policy_flattened(): ) ) ) - assert args[0].name == "name_value" def test_set_maintenance_policy_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9051,7 +8226,9 @@ def test_set_maintenance_policy_flattened_error(): @pytest.mark.asyncio async def test_set_maintenance_policy_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9083,13 +8260,9 @@ async def test_set_maintenance_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].maintenance_policy == cluster_service.MaintenancePolicy( window=cluster_service.MaintenanceWindow( daily_maintenance_window=cluster_service.DailyMaintenanceWindow( @@ -9097,13 +8270,14 @@ async def test_set_maintenance_policy_flattened_async(): ) ) ) - assert args[0].name == "name_value" @pytest.mark.asyncio async def test_set_maintenance_policy_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9128,7 +8302,7 @@ def test_list_usable_subnetworks( transport: str = "grpc", request_type=cluster_service.ListUsableSubnetworksRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -9143,19 +8317,15 @@ def test_list_usable_subnetworks( call.return_value = cluster_service.ListUsableSubnetworksResponse( next_page_token="next_page_token_value", ) - response = client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUsableSubnetworksPager) - assert response.next_page_token == "next_page_token_value" @@ -9167,7 +8337,7 @@ def test_list_usable_subnetworks_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9177,7 +8347,6 @@ def test_list_usable_subnetworks_empty_call(): client.list_usable_subnetworks() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest() @@ -9187,7 +8356,7 @@ async def test_list_usable_subnetworks_async( request_type=cluster_service.ListUsableSubnetworksRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -9204,18 +8373,15 @@ async def test_list_usable_subnetworks_async( next_page_token="next_page_token_value", ) ) - response = await client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListUsableSubnetworksAsyncPager) - assert response.next_page_token == "next_page_token_value" @@ -9225,11 +8391,12 @@ async def test_list_usable_subnetworks_async_from_dict(): def test_list_usable_subnetworks_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListUsableSubnetworksRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -9237,7 +8404,6 @@ def test_list_usable_subnetworks_field_headers(): type(client.transport.list_usable_subnetworks), "__call__" ) as call: call.return_value = cluster_service.ListUsableSubnetworksResponse() - client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. @@ -9252,11 +8418,14 @@ def test_list_usable_subnetworks_field_headers(): @pytest.mark.asyncio async def test_list_usable_subnetworks_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListUsableSubnetworksRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -9266,7 +8435,6 @@ async def test_list_usable_subnetworks_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListUsableSubnetworksResponse() ) - await client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. @@ -9280,7 +8448,7 @@ async def test_list_usable_subnetworks_field_headers_async(): def test_list_usable_subnetworks_pager(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9326,7 +8494,7 @@ def test_list_usable_subnetworks_pager(): def test_list_usable_subnetworks_pages(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9364,7 +8532,7 @@ def test_list_usable_subnetworks_pages(): @pytest.mark.asyncio async def test_list_usable_subnetworks_async_pager(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9409,7 +8577,7 @@ async def test_list_usable_subnetworks_async_pager(): @pytest.mark.asyncio async def test_list_usable_subnetworks_async_pages(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9452,16 +8620,16 @@ async def test_list_usable_subnetworks_async_pages(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ClusterManagerClient( - 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.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ClusterManagerClient( @@ -9471,7 +8639,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ClusterManagerClient( @@ -9482,7 +8650,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ClusterManagerClient(transport=transport) assert client.transport is transport @@ -9491,13 +8659,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ClusterManagerGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -9512,23 +8680,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 = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) assert isinstance(client.transport, transports.ClusterManagerGrpcTransport,) def test_cluster_manager_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.ClusterManagerTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -9540,7 +8708,7 @@ def test_cluster_manager_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ClusterManagerTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -9584,15 +8752,37 @@ def test_cluster_manager_base_transport(): getattr(transport, method)(request=object()) +@requires_google_auth_gte_1_25_0 def test_cluster_manager_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.container_v1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ClusterManagerTransport( + 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/cloud-platform",), + quota_project_id="octopus", + ) + + +@requires_google_auth_lt_1_25_0 +def test_cluster_manager_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.container_v1.services.cluster_manager.transports.ClusterManagerTransport._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.ClusterManagerTransport( credentials_file="credentials.json", quota_project_id="octopus", ) @@ -9605,19 +8795,33 @@ def test_cluster_manager_base_transport_with_credentials_file(): def test_cluster_manager_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.container_v1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ClusterManagerTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_cluster_manager_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) + ClusterManagerClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id=None, + ) + + +@requires_google_auth_lt_1_25_0 +def test_cluster_manager_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) ClusterManagerClient() adc.assert_called_once_with( scopes=("https://www.googleapis.com/auth/cloud-platform",), @@ -9625,20 +8829,156 @@ def test_cluster_manager_auth_adc(): ) -def test_cluster_manager_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +def test_cluster_manager_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.ClusterManagerGrpcTransport( - 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/cloud-platform",), + quota_project_id="octopus", ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +@requires_google_auth_lt_1_25_0 +def test_cluster_manager_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/cloud-platform",), quota_project_id="octopus", ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +def test_cluster_manager_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( + "container.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=["1", "2"], + default_host="container.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.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_cluster_manager_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( + "container.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_cluster_manager_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( + "container.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", [ @@ -9647,7 +8987,7 @@ def test_cluster_manager_transport_auth_adc(): ], ) def test_cluster_manager_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: @@ -9686,7 +9026,7 @@ def test_cluster_manager_grpc_transport_client_cert_source_for_mtls(transport_cl def test_cluster_manager_host_no_port(): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="container.googleapis.com" ), @@ -9696,7 +9036,7 @@ def test_cluster_manager_host_no_port(): def test_cluster_manager_host_with_port(): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="container.googleapis.com:8000" ), @@ -9752,9 +9092,9 @@ def test_cluster_manager_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", @@ -9830,7 +9170,6 @@ def test_cluster_manager_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, ) @@ -9851,7 +9190,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) actual = ClusterManagerClient.common_folder_path(folder) assert expected == actual @@ -9870,7 +9208,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) actual = ClusterManagerClient.common_organization_path(organization) assert expected == actual @@ -9889,7 +9226,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) actual = ClusterManagerClient.common_project_path(project) assert expected == actual @@ -9909,7 +9245,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, ) @@ -9936,7 +9271,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.ClusterManagerTransport, "_prep_wrapped_messages" ) as prep: client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -9945,6 +9280,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = ClusterManagerClient.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/container_v1beta1/__init__.py b/tests/unit/gapic/container_v1beta1/__init__.py index 42ffdf2b..4de65971 100644 --- a/tests/unit/gapic/container_v1beta1/__init__.py +++ b/tests/unit/gapic/container_v1beta1/__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/container_v1beta1/test_cluster_manager.py b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index 20a19f37..f3b9b08e 100644 --- a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1beta1/test_cluster_manager.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.container_v1beta1.services.cluster_manager import ( ClusterManagerAsyncClient, @@ -38,12 +37,42 @@ from google.cloud.container_v1beta1.services.cluster_manager import ClusterManagerClient from google.cloud.container_v1beta1.services.cluster_manager import pagers from google.cloud.container_v1beta1.services.cluster_manager import transports +from google.cloud.container_v1beta1.services.cluster_manager.transports.base import ( + _API_CORE_VERSION, +) +from google.cloud.container_v1beta1.services.cluster_manager.transports.base import ( + _GOOGLE_AUTH_VERSION, +) from google.cloud.container_v1beta1.types import cluster_service from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from google.protobuf import wrappers_pb2 as wrappers # type: ignore -from google.rpc import code_pb2 as code # type: ignore -from google.rpc import status_pb2 as status # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.protobuf import wrappers_pb2 # type: ignore +from google.rpc import code_pb2 # type: ignore +from google.rpc import status_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(): @@ -94,7 +123,7 @@ def test__get_default_mtls_endpoint(): "client_class", [ClusterManagerClient, ClusterManagerAsyncClient,] ) def test_cluster_manager_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_cluster_manager_client_from_service_account_info(client_class): "client_class", [ClusterManagerClient, ClusterManagerAsyncClient,] ) def test_cluster_manager_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_cluster_manager_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ClusterManagerClient, "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() @@ -452,7 +481,7 @@ def test_list_clusters( transport: str = "grpc", request_type=cluster_service.ListClustersRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -465,19 +494,15 @@ def test_list_clusters( call.return_value = cluster_service.ListClustersResponse( missing_zones=["missing_zones_value"], ) - response = client.list_clusters(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -489,7 +514,7 @@ def test_list_clusters_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -497,7 +522,6 @@ def test_list_clusters_empty_call(): client.list_clusters() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest() @@ -506,7 +530,7 @@ async def test_list_clusters_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListClustersRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -519,18 +543,15 @@ async def test_list_clusters_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListClustersResponse(missing_zones=["missing_zones_value"],) ) - response = await client.list_clusters(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.ListClustersResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -540,17 +561,17 @@ async def test_list_clusters_async_from_dict(): def test_list_clusters_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListClustersRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: call.return_value = cluster_service.ListClustersResponse() - client.list_clusters(request) # Establish that the underlying gRPC stub method was called. @@ -565,11 +586,14 @@ def test_list_clusters_field_headers(): @pytest.mark.asyncio async def test_list_clusters_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListClustersRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -577,7 +601,6 @@ async def test_list_clusters_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListClustersResponse() ) - await client.list_clusters(request) # Establish that the underlying gRPC stub method was called. @@ -591,13 +614,12 @@ async def test_list_clusters_field_headers_async(): def test_list_clusters_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListClustersResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_clusters( @@ -608,14 +630,12 @@ def test_list_clusters_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" def test_list_clusters_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -629,7 +649,9 @@ def test_list_clusters_flattened_error(): @pytest.mark.asyncio async def test_list_clusters_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: @@ -649,15 +671,15 @@ async def test_list_clusters_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" @pytest.mark.asyncio async def test_list_clusters_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -673,7 +695,7 @@ def test_get_cluster( transport: str = "grpc", request_type=cluster_service.GetClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -715,77 +737,44 @@ def test_get_cluster( enable_tpu=True, tpu_ipv4_cidr_block="tpu_ipv4_cidr_block_value", ) - response = client.get_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Cluster) - assert response.name == "name_value" - assert response.description == "description_value" - assert response.initial_node_count == 1911 - assert response.logging_service == "logging_service_value" - assert response.monitoring_service == "monitoring_service_value" - assert response.network == "network_value" - assert response.cluster_ipv4_cidr == "cluster_ipv4_cidr_value" - assert response.subnetwork == "subnetwork_value" - assert response.locations == ["locations_value"] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == "label_fingerprint_value" - assert response.private_cluster is True - assert response.master_ipv4_cidr_block == "master_ipv4_cidr_block_value" - assert response.self_link == "self_link_value" - assert response.zone == "zone_value" - assert response.endpoint == "endpoint_value" - assert response.initial_cluster_version == "initial_cluster_version_value" - assert response.current_master_version == "current_master_version_value" - assert response.current_node_version == "current_node_version_value" - assert response.create_time == "create_time_value" - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == "services_ipv4_cidr_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.current_node_count == 1936 - assert response.expire_time == "expire_time_value" - assert response.location == "location_value" - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == "tpu_ipv4_cidr_block_value" @@ -797,7 +786,7 @@ def test_get_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -805,7 +794,6 @@ def test_get_cluster_empty_call(): client.get_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest() @@ -814,7 +802,7 @@ async def test_get_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -858,76 +846,44 @@ async def test_get_cluster_async( tpu_ipv4_cidr_block="tpu_ipv4_cidr_block_value", ) ) - response = await client.get_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Cluster) - assert response.name == "name_value" - assert response.description == "description_value" - assert response.initial_node_count == 1911 - assert response.logging_service == "logging_service_value" - assert response.monitoring_service == "monitoring_service_value" - assert response.network == "network_value" - assert response.cluster_ipv4_cidr == "cluster_ipv4_cidr_value" - assert response.subnetwork == "subnetwork_value" - assert response.locations == ["locations_value"] - assert response.enable_kubernetes_alpha is True - assert response.label_fingerprint == "label_fingerprint_value" - assert response.private_cluster is True - assert response.master_ipv4_cidr_block == "master_ipv4_cidr_block_value" - assert response.self_link == "self_link_value" - assert response.zone == "zone_value" - assert response.endpoint == "endpoint_value" - assert response.initial_cluster_version == "initial_cluster_version_value" - assert response.current_master_version == "current_master_version_value" - assert response.current_node_version == "current_node_version_value" - assert response.create_time == "create_time_value" - assert response.status == cluster_service.Cluster.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.node_ipv4_cidr_size == 1955 - assert response.services_ipv4_cidr == "services_ipv4_cidr_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.current_node_count == 1936 - assert response.expire_time == "expire_time_value" - assert response.location == "location_value" - assert response.enable_tpu is True - assert response.tpu_ipv4_cidr_block == "tpu_ipv4_cidr_block_value" @@ -937,17 +893,17 @@ async def test_get_cluster_async_from_dict(): def test_get_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: call.return_value = cluster_service.Cluster() - client.get_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -962,11 +918,14 @@ def test_get_cluster_field_headers(): @pytest.mark.asyncio async def test_get_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -974,7 +933,6 @@ async def test_get_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Cluster() ) - await client.get_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -988,13 +946,12 @@ async def test_get_cluster_field_headers_async(): def test_get_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Cluster() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_cluster( @@ -1007,16 +964,13 @@ def test_get_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" def test_get_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1031,7 +985,9 @@ def test_get_cluster_flattened_error(): @pytest.mark.asyncio async def test_get_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: @@ -1053,17 +1009,16 @@ async def test_get_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" @pytest.mark.asyncio async def test_get_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1080,7 +1035,7 @@ def test_create_cluster( transport: str = "grpc", request_type=cluster_service.CreateClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1103,39 +1058,25 @@ def test_create_cluster( start_time="start_time_value", end_time="end_time_value", ) - response = client.create_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1147,7 +1088,7 @@ def test_create_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1155,7 +1096,6 @@ def test_create_cluster_empty_call(): client.create_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest() @@ -1164,7 +1104,7 @@ async def test_create_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1189,38 +1129,25 @@ async def test_create_cluster_async( end_time="end_time_value", ) ) - response = await client.create_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1230,17 +1157,17 @@ async def test_create_cluster_async_from_dict(): def test_create_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CreateClusterRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: call.return_value = cluster_service.Operation() - client.create_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1255,11 +1182,14 @@ def test_create_cluster_field_headers(): @pytest.mark.asyncio async def test_create_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CreateClusterRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1267,7 +1197,6 @@ async def test_create_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.create_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1281,13 +1210,12 @@ async def test_create_cluster_field_headers_async(): def test_create_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_cluster( @@ -1300,16 +1228,13 @@ def test_create_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster == cluster_service.Cluster(name="name_value") def test_create_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1324,7 +1249,9 @@ def test_create_cluster_flattened_error(): @pytest.mark.asyncio async def test_create_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: @@ -1346,17 +1273,16 @@ async def test_create_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster == cluster_service.Cluster(name="name_value") @pytest.mark.asyncio async def test_create_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1373,7 +1299,7 @@ def test_update_cluster( transport: str = "grpc", request_type=cluster_service.UpdateClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1396,39 +1322,25 @@ def test_update_cluster( start_time="start_time_value", end_time="end_time_value", ) - response = client.update_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1440,7 +1352,7 @@ def test_update_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1448,7 +1360,6 @@ def test_update_cluster_empty_call(): client.update_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest() @@ -1457,7 +1368,7 @@ async def test_update_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1482,38 +1393,25 @@ async def test_update_cluster_async( end_time="end_time_value", ) ) - response = await client.update_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1523,17 +1421,17 @@ async def test_update_cluster_async_from_dict(): def test_update_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.UpdateClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: call.return_value = cluster_service.Operation() - client.update_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1548,11 +1446,14 @@ def test_update_cluster_field_headers(): @pytest.mark.asyncio async def test_update_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.UpdateClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1560,7 +1461,6 @@ async def test_update_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.update_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -1574,13 +1474,12 @@ async def test_update_cluster_field_headers_async(): def test_update_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_cluster( @@ -1596,20 +1495,16 @@ def test_update_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].update == cluster_service.ClusterUpdate( desired_node_version="desired_node_version_value" ) def test_update_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1627,7 +1522,9 @@ def test_update_cluster_flattened_error(): @pytest.mark.asyncio async def test_update_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: @@ -1652,13 +1549,9 @@ async def test_update_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].update == cluster_service.ClusterUpdate( desired_node_version="desired_node_version_value" ) @@ -1666,7 +1559,9 @@ async def test_update_cluster_flattened_async(): @pytest.mark.asyncio async def test_update_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1686,7 +1581,7 @@ def test_update_node_pool( transport: str = "grpc", request_type=cluster_service.UpdateNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1709,39 +1604,25 @@ def test_update_node_pool( start_time="start_time_value", end_time="end_time_value", ) - response = client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1753,7 +1634,7 @@ def test_update_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1761,7 +1642,6 @@ def test_update_node_pool_empty_call(): client.update_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest() @@ -1770,7 +1650,7 @@ async def test_update_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1795,38 +1675,25 @@ async def test_update_node_pool_async( end_time="end_time_value", ) ) - response = await client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1836,17 +1703,17 @@ async def test_update_node_pool_async_from_dict(): def test_update_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.UpdateNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_node_pool), "__call__") as call: call.return_value = cluster_service.Operation() - client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -1861,11 +1728,14 @@ def test_update_node_pool_field_headers(): @pytest.mark.asyncio async def test_update_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.UpdateNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -1873,7 +1743,6 @@ async def test_update_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.update_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -1890,7 +1759,7 @@ def test_set_node_pool_autoscaling( transport: str = "grpc", request_type=cluster_service.SetNodePoolAutoscalingRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1915,39 +1784,25 @@ def test_set_node_pool_autoscaling( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -1959,7 +1814,7 @@ def test_set_node_pool_autoscaling_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1969,7 +1824,6 @@ def test_set_node_pool_autoscaling_empty_call(): client.set_node_pool_autoscaling() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() @@ -1979,7 +1833,7 @@ async def test_set_node_pool_autoscaling_async( request_type=cluster_service.SetNodePoolAutoscalingRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2006,38 +1860,25 @@ async def test_set_node_pool_autoscaling_async( end_time="end_time_value", ) ) - response = await client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2047,11 +1888,12 @@ async def test_set_node_pool_autoscaling_async_from_dict(): def test_set_node_pool_autoscaling_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNodePoolAutoscalingRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2059,7 +1901,6 @@ def test_set_node_pool_autoscaling_field_headers(): type(client.transport.set_node_pool_autoscaling), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. @@ -2074,11 +1915,14 @@ def test_set_node_pool_autoscaling_field_headers(): @pytest.mark.asyncio async def test_set_node_pool_autoscaling_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNodePoolAutoscalingRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2088,7 +1932,6 @@ async def test_set_node_pool_autoscaling_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_node_pool_autoscaling(request) # Establish that the underlying gRPC stub method was called. @@ -2105,7 +1948,7 @@ def test_set_logging_service( transport: str = "grpc", request_type=cluster_service.SetLoggingServiceRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2130,39 +1973,25 @@ def test_set_logging_service( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_logging_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] == cluster_service.SetLoggingServiceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2174,7 +2003,7 @@ def test_set_logging_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2184,7 +2013,6 @@ def test_set_logging_service_empty_call(): client.set_logging_service() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest() @@ -2194,7 +2022,7 @@ async def test_set_logging_service_async( request_type=cluster_service.SetLoggingServiceRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2221,38 +2049,25 @@ async def test_set_logging_service_async( end_time="end_time_value", ) ) - response = await client.set_logging_service(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2262,11 +2077,12 @@ async def test_set_logging_service_async_from_dict(): def test_set_logging_service_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLoggingServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2274,7 +2090,6 @@ def test_set_logging_service_field_headers(): type(client.transport.set_logging_service), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_logging_service(request) # Establish that the underlying gRPC stub method was called. @@ -2289,11 +2104,14 @@ def test_set_logging_service_field_headers(): @pytest.mark.asyncio async def test_set_logging_service_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLoggingServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2303,7 +2121,6 @@ async def test_set_logging_service_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_logging_service(request) # Establish that the underlying gRPC stub method was called. @@ -2317,7 +2134,7 @@ async def test_set_logging_service_field_headers_async(): def test_set_logging_service_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2325,7 +2142,6 @@ def test_set_logging_service_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_logging_service( @@ -2339,18 +2155,14 @@ def test_set_logging_service_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].logging_service == "logging_service_value" def test_set_logging_service_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2366,7 +2178,9 @@ def test_set_logging_service_flattened_error(): @pytest.mark.asyncio async def test_set_logging_service_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2391,19 +2205,17 @@ async def test_set_logging_service_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].logging_service == "logging_service_value" @pytest.mark.asyncio async def test_set_logging_service_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2421,7 +2233,7 @@ def test_set_monitoring_service( transport: str = "grpc", request_type=cluster_service.SetMonitoringServiceRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2446,39 +2258,25 @@ def test_set_monitoring_service( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_monitoring_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] == cluster_service.SetMonitoringServiceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2490,7 +2288,7 @@ def test_set_monitoring_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2500,7 +2298,6 @@ def test_set_monitoring_service_empty_call(): client.set_monitoring_service() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest() @@ -2510,7 +2307,7 @@ async def test_set_monitoring_service_async( request_type=cluster_service.SetMonitoringServiceRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2537,38 +2334,25 @@ async def test_set_monitoring_service_async( end_time="end_time_value", ) ) - response = await client.set_monitoring_service(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2578,11 +2362,12 @@ async def test_set_monitoring_service_async_from_dict(): def test_set_monitoring_service_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetMonitoringServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2590,7 +2375,6 @@ def test_set_monitoring_service_field_headers(): type(client.transport.set_monitoring_service), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_monitoring_service(request) # Establish that the underlying gRPC stub method was called. @@ -2605,11 +2389,14 @@ def test_set_monitoring_service_field_headers(): @pytest.mark.asyncio async def test_set_monitoring_service_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetMonitoringServiceRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2619,7 +2406,6 @@ async def test_set_monitoring_service_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_monitoring_service(request) # Establish that the underlying gRPC stub method was called. @@ -2633,7 +2419,7 @@ async def test_set_monitoring_service_field_headers_async(): def test_set_monitoring_service_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2641,7 +2427,6 @@ def test_set_monitoring_service_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_monitoring_service( @@ -2655,18 +2440,14 @@ def test_set_monitoring_service_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].monitoring_service == "monitoring_service_value" def test_set_monitoring_service_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2682,7 +2463,9 @@ def test_set_monitoring_service_flattened_error(): @pytest.mark.asyncio async def test_set_monitoring_service_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2707,19 +2490,17 @@ async def test_set_monitoring_service_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].monitoring_service == "monitoring_service_value" @pytest.mark.asyncio async def test_set_monitoring_service_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2737,7 +2518,7 @@ def test_set_addons_config( transport: str = "grpc", request_type=cluster_service.SetAddonsConfigRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2762,39 +2543,25 @@ def test_set_addons_config( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2806,7 +2573,7 @@ def test_set_addons_config_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2816,7 +2583,6 @@ def test_set_addons_config_empty_call(): client.set_addons_config() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest() @@ -2825,7 +2591,7 @@ async def test_set_addons_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetAddonsConfigRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2852,38 +2618,25 @@ async def test_set_addons_config_async( end_time="end_time_value", ) ) - response = await client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -2893,11 +2646,12 @@ async def test_set_addons_config_async_from_dict(): def test_set_addons_config_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetAddonsConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2905,7 +2659,6 @@ def test_set_addons_config_field_headers(): type(client.transport.set_addons_config), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. @@ -2920,11 +2673,14 @@ def test_set_addons_config_field_headers(): @pytest.mark.asyncio async def test_set_addons_config_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetAddonsConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -2934,7 +2690,6 @@ async def test_set_addons_config_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_addons_config(request) # Establish that the underlying gRPC stub method was called. @@ -2948,7 +2703,7 @@ async def test_set_addons_config_field_headers_async(): def test_set_addons_config_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2956,7 +2711,6 @@ def test_set_addons_config_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_addons_config( @@ -2972,20 +2726,16 @@ def test_set_addons_config_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].addons_config == cluster_service.AddonsConfig( http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True) ) def test_set_addons_config_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3003,7 +2753,9 @@ def test_set_addons_config_flattened_error(): @pytest.mark.asyncio async def test_set_addons_config_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3030,13 +2782,9 @@ async def test_set_addons_config_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].addons_config == cluster_service.AddonsConfig( http_load_balancing=cluster_service.HttpLoadBalancing(disabled=True) ) @@ -3044,7 +2792,9 @@ async def test_set_addons_config_flattened_async(): @pytest.mark.asyncio async def test_set_addons_config_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3064,7 +2814,7 @@ def test_set_locations( transport: str = "grpc", request_type=cluster_service.SetLocationsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3087,39 +2837,25 @@ def test_set_locations( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_locations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3131,7 +2867,7 @@ def test_set_locations_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3139,7 +2875,6 @@ def test_set_locations_empty_call(): client.set_locations() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest() @@ -3148,7 +2883,7 @@ async def test_set_locations_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLocationsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3173,38 +2908,25 @@ async def test_set_locations_async( end_time="end_time_value", ) ) - response = await client.set_locations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3214,17 +2936,17 @@ async def test_set_locations_async_from_dict(): def test_set_locations_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLocationsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_locations), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_locations(request) # Establish that the underlying gRPC stub method was called. @@ -3239,11 +2961,14 @@ def test_set_locations_field_headers(): @pytest.mark.asyncio async def test_set_locations_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLocationsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3251,7 +2976,6 @@ async def test_set_locations_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_locations(request) # Establish that the underlying gRPC stub method was called. @@ -3265,13 +2989,12 @@ async def test_set_locations_field_headers_async(): def test_set_locations_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_locations), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_locations( @@ -3285,18 +3008,14 @@ def test_set_locations_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].locations == ["locations_value"] def test_set_locations_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3312,7 +3031,9 @@ def test_set_locations_flattened_error(): @pytest.mark.asyncio async def test_set_locations_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_locations), "__call__") as call: @@ -3335,19 +3056,17 @@ async def test_set_locations_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].locations == ["locations_value"] @pytest.mark.asyncio async def test_set_locations_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3365,7 +3084,7 @@ def test_update_master( transport: str = "grpc", request_type=cluster_service.UpdateMasterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3388,39 +3107,25 @@ def test_update_master( start_time="start_time_value", end_time="end_time_value", ) - response = client.update_master(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3432,7 +3137,7 @@ def test_update_master_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3440,7 +3145,6 @@ def test_update_master_empty_call(): client.update_master() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest() @@ -3449,7 +3153,7 @@ async def test_update_master_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateMasterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3474,38 +3178,25 @@ async def test_update_master_async( end_time="end_time_value", ) ) - response = await client.update_master(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3515,17 +3206,17 @@ async def test_update_master_async_from_dict(): def test_update_master_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.UpdateMasterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_master), "__call__") as call: call.return_value = cluster_service.Operation() - client.update_master(request) # Establish that the underlying gRPC stub method was called. @@ -3540,11 +3231,14 @@ def test_update_master_field_headers(): @pytest.mark.asyncio async def test_update_master_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.UpdateMasterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3552,7 +3246,6 @@ async def test_update_master_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.update_master(request) # Establish that the underlying gRPC stub method was called. @@ -3566,13 +3259,12 @@ async def test_update_master_field_headers_async(): def test_update_master_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_master), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.update_master( @@ -3586,18 +3278,14 @@ def test_update_master_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].master_version == "master_version_value" def test_update_master_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3613,7 +3301,9 @@ def test_update_master_flattened_error(): @pytest.mark.asyncio async def test_update_master_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_master), "__call__") as call: @@ -3636,19 +3326,17 @@ async def test_update_master_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].master_version == "master_version_value" @pytest.mark.asyncio async def test_update_master_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3666,7 +3354,7 @@ def test_set_master_auth( transport: str = "grpc", request_type=cluster_service.SetMasterAuthRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3689,39 +3377,25 @@ def test_set_master_auth( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3733,7 +3407,7 @@ def test_set_master_auth_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3741,7 +3415,6 @@ def test_set_master_auth_empty_call(): client.set_master_auth() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest() @@ -3750,7 +3423,7 @@ async def test_set_master_auth_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetMasterAuthRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3775,38 +3448,25 @@ async def test_set_master_auth_async( end_time="end_time_value", ) ) - response = await client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3816,17 +3476,17 @@ async def test_set_master_auth_async_from_dict(): def test_set_master_auth_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetMasterAuthRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_master_auth), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. @@ -3841,11 +3501,14 @@ def test_set_master_auth_field_headers(): @pytest.mark.asyncio async def test_set_master_auth_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetMasterAuthRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -3853,7 +3516,6 @@ async def test_set_master_auth_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_master_auth(request) # Establish that the underlying gRPC stub method was called. @@ -3870,7 +3532,7 @@ def test_delete_cluster( transport: str = "grpc", request_type=cluster_service.DeleteClusterRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3893,39 +3555,25 @@ def test_delete_cluster( start_time="start_time_value", end_time="end_time_value", ) - response = client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -3937,7 +3585,7 @@ def test_delete_cluster_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3945,7 +3593,6 @@ def test_delete_cluster_empty_call(): client.delete_cluster() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest() @@ -3954,7 +3601,7 @@ async def test_delete_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteClusterRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3979,38 +3626,25 @@ async def test_delete_cluster_async( end_time="end_time_value", ) ) - response = await client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -4020,17 +3654,17 @@ async def test_delete_cluster_async_from_dict(): def test_delete_cluster_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.DeleteClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: call.return_value = cluster_service.Operation() - client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -4045,11 +3679,14 @@ def test_delete_cluster_field_headers(): @pytest.mark.asyncio async def test_delete_cluster_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.DeleteClusterRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4057,7 +3694,6 @@ async def test_delete_cluster_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.delete_cluster(request) # Establish that the underlying gRPC stub method was called. @@ -4071,13 +3707,12 @@ async def test_delete_cluster_field_headers_async(): def test_delete_cluster_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_cluster( @@ -4090,16 +3725,13 @@ def test_delete_cluster_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" def test_delete_cluster_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4114,7 +3746,9 @@ def test_delete_cluster_flattened_error(): @pytest.mark.asyncio async def test_delete_cluster_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: @@ -4136,17 +3770,16 @@ async def test_delete_cluster_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" @pytest.mark.asyncio async def test_delete_cluster_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4163,7 +3796,7 @@ def test_list_operations( transport: str = "grpc", request_type=cluster_service.ListOperationsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4176,19 +3809,15 @@ def test_list_operations( call.return_value = cluster_service.ListOperationsResponse( missing_zones=["missing_zones_value"], ) - response = client.list_operations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -4200,7 +3829,7 @@ def test_list_operations_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4208,7 +3837,6 @@ def test_list_operations_empty_call(): client.list_operations() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest() @@ -4217,7 +3845,7 @@ async def test_list_operations_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListOperationsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4232,18 +3860,15 @@ async def test_list_operations_async( missing_zones=["missing_zones_value"], ) ) - response = await client.list_operations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.ListOperationsResponse) - assert response.missing_zones == ["missing_zones_value"] @@ -4253,17 +3878,17 @@ async def test_list_operations_async_from_dict(): def test_list_operations_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListOperationsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: call.return_value = cluster_service.ListOperationsResponse() - client.list_operations(request) # Establish that the underlying gRPC stub method was called. @@ -4278,11 +3903,14 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListOperationsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4290,7 +3918,6 @@ async def test_list_operations_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListOperationsResponse() ) - await client.list_operations(request) # Establish that the underlying gRPC stub method was called. @@ -4304,13 +3931,12 @@ async def test_list_operations_field_headers_async(): def test_list_operations_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListOperationsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_operations( @@ -4321,14 +3947,12 @@ def test_list_operations_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" def test_list_operations_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4342,7 +3966,9 @@ def test_list_operations_flattened_error(): @pytest.mark.asyncio async def test_list_operations_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4362,15 +3988,15 @@ async def test_list_operations_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" @pytest.mark.asyncio async def test_list_operations_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4386,7 +4012,7 @@ def test_get_operation( transport: str = "grpc", request_type=cluster_service.GetOperationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4409,39 +4035,25 @@ def test_get_operation( start_time="start_time_value", end_time="end_time_value", ) - response = client.get_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -4453,7 +4065,7 @@ def test_get_operation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4461,7 +4073,6 @@ def test_get_operation_empty_call(): client.get_operation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest() @@ -4470,7 +4081,7 @@ async def test_get_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetOperationRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4495,38 +4106,25 @@ async def test_get_operation_async( end_time="end_time_value", ) ) - response = await client.get_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -4536,17 +4134,17 @@ async def test_get_operation_async_from_dict(): def test_get_operation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: call.return_value = cluster_service.Operation() - client.get_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4561,11 +4159,14 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -4573,7 +4174,6 @@ async def test_get_operation_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.get_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4587,13 +4187,12 @@ async def test_get_operation_field_headers_async(): def test_get_operation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_operation( @@ -4606,16 +4205,13 @@ def test_get_operation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" def test_get_operation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4630,7 +4226,9 @@ def test_get_operation_flattened_error(): @pytest.mark.asyncio async def test_get_operation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4652,17 +4250,16 @@ async def test_get_operation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" @pytest.mark.asyncio async def test_get_operation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4679,7 +4276,7 @@ def test_cancel_operation( transport: str = "grpc", request_type=cluster_service.CancelOperationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4690,13 +4287,11 @@ def test_cancel_operation( with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = None - response = client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest() # Establish that the response is the type that we expect. @@ -4711,7 +4306,7 @@ def test_cancel_operation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4719,7 +4314,6 @@ def test_cancel_operation_empty_call(): client.cancel_operation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest() @@ -4728,7 +4322,7 @@ async def test_cancel_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.CancelOperationRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4739,13 +4333,11 @@ async def test_cancel_operation_async( with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest() # Establish that the response is the type that we expect. @@ -4758,17 +4350,17 @@ async def test_cancel_operation_async_from_dict(): def test_cancel_operation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CancelOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: call.return_value = None - client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4783,17 +4375,19 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CancelOperationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. @@ -4807,13 +4401,12 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = None - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.cancel_operation( @@ -4826,16 +4419,13 @@ def test_cancel_operation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" def test_cancel_operation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4850,7 +4440,9 @@ def test_cancel_operation_flattened_error(): @pytest.mark.asyncio async def test_cancel_operation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -4870,17 +4462,16 @@ async def test_cancel_operation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].operation_id == "operation_id_value" @pytest.mark.asyncio async def test_cancel_operation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4897,7 +4488,7 @@ def test_get_server_config( transport: str = "grpc", request_type=cluster_service.GetServerConfigRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4916,27 +4507,19 @@ def test_get_server_config( valid_image_types=["valid_image_types_value"], valid_master_versions=["valid_master_versions_value"], ) - response = client.get_server_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == "default_cluster_version_value" - assert response.valid_node_versions == ["valid_node_versions_value"] - assert response.default_image_type == "default_image_type_value" - assert response.valid_image_types == ["valid_image_types_value"] - assert response.valid_master_versions == ["valid_master_versions_value"] @@ -4948,7 +4531,7 @@ def test_get_server_config_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4958,7 +4541,6 @@ def test_get_server_config_empty_call(): client.get_server_config() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest() @@ -4967,7 +4549,7 @@ async def test_get_server_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetServerConfigRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4988,26 +4570,19 @@ async def test_get_server_config_async( valid_master_versions=["valid_master_versions_value"], ) ) - response = await client.get_server_config(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.ServerConfig) - assert response.default_cluster_version == "default_cluster_version_value" - assert response.valid_node_versions == ["valid_node_versions_value"] - assert response.default_image_type == "default_image_type_value" - assert response.valid_image_types == ["valid_image_types_value"] - assert response.valid_master_versions == ["valid_master_versions_value"] @@ -5017,11 +4592,12 @@ async def test_get_server_config_async_from_dict(): def test_get_server_config_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetServerConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5029,7 +4605,6 @@ def test_get_server_config_field_headers(): type(client.transport.get_server_config), "__call__" ) as call: call.return_value = cluster_service.ServerConfig() - client.get_server_config(request) # Establish that the underlying gRPC stub method was called. @@ -5044,11 +4619,14 @@ def test_get_server_config_field_headers(): @pytest.mark.asyncio async def test_get_server_config_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetServerConfigRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5058,7 +4636,6 @@ async def test_get_server_config_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ServerConfig() ) - await client.get_server_config(request) # Establish that the underlying gRPC stub method was called. @@ -5072,7 +4649,7 @@ async def test_get_server_config_field_headers_async(): def test_get_server_config_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5080,7 +4657,6 @@ def test_get_server_config_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ServerConfig() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_server_config( @@ -5091,14 +4667,12 @@ def test_get_server_config_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" def test_get_server_config_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5112,7 +4686,9 @@ def test_get_server_config_flattened_error(): @pytest.mark.asyncio async def test_get_server_config_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5134,15 +4710,15 @@ async def test_get_server_config_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" @pytest.mark.asyncio async def test_get_server_config_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5158,7 +4734,7 @@ def test_list_node_pools( transport: str = "grpc", request_type=cluster_service.ListNodePoolsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5169,17 +4745,14 @@ def test_list_node_pools( with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListNodePoolsResponse() - response = client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.ListNodePoolsResponse) @@ -5191,7 +4764,7 @@ def test_list_node_pools_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5199,7 +4772,6 @@ def test_list_node_pools_empty_call(): client.list_node_pools() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest() @@ -5208,7 +4780,7 @@ async def test_list_node_pools_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListNodePoolsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5221,13 +4793,11 @@ async def test_list_node_pools_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListNodePoolsResponse() ) - response = await client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest() # Establish that the response is the type that we expect. @@ -5240,17 +4810,17 @@ async def test_list_node_pools_async_from_dict(): def test_list_node_pools_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListNodePoolsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: call.return_value = cluster_service.ListNodePoolsResponse() - client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. @@ -5265,11 +4835,14 @@ def test_list_node_pools_field_headers(): @pytest.mark.asyncio async def test_list_node_pools_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListNodePoolsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5277,7 +4850,6 @@ async def test_list_node_pools_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListNodePoolsResponse() ) - await client.list_node_pools(request) # Establish that the underlying gRPC stub method was called. @@ -5291,13 +4863,12 @@ async def test_list_node_pools_field_headers_async(): def test_list_node_pools_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListNodePoolsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_node_pools( @@ -5310,16 +4881,13 @@ def test_list_node_pools_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" def test_list_node_pools_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5334,7 +4902,9 @@ def test_list_node_pools_flattened_error(): @pytest.mark.asyncio async def test_list_node_pools_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: @@ -5356,17 +4926,16 @@ async def test_list_node_pools_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" @pytest.mark.asyncio async def test_list_node_pools_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5383,7 +4952,7 @@ def test_get_json_web_keys( transport: str = "grpc", request_type=cluster_service.GetJSONWebKeysRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5396,17 +4965,14 @@ def test_get_json_web_keys( ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.GetJSONWebKeysResponse() - response = client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.GetJSONWebKeysResponse) @@ -5418,7 +4984,7 @@ def test_get_json_web_keys_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5428,7 +4994,6 @@ def test_get_json_web_keys_empty_call(): client.get_json_web_keys() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest() @@ -5437,7 +5002,7 @@ async def test_get_json_web_keys_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetJSONWebKeysRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5452,13 +5017,11 @@ async def test_get_json_web_keys_async( call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.GetJSONWebKeysResponse() ) - response = await client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest() # Establish that the response is the type that we expect. @@ -5471,11 +5034,12 @@ async def test_get_json_web_keys_async_from_dict(): def test_get_json_web_keys_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetJSONWebKeysRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5483,7 +5047,6 @@ def test_get_json_web_keys_field_headers(): type(client.transport.get_json_web_keys), "__call__" ) as call: call.return_value = cluster_service.GetJSONWebKeysResponse() - client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. @@ -5498,11 +5061,14 @@ def test_get_json_web_keys_field_headers(): @pytest.mark.asyncio async def test_get_json_web_keys_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetJSONWebKeysRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5512,7 +5078,6 @@ async def test_get_json_web_keys_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.GetJSONWebKeysResponse() ) - await client.get_json_web_keys(request) # Establish that the underlying gRPC stub method was called. @@ -5529,7 +5094,7 @@ def test_get_node_pool( transport: str = "grpc", request_type=cluster_service.GetNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5550,35 +5115,23 @@ def test_get_node_pool( status_message="status_message_value", pod_ipv4_cidr_size=1856, ) - response = client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.NodePool) - assert response.name == "name_value" - assert response.initial_node_count == 1911 - assert response.locations == ["locations_value"] - assert response.self_link == "self_link_value" - assert response.version == "version_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.pod_ipv4_cidr_size == 1856 @@ -5590,7 +5143,7 @@ def test_get_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5598,7 +5151,6 @@ def test_get_node_pool_empty_call(): client.get_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest() @@ -5607,7 +5159,7 @@ async def test_get_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5630,34 +5182,23 @@ async def test_get_node_pool_async( pod_ipv4_cidr_size=1856, ) ) - response = await client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.NodePool) - assert response.name == "name_value" - assert response.initial_node_count == 1911 - assert response.locations == ["locations_value"] - assert response.self_link == "self_link_value" - assert response.version == "version_value" - assert response.instance_group_urls == ["instance_group_urls_value"] - assert response.status == cluster_service.NodePool.Status.PROVISIONING - assert response.status_message == "status_message_value" - assert response.pod_ipv4_cidr_size == 1856 @@ -5667,17 +5208,17 @@ async def test_get_node_pool_async_from_dict(): def test_get_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.GetNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: call.return_value = cluster_service.NodePool() - client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5692,11 +5233,14 @@ def test_get_node_pool_field_headers(): @pytest.mark.asyncio async def test_get_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.GetNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -5704,7 +5248,6 @@ async def test_get_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.NodePool() ) - await client.get_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5718,13 +5261,12 @@ async def test_get_node_pool_field_headers_async(): def test_get_node_pool_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.NodePool() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_node_pool( @@ -5738,18 +5280,14 @@ def test_get_node_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" def test_get_node_pool_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5765,7 +5303,9 @@ def test_get_node_pool_flattened_error(): @pytest.mark.asyncio async def test_get_node_pool_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: @@ -5788,19 +5328,17 @@ async def test_get_node_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" @pytest.mark.asyncio async def test_get_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5818,7 +5356,7 @@ def test_create_node_pool( transport: str = "grpc", request_type=cluster_service.CreateNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5841,39 +5379,25 @@ def test_create_node_pool( start_time="start_time_value", end_time="end_time_value", ) - response = client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -5885,7 +5409,7 @@ def test_create_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5893,7 +5417,6 @@ def test_create_node_pool_empty_call(): client.create_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest() @@ -5902,7 +5425,7 @@ async def test_create_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5927,38 +5450,25 @@ async def test_create_node_pool_async( end_time="end_time_value", ) ) - response = await client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -5968,17 +5478,17 @@ async def test_create_node_pool_async_from_dict(): def test_create_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CreateNodePoolRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: call.return_value = cluster_service.Operation() - client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -5993,11 +5503,14 @@ def test_create_node_pool_field_headers(): @pytest.mark.asyncio async def test_create_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CreateNodePoolRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6005,7 +5518,6 @@ async def test_create_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.create_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -6019,13 +5531,12 @@ async def test_create_node_pool_field_headers_async(): def test_create_node_pool_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_node_pool( @@ -6039,18 +5550,14 @@ def test_create_node_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool == cluster_service.NodePool(name="name_value") def test_create_node_pool_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6066,7 +5573,9 @@ def test_create_node_pool_flattened_error(): @pytest.mark.asyncio async def test_create_node_pool_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: @@ -6089,19 +5598,17 @@ async def test_create_node_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool == cluster_service.NodePool(name="name_value") @pytest.mark.asyncio async def test_create_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6119,7 +5626,7 @@ def test_delete_node_pool( transport: str = "grpc", request_type=cluster_service.DeleteNodePoolRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6142,39 +5649,25 @@ def test_delete_node_pool( start_time="start_time_value", end_time="end_time_value", ) - response = client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6186,7 +5679,7 @@ def test_delete_node_pool_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6194,7 +5687,6 @@ def test_delete_node_pool_empty_call(): client.delete_node_pool() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest() @@ -6203,7 +5695,7 @@ async def test_delete_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteNodePoolRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6228,38 +5720,25 @@ async def test_delete_node_pool_async( end_time="end_time_value", ) ) - response = await client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6269,17 +5748,17 @@ async def test_delete_node_pool_async_from_dict(): def test_delete_node_pool_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.DeleteNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: call.return_value = cluster_service.Operation() - client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -6294,11 +5773,14 @@ def test_delete_node_pool_field_headers(): @pytest.mark.asyncio async def test_delete_node_pool_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.DeleteNodePoolRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6306,7 +5788,6 @@ async def test_delete_node_pool_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.delete_node_pool(request) # Establish that the underlying gRPC stub method was called. @@ -6320,13 +5801,12 @@ async def test_delete_node_pool_field_headers_async(): def test_delete_node_pool_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_node_pool( @@ -6340,18 +5820,14 @@ def test_delete_node_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" def test_delete_node_pool_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6367,7 +5843,9 @@ def test_delete_node_pool_flattened_error(): @pytest.mark.asyncio async def test_delete_node_pool_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: @@ -6390,19 +5868,17 @@ async def test_delete_node_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" @pytest.mark.asyncio async def test_delete_node_pool_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6420,7 +5896,7 @@ def test_rollback_node_pool_upgrade( transport: str = "grpc", request_type=cluster_service.RollbackNodePoolUpgradeRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6445,39 +5921,25 @@ def test_rollback_node_pool_upgrade( start_time="start_time_value", end_time="end_time_value", ) - response = client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6489,7 +5951,7 @@ def test_rollback_node_pool_upgrade_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6499,7 +5961,6 @@ def test_rollback_node_pool_upgrade_empty_call(): client.rollback_node_pool_upgrade() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() @@ -6509,7 +5970,7 @@ async def test_rollback_node_pool_upgrade_async( request_type=cluster_service.RollbackNodePoolUpgradeRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6536,38 +5997,25 @@ async def test_rollback_node_pool_upgrade_async( end_time="end_time_value", ) ) - response = await client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6577,11 +6025,12 @@ async def test_rollback_node_pool_upgrade_async_from_dict(): def test_rollback_node_pool_upgrade_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.RollbackNodePoolUpgradeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6589,7 +6038,6 @@ def test_rollback_node_pool_upgrade_field_headers(): type(client.transport.rollback_node_pool_upgrade), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. @@ -6604,11 +6052,14 @@ def test_rollback_node_pool_upgrade_field_headers(): @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.RollbackNodePoolUpgradeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6618,7 +6069,6 @@ async def test_rollback_node_pool_upgrade_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.rollback_node_pool_upgrade(request) # Establish that the underlying gRPC stub method was called. @@ -6632,7 +6082,7 @@ async def test_rollback_node_pool_upgrade_field_headers_async(): def test_rollback_node_pool_upgrade_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6640,7 +6090,6 @@ def test_rollback_node_pool_upgrade_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.rollback_node_pool_upgrade( @@ -6654,18 +6103,14 @@ def test_rollback_node_pool_upgrade_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" def test_rollback_node_pool_upgrade_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6681,7 +6126,9 @@ def test_rollback_node_pool_upgrade_flattened_error(): @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6706,19 +6153,17 @@ async def test_rollback_node_pool_upgrade_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6736,7 +6181,7 @@ def test_set_node_pool_management( transport: str = "grpc", request_type=cluster_service.SetNodePoolManagementRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6761,39 +6206,25 @@ def test_set_node_pool_management( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6805,7 +6236,7 @@ def test_set_node_pool_management_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6815,7 +6246,6 @@ def test_set_node_pool_management_empty_call(): client.set_node_pool_management() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest() @@ -6825,7 +6255,7 @@ async def test_set_node_pool_management_async( request_type=cluster_service.SetNodePoolManagementRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6852,38 +6282,25 @@ async def test_set_node_pool_management_async( end_time="end_time_value", ) ) - response = await client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -6893,11 +6310,12 @@ async def test_set_node_pool_management_async_from_dict(): def test_set_node_pool_management_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNodePoolManagementRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6905,7 +6323,6 @@ def test_set_node_pool_management_field_headers(): type(client.transport.set_node_pool_management), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. @@ -6920,11 +6337,14 @@ def test_set_node_pool_management_field_headers(): @pytest.mark.asyncio async def test_set_node_pool_management_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNodePoolManagementRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -6934,7 +6354,6 @@ async def test_set_node_pool_management_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_node_pool_management(request) # Establish that the underlying gRPC stub method was called. @@ -6948,7 +6367,7 @@ async def test_set_node_pool_management_field_headers_async(): def test_set_node_pool_management_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6956,7 +6375,6 @@ def test_set_node_pool_management_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_node_pool_management( @@ -6971,20 +6389,15 @@ def test_set_node_pool_management_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].management == cluster_service.NodeManagement(auto_upgrade=True) def test_set_node_pool_management_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7001,7 +6414,9 @@ def test_set_node_pool_management_flattened_error(): @pytest.mark.asyncio async def test_set_node_pool_management_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7027,21 +6442,18 @@ async def test_set_node_pool_management_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].node_pool_id == "node_pool_id_value" - assert args[0].management == cluster_service.NodeManagement(auto_upgrade=True) @pytest.mark.asyncio async def test_set_node_pool_management_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7060,7 +6472,7 @@ def test_set_labels( transport: str = "grpc", request_type=cluster_service.SetLabelsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7083,39 +6495,25 @@ def test_set_labels( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_labels(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7127,7 +6525,7 @@ def test_set_labels_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7135,7 +6533,6 @@ def test_set_labels_empty_call(): client.set_labels() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest() @@ -7144,7 +6541,7 @@ async def test_set_labels_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLabelsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7169,38 +6566,25 @@ async def test_set_labels_async( end_time="end_time_value", ) ) - response = await client.set_labels(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7210,17 +6594,17 @@ async def test_set_labels_async_from_dict(): def test_set_labels_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLabelsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_labels), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_labels(request) # Establish that the underlying gRPC stub method was called. @@ -7235,11 +6619,14 @@ def test_set_labels_field_headers(): @pytest.mark.asyncio async def test_set_labels_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLabelsRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7247,7 +6634,6 @@ async def test_set_labels_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_labels(request) # Establish that the underlying gRPC stub method was called. @@ -7261,13 +6647,12 @@ async def test_set_labels_field_headers_async(): def test_set_labels_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_labels), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_labels( @@ -7282,20 +6667,15 @@ def test_set_labels_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].resource_labels == {"key_value": "value_value"} - assert args[0].label_fingerprint == "label_fingerprint_value" def test_set_labels_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7312,7 +6692,9 @@ def test_set_labels_flattened_error(): @pytest.mark.asyncio async def test_set_labels_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_labels), "__call__") as call: @@ -7336,21 +6718,18 @@ async def test_set_labels_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].resource_labels == {"key_value": "value_value"} - assert args[0].label_fingerprint == "label_fingerprint_value" @pytest.mark.asyncio async def test_set_labels_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7369,7 +6748,7 @@ def test_set_legacy_abac( transport: str = "grpc", request_type=cluster_service.SetLegacyAbacRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7392,39 +6771,25 @@ def test_set_legacy_abac( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7436,7 +6801,7 @@ def test_set_legacy_abac_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7444,7 +6809,6 @@ def test_set_legacy_abac_empty_call(): client.set_legacy_abac() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest() @@ -7453,7 +6817,7 @@ async def test_set_legacy_abac_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLegacyAbacRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7478,38 +6842,25 @@ async def test_set_legacy_abac_async( end_time="end_time_value", ) ) - response = await client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7519,17 +6870,17 @@ async def test_set_legacy_abac_async_from_dict(): def test_set_legacy_abac_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetLegacyAbacRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: call.return_value = cluster_service.Operation() - client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. @@ -7544,11 +6895,14 @@ def test_set_legacy_abac_field_headers(): @pytest.mark.asyncio async def test_set_legacy_abac_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetLegacyAbacRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7556,7 +6910,6 @@ async def test_set_legacy_abac_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_legacy_abac(request) # Establish that the underlying gRPC stub method was called. @@ -7570,13 +6923,12 @@ async def test_set_legacy_abac_field_headers_async(): def test_set_legacy_abac_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_legacy_abac( @@ -7590,18 +6942,14 @@ def test_set_legacy_abac_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].enabled == True def test_set_legacy_abac_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7617,7 +6965,9 @@ def test_set_legacy_abac_flattened_error(): @pytest.mark.asyncio async def test_set_legacy_abac_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: @@ -7640,19 +6990,17 @@ async def test_set_legacy_abac_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].enabled == True @pytest.mark.asyncio async def test_set_legacy_abac_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7670,7 +7018,7 @@ def test_start_ip_rotation( transport: str = "grpc", request_type=cluster_service.StartIPRotationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7695,39 +7043,25 @@ def test_start_ip_rotation( start_time="start_time_value", end_time="end_time_value", ) - response = client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7739,7 +7073,7 @@ def test_start_ip_rotation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7749,7 +7083,6 @@ def test_start_ip_rotation_empty_call(): client.start_ip_rotation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest() @@ -7758,7 +7091,7 @@ async def test_start_ip_rotation_async( transport: str = "grpc_asyncio", request_type=cluster_service.StartIPRotationRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -7785,38 +7118,25 @@ async def test_start_ip_rotation_async( end_time="end_time_value", ) ) - response = await client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -7826,11 +7146,12 @@ async def test_start_ip_rotation_async_from_dict(): def test_start_ip_rotation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.StartIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7838,7 +7159,6 @@ def test_start_ip_rotation_field_headers(): type(client.transport.start_ip_rotation), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -7853,11 +7173,14 @@ def test_start_ip_rotation_field_headers(): @pytest.mark.asyncio async def test_start_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.StartIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -7867,7 +7190,6 @@ async def test_start_ip_rotation_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.start_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -7881,7 +7203,7 @@ async def test_start_ip_rotation_field_headers_async(): def test_start_ip_rotation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7889,7 +7211,6 @@ def test_start_ip_rotation_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.start_ip_rotation( @@ -7902,16 +7223,13 @@ def test_start_ip_rotation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" def test_start_ip_rotation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7926,7 +7244,9 @@ def test_start_ip_rotation_flattened_error(): @pytest.mark.asyncio async def test_start_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7950,17 +7270,16 @@ async def test_start_ip_rotation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" @pytest.mark.asyncio async def test_start_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -7977,7 +7296,7 @@ def test_complete_ip_rotation( transport: str = "grpc", request_type=cluster_service.CompleteIPRotationRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8002,39 +7321,25 @@ def test_complete_ip_rotation( start_time="start_time_value", end_time="end_time_value", ) - response = client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8046,7 +7351,7 @@ def test_complete_ip_rotation_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8056,7 +7361,6 @@ def test_complete_ip_rotation_empty_call(): client.complete_ip_rotation() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest() @@ -8066,7 +7370,7 @@ async def test_complete_ip_rotation_async( request_type=cluster_service.CompleteIPRotationRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8093,38 +7397,25 @@ async def test_complete_ip_rotation_async( end_time="end_time_value", ) ) - response = await client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8134,11 +7425,12 @@ async def test_complete_ip_rotation_async_from_dict(): def test_complete_ip_rotation_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.CompleteIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8146,7 +7438,6 @@ def test_complete_ip_rotation_field_headers(): type(client.transport.complete_ip_rotation), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -8161,11 +7452,14 @@ def test_complete_ip_rotation_field_headers(): @pytest.mark.asyncio async def test_complete_ip_rotation_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.CompleteIPRotationRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8175,7 +7469,6 @@ async def test_complete_ip_rotation_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.complete_ip_rotation(request) # Establish that the underlying gRPC stub method was called. @@ -8189,7 +7482,7 @@ async def test_complete_ip_rotation_field_headers_async(): def test_complete_ip_rotation_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8197,7 +7490,6 @@ def test_complete_ip_rotation_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.complete_ip_rotation( @@ -8210,16 +7502,13 @@ def test_complete_ip_rotation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" def test_complete_ip_rotation_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8234,7 +7523,9 @@ def test_complete_ip_rotation_flattened_error(): @pytest.mark.asyncio async def test_complete_ip_rotation_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8258,17 +7549,16 @@ async def test_complete_ip_rotation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" @pytest.mark.asyncio async def test_complete_ip_rotation_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8285,7 +7575,7 @@ def test_set_node_pool_size( transport: str = "grpc", request_type=cluster_service.SetNodePoolSizeRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8310,39 +7600,25 @@ def test_set_node_pool_size( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8354,7 +7630,7 @@ def test_set_node_pool_size_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8364,7 +7640,6 @@ def test_set_node_pool_size_empty_call(): client.set_node_pool_size() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest() @@ -8373,7 +7648,7 @@ async def test_set_node_pool_size_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetNodePoolSizeRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8400,38 +7675,25 @@ async def test_set_node_pool_size_async( end_time="end_time_value", ) ) - response = await client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8441,11 +7703,12 @@ async def test_set_node_pool_size_async_from_dict(): def test_set_node_pool_size_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNodePoolSizeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8453,7 +7716,6 @@ def test_set_node_pool_size_field_headers(): type(client.transport.set_node_pool_size), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. @@ -8468,11 +7730,14 @@ def test_set_node_pool_size_field_headers(): @pytest.mark.asyncio async def test_set_node_pool_size_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNodePoolSizeRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8482,7 +7747,6 @@ async def test_set_node_pool_size_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_node_pool_size(request) # Establish that the underlying gRPC stub method was called. @@ -8499,7 +7763,7 @@ def test_set_network_policy( transport: str = "grpc", request_type=cluster_service.SetNetworkPolicyRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8524,39 +7788,25 @@ def test_set_network_policy( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8568,7 +7818,7 @@ def test_set_network_policy_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8578,7 +7828,6 @@ def test_set_network_policy_empty_call(): client.set_network_policy() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest() @@ -8588,7 +7837,7 @@ async def test_set_network_policy_async( request_type=cluster_service.SetNetworkPolicyRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8615,38 +7864,25 @@ async def test_set_network_policy_async( end_time="end_time_value", ) ) - response = await client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8656,11 +7892,12 @@ async def test_set_network_policy_async_from_dict(): def test_set_network_policy_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetNetworkPolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8668,7 +7905,6 @@ def test_set_network_policy_field_headers(): type(client.transport.set_network_policy), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. @@ -8683,11 +7919,14 @@ def test_set_network_policy_field_headers(): @pytest.mark.asyncio async def test_set_network_policy_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetNetworkPolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8697,7 +7936,6 @@ async def test_set_network_policy_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_network_policy(request) # Establish that the underlying gRPC stub method was called. @@ -8711,7 +7949,7 @@ async def test_set_network_policy_field_headers_async(): def test_set_network_policy_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8719,7 +7957,6 @@ def test_set_network_policy_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_network_policy( @@ -8735,20 +7972,16 @@ def test_set_network_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].network_policy == cluster_service.NetworkPolicy( provider=cluster_service.NetworkPolicy.Provider.CALICO ) def test_set_network_policy_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8766,7 +7999,9 @@ def test_set_network_policy_flattened_error(): @pytest.mark.asyncio async def test_set_network_policy_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8793,13 +8028,9 @@ async def test_set_network_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].network_policy == cluster_service.NetworkPolicy( provider=cluster_service.NetworkPolicy.Provider.CALICO ) @@ -8807,7 +8038,9 @@ async def test_set_network_policy_flattened_async(): @pytest.mark.asyncio async def test_set_network_policy_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -8827,7 +8060,7 @@ def test_set_maintenance_policy( transport: str = "grpc", request_type=cluster_service.SetMaintenancePolicyRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8852,39 +8085,25 @@ def test_set_maintenance_policy( start_time="start_time_value", end_time="end_time_value", ) - response = client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest() # Establish that the response is the type that we expect. - assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8896,7 +8115,7 @@ def test_set_maintenance_policy_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8906,7 +8125,6 @@ def test_set_maintenance_policy_empty_call(): client.set_maintenance_policy() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest() @@ -8916,7 +8134,7 @@ async def test_set_maintenance_policy_async( request_type=cluster_service.SetMaintenancePolicyRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -8943,38 +8161,25 @@ async def test_set_maintenance_policy_async( end_time="end_time_value", ) ) - response = await client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.Operation) - assert response.name == "name_value" - assert response.zone == "zone_value" - assert response.operation_type == cluster_service.Operation.Type.CREATE_CLUSTER - assert response.status == cluster_service.Operation.Status.PENDING - assert response.detail == "detail_value" - assert response.status_message == "status_message_value" - assert response.self_link == "self_link_value" - assert response.target_link == "target_link_value" - assert response.location == "location_value" - assert response.start_time == "start_time_value" - assert response.end_time == "end_time_value" @@ -8984,11 +8189,12 @@ async def test_set_maintenance_policy_async_from_dict(): def test_set_maintenance_policy_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.SetMaintenancePolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -8996,7 +8202,6 @@ def test_set_maintenance_policy_field_headers(): type(client.transport.set_maintenance_policy), "__call__" ) as call: call.return_value = cluster_service.Operation() - client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. @@ -9011,11 +8216,14 @@ def test_set_maintenance_policy_field_headers(): @pytest.mark.asyncio async def test_set_maintenance_policy_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.SetMaintenancePolicyRequest() + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -9025,7 +8233,6 @@ async def test_set_maintenance_policy_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.Operation() ) - await client.set_maintenance_policy(request) # Establish that the underlying gRPC stub method was called. @@ -9039,7 +8246,7 @@ async def test_set_maintenance_policy_field_headers_async(): def test_set_maintenance_policy_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9047,7 +8254,6 @@ def test_set_maintenance_policy_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.Operation() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.set_maintenance_policy( @@ -9067,13 +8273,9 @@ def test_set_maintenance_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].maintenance_policy == cluster_service.MaintenancePolicy( window=cluster_service.MaintenanceWindow( daily_maintenance_window=cluster_service.DailyMaintenanceWindow( @@ -9084,7 +8286,7 @@ def test_set_maintenance_policy_flattened(): def test_set_maintenance_policy_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9106,7 +8308,9 @@ def test_set_maintenance_policy_flattened_error(): @pytest.mark.asyncio async def test_set_maintenance_policy_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9137,13 +8341,9 @@ async def test_set_maintenance_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].zone == "zone_value" - assert args[0].cluster_id == "cluster_id_value" - assert args[0].maintenance_policy == cluster_service.MaintenancePolicy( window=cluster_service.MaintenanceWindow( daily_maintenance_window=cluster_service.DailyMaintenanceWindow( @@ -9155,7 +8355,9 @@ async def test_set_maintenance_policy_flattened_async(): @pytest.mark.asyncio async def test_set_maintenance_policy_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9179,7 +8381,7 @@ def test_list_usable_subnetworks( transport: str = "grpc", request_type=cluster_service.ListUsableSubnetworksRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -9194,19 +8396,15 @@ def test_list_usable_subnetworks( call.return_value = cluster_service.ListUsableSubnetworksResponse( next_page_token="next_page_token_value", ) - response = client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUsableSubnetworksPager) - assert response.next_page_token == "next_page_token_value" @@ -9218,7 +8416,7 @@ def test_list_usable_subnetworks_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9228,7 +8426,6 @@ def test_list_usable_subnetworks_empty_call(): client.list_usable_subnetworks() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest() @@ -9238,7 +8435,7 @@ async def test_list_usable_subnetworks_async( request_type=cluster_service.ListUsableSubnetworksRequest, ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -9255,18 +8452,15 @@ async def test_list_usable_subnetworks_async( next_page_token="next_page_token_value", ) ) - response = await client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListUsableSubnetworksAsyncPager) - assert response.next_page_token == "next_page_token_value" @@ -9276,11 +8470,12 @@ async def test_list_usable_subnetworks_async_from_dict(): def test_list_usable_subnetworks_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListUsableSubnetworksRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -9288,7 +8483,6 @@ def test_list_usable_subnetworks_field_headers(): type(client.transport.list_usable_subnetworks), "__call__" ) as call: call.return_value = cluster_service.ListUsableSubnetworksResponse() - client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. @@ -9303,11 +8497,14 @@ def test_list_usable_subnetworks_field_headers(): @pytest.mark.asyncio async def test_list_usable_subnetworks_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListUsableSubnetworksRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -9317,7 +8514,6 @@ async def test_list_usable_subnetworks_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListUsableSubnetworksResponse() ) - await client.list_usable_subnetworks(request) # Establish that the underlying gRPC stub method was called. @@ -9331,7 +8527,7 @@ async def test_list_usable_subnetworks_field_headers_async(): def test_list_usable_subnetworks_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9339,7 +8535,6 @@ def test_list_usable_subnetworks_flattened(): ) as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListUsableSubnetworksResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_usable_subnetworks(parent="parent_value",) @@ -9348,12 +8543,11 @@ def test_list_usable_subnetworks_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_usable_subnetworks_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9365,7 +8559,9 @@ def test_list_usable_subnetworks_flattened_error(): @pytest.mark.asyncio async def test_list_usable_subnetworks_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9385,13 +8581,14 @@ async def test_list_usable_subnetworks_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_usable_subnetworks_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9402,7 +8599,7 @@ async def test_list_usable_subnetworks_flattened_error_async(): def test_list_usable_subnetworks_pager(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9448,7 +8645,7 @@ def test_list_usable_subnetworks_pager(): def test_list_usable_subnetworks_pages(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9486,7 +8683,7 @@ def test_list_usable_subnetworks_pages(): @pytest.mark.asyncio async def test_list_usable_subnetworks_async_pager(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9531,7 +8728,7 @@ async def test_list_usable_subnetworks_async_pager(): @pytest.mark.asyncio async def test_list_usable_subnetworks_async_pages(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials,) + client = ClusterManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9575,7 +8772,7 @@ def test_list_locations( transport: str = "grpc", request_type=cluster_service.ListLocationsRequest ): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -9588,21 +8785,16 @@ def test_list_locations( call.return_value = cluster_service.ListLocationsResponse( next_page_token="next_page_token_value", ) - response = client.list_locations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListLocationsRequest() # Establish that the response is the type that we expect. - assert response.raw_page is response - assert isinstance(response, cluster_service.ListLocationsResponse) - assert response.next_page_token == "next_page_token_value" @@ -9614,7 +8806,7 @@ def test_list_locations_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 = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9622,7 +8814,6 @@ def test_list_locations_empty_call(): client.list_locations() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListLocationsRequest() @@ -9631,7 +8822,7 @@ async def test_list_locations_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListLocationsRequest ): client = ClusterManagerAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -9646,18 +8837,15 @@ async def test_list_locations_async( next_page_token="next_page_token_value", ) ) - response = await client.list_locations(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListLocationsRequest() # Establish that the response is the type that we expect. assert isinstance(response, cluster_service.ListLocationsResponse) - assert response.next_page_token == "next_page_token_value" @@ -9667,17 +8855,17 @@ async def test_list_locations_async_from_dict(): def test_list_locations_field_headers(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(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 = cluster_service.ListLocationsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: call.return_value = cluster_service.ListLocationsResponse() - client.list_locations(request) # Establish that the underlying gRPC stub method was called. @@ -9692,11 +8880,14 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + 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 = cluster_service.ListLocationsRequest() + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. @@ -9704,7 +8895,6 @@ async def test_list_locations_field_headers_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cluster_service.ListLocationsResponse() ) - await client.list_locations(request) # Establish that the underlying gRPC stub method was called. @@ -9718,13 +8908,12 @@ async def test_list_locations_field_headers_async(): def test_list_locations_flattened(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = cluster_service.ListLocationsResponse() - # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_locations(parent="parent_value",) @@ -9733,12 +8922,11 @@ def test_list_locations_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" def test_list_locations_flattened_error(): - client = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9750,7 +8938,9 @@ def test_list_locations_flattened_error(): @pytest.mark.asyncio async def test_list_locations_flattened_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9768,13 +8958,14 @@ async def test_list_locations_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" @pytest.mark.asyncio async def test_list_locations_flattened_error_async(): - client = ClusterManagerAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -9787,16 +8978,16 @@ async def test_list_locations_flattened_error_async(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ClusterManagerClient( - 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.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ClusterManagerClient( @@ -9806,7 +8997,7 @@ def test_credentials_transport_error(): # It is an error to provide scopes and a transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ClusterManagerClient( @@ -9817,7 +9008,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ClusterManagerClient(transport=transport) assert client.transport is transport @@ -9826,13 +9017,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ClusterManagerGrpcTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ClusterManagerGrpcAsyncIOTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -9847,23 +9038,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 = ClusterManagerClient(credentials=credentials.AnonymousCredentials(),) + client = ClusterManagerClient(credentials=ga_credentials.AnonymousCredentials(),) assert isinstance(client.transport, transports.ClusterManagerGrpcTransport,) def test_cluster_manager_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.ClusterManagerTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -9875,7 +9066,7 @@ def test_cluster_manager_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ClusterManagerTransport( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -9920,15 +9111,37 @@ def test_cluster_manager_base_transport(): getattr(transport, method)(request=object()) +@requires_google_auth_gte_1_25_0 def test_cluster_manager_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.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.ClusterManagerTransport( + 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/cloud-platform",), + quota_project_id="octopus", + ) + + +@requires_google_auth_lt_1_25_0 +def test_cluster_manager_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.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport._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.ClusterManagerTransport( credentials_file="credentials.json", quota_project_id="octopus", ) @@ -9941,19 +9154,33 @@ def test_cluster_manager_base_transport_with_credentials_file(): def test_cluster_manager_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.container_v1beta1.services.cluster_manager.transports.ClusterManagerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (credentials.AnonymousCredentials(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ClusterManagerTransport() adc.assert_called_once() +@requires_google_auth_gte_1_25_0 def test_cluster_manager_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) + ClusterManagerClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + quota_project_id=None, + ) + + +@requires_google_auth_lt_1_25_0 +def test_cluster_manager_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) ClusterManagerClient() adc.assert_called_once_with( scopes=("https://www.googleapis.com/auth/cloud-platform",), @@ -9961,20 +9188,156 @@ def test_cluster_manager_auth_adc(): ) -def test_cluster_manager_transport_auth_adc(): +@pytest.mark.parametrize( + "transport_class", + [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +@requires_google_auth_gte_1_25_0 +def test_cluster_manager_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.ClusterManagerGrpcTransport( - 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/cloud-platform",), + quota_project_id="octopus", ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +@requires_google_auth_lt_1_25_0 +def test_cluster_manager_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/cloud-platform",), quota_project_id="octopus", ) +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_gte_1_26_0 +def test_cluster_manager_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( + "container.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=["1", "2"], + default_host="container.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.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_cluster_manager_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( + "container.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.ClusterManagerGrpcTransport, grpc_helpers), + (transports.ClusterManagerGrpcAsyncIOTransport, grpc_helpers_async), + ], +) +@requires_api_core_lt_1_26_0 +def test_cluster_manager_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( + "container.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", [ @@ -9983,7 +9346,7 @@ def test_cluster_manager_transport_auth_adc(): ], ) def test_cluster_manager_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: @@ -10022,7 +9385,7 @@ def test_cluster_manager_grpc_transport_client_cert_source_for_mtls(transport_cl def test_cluster_manager_host_no_port(): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="container.googleapis.com" ), @@ -10032,7 +9395,7 @@ def test_cluster_manager_host_no_port(): def test_cluster_manager_host_with_port(): client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="container.googleapis.com:8000" ), @@ -10088,9 +9451,9 @@ def test_cluster_manager_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", @@ -10167,7 +9530,6 @@ def test_cluster_manager_transport_channel_mtls_with_adc(transport_class): def test_topic_path(): project = "squid" topic = "clam" - expected = "projects/{project}/topics/{topic}".format(project=project, topic=topic,) actual = ClusterManagerClient.topic_path(project, topic) assert expected == actual @@ -10187,7 +9549,6 @@ def test_parse_topic_path(): def test_common_billing_account_path(): billing_account = "oyster" - expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -10208,7 +9569,6 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) actual = ClusterManagerClient.common_folder_path(folder) assert expected == actual @@ -10227,7 +9587,6 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) actual = ClusterManagerClient.common_organization_path(organization) assert expected == actual @@ -10246,7 +9605,6 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) actual = ClusterManagerClient.common_project_path(project) assert expected == actual @@ -10266,7 +9624,6 @@ def test_parse_common_project_path(): def test_common_location_path(): project = "squid" location = "clam" - expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -10293,7 +9650,7 @@ def test_client_withDEFAULT_CLIENT_INFO(): transports.ClusterManagerTransport, "_prep_wrapped_messages" ) as prep: client = ClusterManagerClient( - credentials=credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -10302,6 +9659,6 @@ def test_client_withDEFAULT_CLIENT_INFO(): ) as prep: transport_class = ClusterManagerClient.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 1c468663bd59bcb529311bd5736861b332a269b3 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Fri, 14 May 2021 19:02:05 -0600 Subject: [PATCH 13/15] fix(deps): add packaging requirement (#97) 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 | 1 + testing/constraints-3.6.txt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d73c3d4d..19afb1ca 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ "google-api-core[grpc] >= 1.21.2, < 2.0.0dev", "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", "proto-plus >= 1.4.0", + "packaging >= 14.3", "libcst >= 0.2.5", ] extras = {} diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 399fa9e8..32665453 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -8,4 +8,5 @@ google-api-core==1.26.3 grpc-google-iam-v1==0.12.3 proto-plus==1.4.0 -libcst==0.2.5 \ No newline at end of file +libcst==0.2.5 +packaging==14.3 From 76d7667fe36a03736bc7a2e8182c2cb4afa65a2f 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:18:06 +0000 Subject: [PATCH 14/15] chore: new owl bot post processor docker image (#99) 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 d49860b3..864c1765 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 1bbd7878..4f00c7cf 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 cc81337cff475de93c57c5380b144fc267d9373c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 15:42:43 -0700 Subject: [PATCH 15/15] chore: release 2.4.1 (#98) 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 9505b845..459f8215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://pypi.org/project/google-cloud-container/#history +### [2.4.1](https://www.github.com/googleapis/python-container/compare/v2.4.0...v2.4.1) (2021-05-16) + + +### Bug Fixes + +* **deps:** add packaging requirement ([#97](https://www.github.com/googleapis/python-container/issues/97)) ([1c46866](https://www.github.com/googleapis/python-container/commit/1c468663bd59bcb529311bd5736861b332a269b3)) + ## [2.4.0](https://www.github.com/googleapis/python-container/compare/v2.3.1...v2.4.0) (2021-03-24) diff --git a/setup.py b/setup.py index 19afb1ca..5443de2a 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-container" description = "Google Container Engine API client library" -version = "2.4.0" +version = "2.4.1" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta'