From ffb05e8f5c5d3011576da1ab784f43abd4a830ef Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 27 Sep 2022 18:49:43 +0000 Subject: [PATCH 1/2] fix!: Fix resource annotations for Cloud Deploy to use common resource name for locations This is technically a breaking change in that it's modifying the type for a resource, but it's a fast-follow fix to the earlier broken definition. PiperOrigin-RevId: 477192133 Source-Link: https://github.com/googleapis/googleapis/commit/f252e11bdab81146c67a7de4eddec412f18cd94f Source-Link: https://github.com/googleapis/googleapis-gen/commit/34ca7cd6da0ac5920011c8bda01e8bc32b7da444 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzRjYTdjZDZkYTBhYzU5MjAwMTFjOGJkYTAxZThiYzMyYjdkYTQ0NCJ9 --- owl-bot-staging/v1/.coveragerc | 17 + owl-bot-staging/v1/.flake8 | 33 + owl-bot-staging/v1/MANIFEST.in | 2 + owl-bot-staging/v1/README.rst | 49 + owl-bot-staging/v1/docs/conf.py | 376 + .../v1/docs/deploy_v1/cloud_deploy.rst | 10 + .../v1/docs/deploy_v1/services.rst | 6 + owl-bot-staging/v1/docs/deploy_v1/types.rst | 7 + owl-bot-staging/v1/docs/index.rst | 7 + .../v1/google/cloud/deploy/__init__.py | 163 + .../v1/google/cloud/deploy/py.typed | 2 + .../v1/google/cloud/deploy_v1/__init__.py | 164 + .../cloud/deploy_v1/gapic_metadata.json | 243 + .../v1/google/cloud/deploy_v1/py.typed | 2 + .../cloud/deploy_v1/services/__init__.py | 15 + .../services/cloud_deploy/__init__.py | 22 + .../services/cloud_deploy/async_client.py | 3471 +++++++ .../deploy_v1/services/cloud_deploy/client.py | 3681 +++++++ .../deploy_v1/services/cloud_deploy/pagers.py | 623 ++ .../cloud_deploy/transports/__init__.py | 33 + .../services/cloud_deploy/transports/base.py | 607 ++ .../services/cloud_deploy/transports/grpc.py | 1026 ++ .../cloud_deploy/transports/grpc_asyncio.py | 1025 ++ .../google/cloud/deploy_v1/types/__init__.py | 171 + .../cloud/deploy_v1/types/cloud_deploy.py | 2862 ++++++ .../deliverypipeline_notification_payload.py | 61 + .../types/jobrun_notification_payload.py | 84 + .../google/cloud/deploy_v1/types/log_enums.py | 36 + .../types/release_notification_payload.py | 60 + .../deploy_v1/types/release_render_payload.py | 50 + .../types/rollout_notification_payload.py | 78 + .../types/target_notification_payload.py | 60 + owl-bot-staging/v1/mypy.ini | 3 + owl-bot-staging/v1/noxfile.py | 179 + ...ated_cloud_deploy_abandon_release_async.py | 52 + ...rated_cloud_deploy_abandon_release_sync.py | 52 + ...ated_cloud_deploy_approve_rollout_async.py | 53 + ...rated_cloud_deploy_approve_rollout_sync.py | 53 + ...d_deploy_create_delivery_pipeline_async.py | 57 + ...ud_deploy_create_delivery_pipeline_sync.py | 57 + ...rated_cloud_deploy_create_release_async.py | 57 + ...erated_cloud_deploy_create_release_sync.py | 57 + ...rated_cloud_deploy_create_rollout_async.py | 61 + ...erated_cloud_deploy_create_rollout_sync.py | 61 + ...erated_cloud_deploy_create_target_async.py | 57 + ...nerated_cloud_deploy_create_target_sync.py | 57 + ...d_deploy_delete_delivery_pipeline_async.py | 56 + ...ud_deploy_delete_delivery_pipeline_sync.py | 56 + ...erated_cloud_deploy_delete_target_async.py | 56 + ...nerated_cloud_deploy_delete_target_sync.py | 56 + ...generated_cloud_deploy_get_config_async.py | 52 + ..._generated_cloud_deploy_get_config_sync.py | 52 + ...loud_deploy_get_delivery_pipeline_async.py | 52 + ...cloud_deploy_get_delivery_pipeline_sync.py | 52 + ...enerated_cloud_deploy_get_job_run_async.py | 52 + ...generated_cloud_deploy_get_job_run_sync.py | 52 + ...enerated_cloud_deploy_get_release_async.py | 52 + ...generated_cloud_deploy_get_release_sync.py | 52 + ...enerated_cloud_deploy_get_rollout_async.py | 52 + ...generated_cloud_deploy_get_rollout_sync.py | 52 + ...generated_cloud_deploy_get_target_async.py | 52 + ..._generated_cloud_deploy_get_target_sync.py | 52 + ...ud_deploy_list_delivery_pipelines_async.py | 53 + ...oud_deploy_list_delivery_pipelines_sync.py | 53 + ...erated_cloud_deploy_list_job_runs_async.py | 53 + ...nerated_cloud_deploy_list_job_runs_sync.py | 53 + ...erated_cloud_deploy_list_releases_async.py | 53 + ...nerated_cloud_deploy_list_releases_sync.py | 53 + ...erated_cloud_deploy_list_rollouts_async.py | 53 + ...nerated_cloud_deploy_list_rollouts_sync.py | 53 + ...nerated_cloud_deploy_list_targets_async.py | 53 + ...enerated_cloud_deploy_list_targets_sync.py | 53 + ..._generated_cloud_deploy_retry_job_async.py | 54 + ...1_generated_cloud_deploy_retry_job_sync.py | 54 + ...d_deploy_update_delivery_pipeline_async.py | 55 + ...ud_deploy_update_delivery_pipeline_sync.py | 55 + ...erated_cloud_deploy_update_target_async.py | 55 + ...nerated_cloud_deploy_update_target_sync.py | 55 + .../snippet_metadata_deploy_v1.json | 3652 +++++++ .../v1/scripts/fixup_deploy_v1_keywords.py | 197 + owl-bot-staging/v1/setup.py | 59 + owl-bot-staging/v1/tests/__init__.py | 16 + owl-bot-staging/v1/tests/unit/__init__.py | 16 + .../v1/tests/unit/gapic/__init__.py | 16 + .../v1/tests/unit/gapic/deploy_v1/__init__.py | 16 + .../unit/gapic/deploy_v1/test_cloud_deploy.py | 8966 +++++++++++++++++ 86 files changed, 30546 insertions(+) create mode 100644 owl-bot-staging/v1/.coveragerc create mode 100644 owl-bot-staging/v1/.flake8 create mode 100644 owl-bot-staging/v1/MANIFEST.in create mode 100644 owl-bot-staging/v1/README.rst create mode 100644 owl-bot-staging/v1/docs/conf.py create mode 100644 owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst create mode 100644 owl-bot-staging/v1/docs/deploy_v1/services.rst create mode 100644 owl-bot-staging/v1/docs/deploy_v1/types.rst create mode 100644 owl-bot-staging/v1/docs/index.rst create mode 100644 owl-bot-staging/v1/google/cloud/deploy/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py create mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py create mode 100644 owl-bot-staging/v1/mypy.ini create mode 100644 owl-bot-staging/v1/noxfile.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json create mode 100644 owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py create mode 100644 owl-bot-staging/v1/setup.py create mode 100644 owl-bot-staging/v1/tests/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc new file mode 100644 index 0000000..c88d6f1 --- /dev/null +++ b/owl-bot-staging/v1/.coveragerc @@ -0,0 +1,17 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/deploy/__init__.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ + # Ignore pkg_resources exceptions. + # This is added at the module level as a safeguard for if someone + # generates the code and tries to run it without pip installing. This + # makes it virtually impossible to test properly. + except pkg_resources.DistributionNotFound diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 new file mode 100644 index 0000000..29227d4 --- /dev/null +++ b/owl-bot-staging/v1/.flake8 @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by synthtool. DO NOT EDIT! +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + **/services/** + **/types/** + *_pb2.py + + # Standard linting exemptions. + **/.nox/** + __pycache__, + .git, + *.pyc, + conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in new file mode 100644 index 0000000..20b11ef --- /dev/null +++ b/owl-bot-staging/v1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/deploy *.py +recursive-include google/cloud/deploy_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst new file mode 100644 index 0000000..d94adc9 --- /dev/null +++ b/owl-bot-staging/v1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Deploy API +================================================= + +Quick Start +----------- + +In order to use this library, you first need to go through the following steps: + +1. `Select or create a Cloud Platform project.`_ +2. `Enable billing for your project.`_ +3. Enable the Google Cloud Deploy API. +4. `Setup Authentication.`_ + +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html + +Installation +~~~~~~~~~~~~ + +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to +create isolated Python environments. The basic problem it addresses is one of +dependencies and versions, and indirectly permissions. + +With `virtualenv`_, it's possible to install this library without needing system +install permissions, and without clashing with the installed system +dependencies. + +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Mac/Linux +^^^^^^^^^ + +.. code-block:: console + + python3 -m venv + source /bin/activate + /bin/pip install /path/to/library + + +Windows +^^^^^^^ + +.. code-block:: console + + python3 -m venv + \Scripts\activate + \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py new file mode 100644 index 0000000..0d255f3 --- /dev/null +++ b/owl-bot-staging/v1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# google-cloud-deploy documentation build configuration file +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import shlex + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("..")) + +__version__ = "0.1.0" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = "4.0.1" + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", +] + +# autodoc/autosummary flags +autoclass_content = "both" +autodoc_default_flags = ["members"] +autosummary_generate = True + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# Allow markdown includes (so releases.md can include CHANGLEOG.md) +# http://www.sphinx-doc.org/en/master/markdown.html +source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The root toctree document. +root_doc = "index" + +# General information about the project. +project = u"google-cloud-deploy" +copyright = u"2022, Google, LLC" +author = u"Google APIs" # TODO: autogenerate this bit + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The full version, including alpha/beta/rc tags. +release = __version__ +# The short X.Y version. +version = ".".join(release.split(".")[0:2]) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "alabaster" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "description": "Google Cloud Client Libraries for Python", + "github_user": "googleapis", + "github_repo": "google-cloud-python", + "github_banner": True, + "font_family": "'Roboto', Georgia, sans", + "head_font_family": "'Roboto', Georgia, serif", + "code_font_family": "'Roboto Mono', 'Consolas', monospace", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = "google-cloud-deploy-doc" + +# -- Options for warnings ------------------------------------------------------ + + +suppress_warnings = [ + # Temporarily suppress this to avoid "more than one target found for + # cross-reference" warning, which are intractable for us to avoid while in + # a mono-repo. + # See https://github.com/sphinx-doc/sphinx/blob + # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 + "ref.python" +] + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', + # Latex figure (float) alignment + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + root_doc, + "google-cloud-deploy.tex", + u"google-cloud-deploy Documentation", + author, + "manual", + ) +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + root_doc, + "google-cloud-deploy", + u"Google Cloud Deploy Documentation", + [author], + 1, + ) +] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + root_doc, + "google-cloud-deploy", + u"google-cloud-deploy Documentation", + author, + "google-cloud-deploy", + "GAPIC library for Google Cloud Deploy API", + "APIs", + ) +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("http://python.readthedocs.org/en/latest/", None), + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), + "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), + "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://requests.kennethreitz.org/en/stable/", None), + "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), + "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), +} + + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst b/owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst new file mode 100644 index 0000000..be06f16 --- /dev/null +++ b/owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst @@ -0,0 +1,10 @@ +CloudDeploy +----------------------------- + +.. automodule:: google.cloud.deploy_v1.services.cloud_deploy + :members: + :inherited-members: + +.. automodule:: google.cloud.deploy_v1.services.cloud_deploy.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/v1/docs/deploy_v1/services.rst b/owl-bot-staging/v1/docs/deploy_v1/services.rst new file mode 100644 index 0000000..f6dc89a --- /dev/null +++ b/owl-bot-staging/v1/docs/deploy_v1/services.rst @@ -0,0 +1,6 @@ +Services for Google Cloud Deploy v1 API +======================================= +.. toctree:: + :maxdepth: 2 + + cloud_deploy diff --git a/owl-bot-staging/v1/docs/deploy_v1/types.rst b/owl-bot-staging/v1/docs/deploy_v1/types.rst new file mode 100644 index 0000000..82f8c0c --- /dev/null +++ b/owl-bot-staging/v1/docs/deploy_v1/types.rst @@ -0,0 +1,7 @@ +Types for Google Cloud Deploy v1 API +==================================== + +.. automodule:: google.cloud.deploy_v1.types + :members: + :undoc-members: + :show-inheritance: diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst new file mode 100644 index 0000000..356c19e --- /dev/null +++ b/owl-bot-staging/v1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + deploy_v1/services + deploy_v1/types diff --git a/owl-bot-staging/v1/google/cloud/deploy/__init__.py b/owl-bot-staging/v1/google/cloud/deploy/__init__.py new file mode 100644 index 0000000..cffa5a3 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy/__init__.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from google.cloud.deploy_v1.services.cloud_deploy.client import CloudDeployClient +from google.cloud.deploy_v1.services.cloud_deploy.async_client import CloudDeployAsyncClient + +from google.cloud.deploy_v1.types.cloud_deploy import AbandonReleaseRequest +from google.cloud.deploy_v1.types.cloud_deploy import AbandonReleaseResponse +from google.cloud.deploy_v1.types.cloud_deploy import AnthosCluster +from google.cloud.deploy_v1.types.cloud_deploy import ApproveRolloutRequest +from google.cloud.deploy_v1.types.cloud_deploy import ApproveRolloutResponse +from google.cloud.deploy_v1.types.cloud_deploy import BuildArtifact +from google.cloud.deploy_v1.types.cloud_deploy import CloudRunLocation +from google.cloud.deploy_v1.types.cloud_deploy import CloudRunMetadata +from google.cloud.deploy_v1.types.cloud_deploy import Config +from google.cloud.deploy_v1.types.cloud_deploy import CreateDeliveryPipelineRequest +from google.cloud.deploy_v1.types.cloud_deploy import CreateReleaseRequest +from google.cloud.deploy_v1.types.cloud_deploy import CreateRolloutRequest +from google.cloud.deploy_v1.types.cloud_deploy import CreateTargetRequest +from google.cloud.deploy_v1.types.cloud_deploy import DefaultPool +from google.cloud.deploy_v1.types.cloud_deploy import DeleteDeliveryPipelineRequest +from google.cloud.deploy_v1.types.cloud_deploy import DeleteTargetRequest +from google.cloud.deploy_v1.types.cloud_deploy import DeliveryPipeline +from google.cloud.deploy_v1.types.cloud_deploy import DeployJob +from google.cloud.deploy_v1.types.cloud_deploy import DeployJobRun +from google.cloud.deploy_v1.types.cloud_deploy import DeployJobRunMetadata +from google.cloud.deploy_v1.types.cloud_deploy import DeploymentJobs +from google.cloud.deploy_v1.types.cloud_deploy import ExecutionConfig +from google.cloud.deploy_v1.types.cloud_deploy import GetConfigRequest +from google.cloud.deploy_v1.types.cloud_deploy import GetDeliveryPipelineRequest +from google.cloud.deploy_v1.types.cloud_deploy import GetJobRunRequest +from google.cloud.deploy_v1.types.cloud_deploy import GetReleaseRequest +from google.cloud.deploy_v1.types.cloud_deploy import GetRolloutRequest +from google.cloud.deploy_v1.types.cloud_deploy import GetTargetRequest +from google.cloud.deploy_v1.types.cloud_deploy import GkeCluster +from google.cloud.deploy_v1.types.cloud_deploy import Job +from google.cloud.deploy_v1.types.cloud_deploy import JobRun +from google.cloud.deploy_v1.types.cloud_deploy import ListDeliveryPipelinesRequest +from google.cloud.deploy_v1.types.cloud_deploy import ListDeliveryPipelinesResponse +from google.cloud.deploy_v1.types.cloud_deploy import ListJobRunsRequest +from google.cloud.deploy_v1.types.cloud_deploy import ListJobRunsResponse +from google.cloud.deploy_v1.types.cloud_deploy import ListReleasesRequest +from google.cloud.deploy_v1.types.cloud_deploy import ListReleasesResponse +from google.cloud.deploy_v1.types.cloud_deploy import ListRolloutsRequest +from google.cloud.deploy_v1.types.cloud_deploy import ListRolloutsResponse +from google.cloud.deploy_v1.types.cloud_deploy import ListTargetsRequest +from google.cloud.deploy_v1.types.cloud_deploy import ListTargetsResponse +from google.cloud.deploy_v1.types.cloud_deploy import Metadata +from google.cloud.deploy_v1.types.cloud_deploy import OperationMetadata +from google.cloud.deploy_v1.types.cloud_deploy import Phase +from google.cloud.deploy_v1.types.cloud_deploy import PipelineCondition +from google.cloud.deploy_v1.types.cloud_deploy import PipelineReadyCondition +from google.cloud.deploy_v1.types.cloud_deploy import PrivatePool +from google.cloud.deploy_v1.types.cloud_deploy import Release +from google.cloud.deploy_v1.types.cloud_deploy import RetryJobRequest +from google.cloud.deploy_v1.types.cloud_deploy import RetryJobResponse +from google.cloud.deploy_v1.types.cloud_deploy import Rollout +from google.cloud.deploy_v1.types.cloud_deploy import SerialPipeline +from google.cloud.deploy_v1.types.cloud_deploy import SkaffoldVersion +from google.cloud.deploy_v1.types.cloud_deploy import Stage +from google.cloud.deploy_v1.types.cloud_deploy import Standard +from google.cloud.deploy_v1.types.cloud_deploy import Strategy +from google.cloud.deploy_v1.types.cloud_deploy import Target +from google.cloud.deploy_v1.types.cloud_deploy import TargetArtifact +from google.cloud.deploy_v1.types.cloud_deploy import TargetsPresentCondition +from google.cloud.deploy_v1.types.cloud_deploy import UpdateDeliveryPipelineRequest +from google.cloud.deploy_v1.types.cloud_deploy import UpdateTargetRequest +from google.cloud.deploy_v1.types.cloud_deploy import VerifyJob +from google.cloud.deploy_v1.types.cloud_deploy import VerifyJobRun +from google.cloud.deploy_v1.types.deliverypipeline_notification_payload import DeliveryPipelineNotificationEvent +from google.cloud.deploy_v1.types.jobrun_notification_payload import JobRunNotificationEvent +from google.cloud.deploy_v1.types.log_enums import Type +from google.cloud.deploy_v1.types.release_notification_payload import ReleaseNotificationEvent +from google.cloud.deploy_v1.types.release_render_payload import ReleaseRenderEvent +from google.cloud.deploy_v1.types.rollout_notification_payload import RolloutNotificationEvent +from google.cloud.deploy_v1.types.target_notification_payload import TargetNotificationEvent + +__all__ = ('CloudDeployClient', + 'CloudDeployAsyncClient', + 'AbandonReleaseRequest', + 'AbandonReleaseResponse', + 'AnthosCluster', + 'ApproveRolloutRequest', + 'ApproveRolloutResponse', + 'BuildArtifact', + 'CloudRunLocation', + 'CloudRunMetadata', + 'Config', + 'CreateDeliveryPipelineRequest', + 'CreateReleaseRequest', + 'CreateRolloutRequest', + 'CreateTargetRequest', + 'DefaultPool', + 'DeleteDeliveryPipelineRequest', + 'DeleteTargetRequest', + 'DeliveryPipeline', + 'DeployJob', + 'DeployJobRun', + 'DeployJobRunMetadata', + 'DeploymentJobs', + 'ExecutionConfig', + 'GetConfigRequest', + 'GetDeliveryPipelineRequest', + 'GetJobRunRequest', + 'GetReleaseRequest', + 'GetRolloutRequest', + 'GetTargetRequest', + 'GkeCluster', + 'Job', + 'JobRun', + 'ListDeliveryPipelinesRequest', + 'ListDeliveryPipelinesResponse', + 'ListJobRunsRequest', + 'ListJobRunsResponse', + 'ListReleasesRequest', + 'ListReleasesResponse', + 'ListRolloutsRequest', + 'ListRolloutsResponse', + 'ListTargetsRequest', + 'ListTargetsResponse', + 'Metadata', + 'OperationMetadata', + 'Phase', + 'PipelineCondition', + 'PipelineReadyCondition', + 'PrivatePool', + 'Release', + 'RetryJobRequest', + 'RetryJobResponse', + 'Rollout', + 'SerialPipeline', + 'SkaffoldVersion', + 'Stage', + 'Standard', + 'Strategy', + 'Target', + 'TargetArtifact', + 'TargetsPresentCondition', + 'UpdateDeliveryPipelineRequest', + 'UpdateTargetRequest', + 'VerifyJob', + 'VerifyJobRun', + 'DeliveryPipelineNotificationEvent', + 'JobRunNotificationEvent', + 'Type', + 'ReleaseNotificationEvent', + 'ReleaseRenderEvent', + 'RolloutNotificationEvent', + 'TargetNotificationEvent', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy/py.typed b/owl-bot-staging/v1/google/cloud/deploy/py.typed new file mode 100644 index 0000000..56a532f --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-deploy package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py new file mode 100644 index 0000000..4b22423 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from .services.cloud_deploy import CloudDeployClient +from .services.cloud_deploy import CloudDeployAsyncClient + +from .types.cloud_deploy import AbandonReleaseRequest +from .types.cloud_deploy import AbandonReleaseResponse +from .types.cloud_deploy import AnthosCluster +from .types.cloud_deploy import ApproveRolloutRequest +from .types.cloud_deploy import ApproveRolloutResponse +from .types.cloud_deploy import BuildArtifact +from .types.cloud_deploy import CloudRunLocation +from .types.cloud_deploy import CloudRunMetadata +from .types.cloud_deploy import Config +from .types.cloud_deploy import CreateDeliveryPipelineRequest +from .types.cloud_deploy import CreateReleaseRequest +from .types.cloud_deploy import CreateRolloutRequest +from .types.cloud_deploy import CreateTargetRequest +from .types.cloud_deploy import DefaultPool +from .types.cloud_deploy import DeleteDeliveryPipelineRequest +from .types.cloud_deploy import DeleteTargetRequest +from .types.cloud_deploy import DeliveryPipeline +from .types.cloud_deploy import DeployJob +from .types.cloud_deploy import DeployJobRun +from .types.cloud_deploy import DeployJobRunMetadata +from .types.cloud_deploy import DeploymentJobs +from .types.cloud_deploy import ExecutionConfig +from .types.cloud_deploy import GetConfigRequest +from .types.cloud_deploy import GetDeliveryPipelineRequest +from .types.cloud_deploy import GetJobRunRequest +from .types.cloud_deploy import GetReleaseRequest +from .types.cloud_deploy import GetRolloutRequest +from .types.cloud_deploy import GetTargetRequest +from .types.cloud_deploy import GkeCluster +from .types.cloud_deploy import Job +from .types.cloud_deploy import JobRun +from .types.cloud_deploy import ListDeliveryPipelinesRequest +from .types.cloud_deploy import ListDeliveryPipelinesResponse +from .types.cloud_deploy import ListJobRunsRequest +from .types.cloud_deploy import ListJobRunsResponse +from .types.cloud_deploy import ListReleasesRequest +from .types.cloud_deploy import ListReleasesResponse +from .types.cloud_deploy import ListRolloutsRequest +from .types.cloud_deploy import ListRolloutsResponse +from .types.cloud_deploy import ListTargetsRequest +from .types.cloud_deploy import ListTargetsResponse +from .types.cloud_deploy import Metadata +from .types.cloud_deploy import OperationMetadata +from .types.cloud_deploy import Phase +from .types.cloud_deploy import PipelineCondition +from .types.cloud_deploy import PipelineReadyCondition +from .types.cloud_deploy import PrivatePool +from .types.cloud_deploy import Release +from .types.cloud_deploy import RetryJobRequest +from .types.cloud_deploy import RetryJobResponse +from .types.cloud_deploy import Rollout +from .types.cloud_deploy import SerialPipeline +from .types.cloud_deploy import SkaffoldVersion +from .types.cloud_deploy import Stage +from .types.cloud_deploy import Standard +from .types.cloud_deploy import Strategy +from .types.cloud_deploy import Target +from .types.cloud_deploy import TargetArtifact +from .types.cloud_deploy import TargetsPresentCondition +from .types.cloud_deploy import UpdateDeliveryPipelineRequest +from .types.cloud_deploy import UpdateTargetRequest +from .types.cloud_deploy import VerifyJob +from .types.cloud_deploy import VerifyJobRun +from .types.deliverypipeline_notification_payload import DeliveryPipelineNotificationEvent +from .types.jobrun_notification_payload import JobRunNotificationEvent +from .types.log_enums import Type +from .types.release_notification_payload import ReleaseNotificationEvent +from .types.release_render_payload import ReleaseRenderEvent +from .types.rollout_notification_payload import RolloutNotificationEvent +from .types.target_notification_payload import TargetNotificationEvent + +__all__ = ( + 'CloudDeployAsyncClient', +'AbandonReleaseRequest', +'AbandonReleaseResponse', +'AnthosCluster', +'ApproveRolloutRequest', +'ApproveRolloutResponse', +'BuildArtifact', +'CloudDeployClient', +'CloudRunLocation', +'CloudRunMetadata', +'Config', +'CreateDeliveryPipelineRequest', +'CreateReleaseRequest', +'CreateRolloutRequest', +'CreateTargetRequest', +'DefaultPool', +'DeleteDeliveryPipelineRequest', +'DeleteTargetRequest', +'DeliveryPipeline', +'DeliveryPipelineNotificationEvent', +'DeployJob', +'DeployJobRun', +'DeployJobRunMetadata', +'DeploymentJobs', +'ExecutionConfig', +'GetConfigRequest', +'GetDeliveryPipelineRequest', +'GetJobRunRequest', +'GetReleaseRequest', +'GetRolloutRequest', +'GetTargetRequest', +'GkeCluster', +'Job', +'JobRun', +'JobRunNotificationEvent', +'ListDeliveryPipelinesRequest', +'ListDeliveryPipelinesResponse', +'ListJobRunsRequest', +'ListJobRunsResponse', +'ListReleasesRequest', +'ListReleasesResponse', +'ListRolloutsRequest', +'ListRolloutsResponse', +'ListTargetsRequest', +'ListTargetsResponse', +'Metadata', +'OperationMetadata', +'Phase', +'PipelineCondition', +'PipelineReadyCondition', +'PrivatePool', +'Release', +'ReleaseNotificationEvent', +'ReleaseRenderEvent', +'RetryJobRequest', +'RetryJobResponse', +'Rollout', +'RolloutNotificationEvent', +'SerialPipeline', +'SkaffoldVersion', +'Stage', +'Standard', +'Strategy', +'Target', +'TargetArtifact', +'TargetNotificationEvent', +'TargetsPresentCondition', +'Type', +'UpdateDeliveryPipelineRequest', +'UpdateTargetRequest', +'VerifyJob', +'VerifyJobRun', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json new file mode 100644 index 0000000..92f86fe --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json @@ -0,0 +1,243 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.deploy_v1", + "protoPackage": "google.cloud.deploy.v1", + "schema": "1.0", + "services": { + "CloudDeploy": { + "clients": { + "grpc": { + "libraryClient": "CloudDeployClient", + "rpcs": { + "AbandonRelease": { + "methods": [ + "abandon_release" + ] + }, + "ApproveRollout": { + "methods": [ + "approve_rollout" + ] + }, + "CreateDeliveryPipeline": { + "methods": [ + "create_delivery_pipeline" + ] + }, + "CreateRelease": { + "methods": [ + "create_release" + ] + }, + "CreateRollout": { + "methods": [ + "create_rollout" + ] + }, + "CreateTarget": { + "methods": [ + "create_target" + ] + }, + "DeleteDeliveryPipeline": { + "methods": [ + "delete_delivery_pipeline" + ] + }, + "DeleteTarget": { + "methods": [ + "delete_target" + ] + }, + "GetConfig": { + "methods": [ + "get_config" + ] + }, + "GetDeliveryPipeline": { + "methods": [ + "get_delivery_pipeline" + ] + }, + "GetJobRun": { + "methods": [ + "get_job_run" + ] + }, + "GetRelease": { + "methods": [ + "get_release" + ] + }, + "GetRollout": { + "methods": [ + "get_rollout" + ] + }, + "GetTarget": { + "methods": [ + "get_target" + ] + }, + "ListDeliveryPipelines": { + "methods": [ + "list_delivery_pipelines" + ] + }, + "ListJobRuns": { + "methods": [ + "list_job_runs" + ] + }, + "ListReleases": { + "methods": [ + "list_releases" + ] + }, + "ListRollouts": { + "methods": [ + "list_rollouts" + ] + }, + "ListTargets": { + "methods": [ + "list_targets" + ] + }, + "RetryJob": { + "methods": [ + "retry_job" + ] + }, + "UpdateDeliveryPipeline": { + "methods": [ + "update_delivery_pipeline" + ] + }, + "UpdateTarget": { + "methods": [ + "update_target" + ] + } + } + }, + "grpc-async": { + "libraryClient": "CloudDeployAsyncClient", + "rpcs": { + "AbandonRelease": { + "methods": [ + "abandon_release" + ] + }, + "ApproveRollout": { + "methods": [ + "approve_rollout" + ] + }, + "CreateDeliveryPipeline": { + "methods": [ + "create_delivery_pipeline" + ] + }, + "CreateRelease": { + "methods": [ + "create_release" + ] + }, + "CreateRollout": { + "methods": [ + "create_rollout" + ] + }, + "CreateTarget": { + "methods": [ + "create_target" + ] + }, + "DeleteDeliveryPipeline": { + "methods": [ + "delete_delivery_pipeline" + ] + }, + "DeleteTarget": { + "methods": [ + "delete_target" + ] + }, + "GetConfig": { + "methods": [ + "get_config" + ] + }, + "GetDeliveryPipeline": { + "methods": [ + "get_delivery_pipeline" + ] + }, + "GetJobRun": { + "methods": [ + "get_job_run" + ] + }, + "GetRelease": { + "methods": [ + "get_release" + ] + }, + "GetRollout": { + "methods": [ + "get_rollout" + ] + }, + "GetTarget": { + "methods": [ + "get_target" + ] + }, + "ListDeliveryPipelines": { + "methods": [ + "list_delivery_pipelines" + ] + }, + "ListJobRuns": { + "methods": [ + "list_job_runs" + ] + }, + "ListReleases": { + "methods": [ + "list_releases" + ] + }, + "ListRollouts": { + "methods": [ + "list_rollouts" + ] + }, + "ListTargets": { + "methods": [ + "list_targets" + ] + }, + "RetryJob": { + "methods": [ + "retry_job" + ] + }, + "UpdateDeliveryPipeline": { + "methods": [ + "update_delivery_pipeline" + ] + }, + "UpdateTarget": { + "methods": [ + "update_target" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/py.typed b/owl-bot-staging/v1/google/cloud/deploy_v1/py.typed new file mode 100644 index 0000000..56a532f --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-deploy package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py new file mode 100644 index 0000000..e8e1c38 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py new file mode 100644 index 0000000..f9ab42c --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .client import CloudDeployClient +from .async_client import CloudDeployAsyncClient + +__all__ = ( + 'CloudDeployClient', + 'CloudDeployAsyncClient', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py new file mode 100644 index 0000000..1a1e8f4 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py @@ -0,0 +1,3471 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import functools +import re +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.deploy_v1.services.cloud_deploy import pagers +from google.cloud.deploy_v1.types import cloud_deploy +from google.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from .transports.base import CloudDeployTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import CloudDeployGrpcAsyncIOTransport +from .client import CloudDeployClient + + +class CloudDeployAsyncClient: + """CloudDeploy service creates and manages Continuous Delivery + operations on Google Cloud Platform via Skaffold + (https://skaffold.dev). + """ + + _client: CloudDeployClient + + DEFAULT_ENDPOINT = CloudDeployClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CloudDeployClient.DEFAULT_MTLS_ENDPOINT + + build_path = staticmethod(CloudDeployClient.build_path) + parse_build_path = staticmethod(CloudDeployClient.parse_build_path) + cluster_path = staticmethod(CloudDeployClient.cluster_path) + parse_cluster_path = staticmethod(CloudDeployClient.parse_cluster_path) + config_path = staticmethod(CloudDeployClient.config_path) + parse_config_path = staticmethod(CloudDeployClient.parse_config_path) + delivery_pipeline_path = staticmethod(CloudDeployClient.delivery_pipeline_path) + parse_delivery_pipeline_path = staticmethod(CloudDeployClient.parse_delivery_pipeline_path) + job_run_path = staticmethod(CloudDeployClient.job_run_path) + parse_job_run_path = staticmethod(CloudDeployClient.parse_job_run_path) + membership_path = staticmethod(CloudDeployClient.membership_path) + parse_membership_path = staticmethod(CloudDeployClient.parse_membership_path) + release_path = staticmethod(CloudDeployClient.release_path) + parse_release_path = staticmethod(CloudDeployClient.parse_release_path) + rollout_path = staticmethod(CloudDeployClient.rollout_path) + parse_rollout_path = staticmethod(CloudDeployClient.parse_rollout_path) + target_path = staticmethod(CloudDeployClient.target_path) + parse_target_path = staticmethod(CloudDeployClient.parse_target_path) + worker_pool_path = staticmethod(CloudDeployClient.worker_pool_path) + parse_worker_pool_path = staticmethod(CloudDeployClient.parse_worker_pool_path) + common_billing_account_path = staticmethod(CloudDeployClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod(CloudDeployClient.parse_common_billing_account_path) + common_folder_path = staticmethod(CloudDeployClient.common_folder_path) + parse_common_folder_path = staticmethod(CloudDeployClient.parse_common_folder_path) + common_organization_path = staticmethod(CloudDeployClient.common_organization_path) + parse_common_organization_path = staticmethod(CloudDeployClient.parse_common_organization_path) + common_project_path = staticmethod(CloudDeployClient.common_project_path) + parse_common_project_path = staticmethod(CloudDeployClient.parse_common_project_path) + common_location_path = staticmethod(CloudDeployClient.common_location_path) + parse_common_location_path = staticmethod(CloudDeployClient.parse_common_location_path) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudDeployAsyncClient: The constructed client. + """ + return CloudDeployClient.from_service_account_info.__func__(CloudDeployAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudDeployAsyncClient: The constructed client. + """ + return CloudDeployClient.from_service_account_file.__func__(CloudDeployAsyncClient, filename, *args, **kwargs) # type: ignore + + from_service_account_json = from_service_account_file + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return CloudDeployClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> CloudDeployTransport: + """Returns the transport used by the client instance. + + Returns: + CloudDeployTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial(type(CloudDeployClient).get_transport_class, type(CloudDeployClient)) + + def __init__(self, *, + credentials: ga_credentials.Credentials = None, + transport: Union[str, CloudDeployTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cloud deploy client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CloudDeployTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + self._client = CloudDeployClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + async def list_delivery_pipelines(self, + request: Union[cloud_deploy.ListDeliveryPipelinesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListDeliveryPipelinesAsyncPager: + r"""Lists DeliveryPipelines in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_list_delivery_pipelines(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListDeliveryPipelinesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_delivery_pipelines(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest, dict]): + The request object. The request object for + `ListDeliveryPipelines`. + parent (:class:`str`): + Required. The parent, which owns this collection of + pipelines. Format must be + projects/{project_id}/locations/{location_name}. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesAsyncPager: + The response object from ListDeliveryPipelines. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.ListDeliveryPipelinesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_delivery_pipelines, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListDeliveryPipelinesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_delivery_pipeline(self, + request: Union[cloud_deploy.GetDeliveryPipelineRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.DeliveryPipeline: + r"""Gets details of a single DeliveryPipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_get_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + response = await client.get_delivery_pipeline(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetDeliveryPipelineRequest, dict]): + The request object. The request object for + `GetDeliveryPipeline` + name (:class:`str`): + Required. Name of the ``DeliveryPipeline``. Format must + be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.DeliveryPipeline: + A DeliveryPipeline resource in the Google Cloud Deploy + API. + + A DeliveryPipeline defines a pipeline through which a + Skaffold configuration can progress. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.GetDeliveryPipelineRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_delivery_pipeline, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_delivery_pipeline(self, + request: Union[cloud_deploy.CreateDeliveryPipelineRequest, dict] = None, + *, + parent: str = None, + delivery_pipeline: cloud_deploy.DeliveryPipeline = None, + delivery_pipeline_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a new DeliveryPipeline in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_create_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.CreateDeliveryPipelineRequest( + parent="parent_value", + delivery_pipeline_id="delivery_pipeline_id_value", + ) + + # Make the request + operation = client.create_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest, dict]): + The request object. The request object for + `CreateDeliveryPipeline`. + parent (:class:`str`): + Required. The parent collection in which the + ``DeliveryPipeline`` should be created. Format should be + projects/{project_id}/locations/{location_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + delivery_pipeline (:class:`google.cloud.deploy_v1.types.DeliveryPipeline`): + Required. The ``DeliveryPipeline`` to create. + This corresponds to the ``delivery_pipeline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + delivery_pipeline_id (:class:`str`): + Required. ID of the ``DeliveryPipeline``. + This corresponds to the ``delivery_pipeline_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A + DeliveryPipeline resource in the Google Cloud Deploy + API. + + A DeliveryPipeline defines a pipeline through which a + Skaffold configuration can progress. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, delivery_pipeline, delivery_pipeline_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.CreateDeliveryPipelineRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if delivery_pipeline is not None: + request.delivery_pipeline = delivery_pipeline + if delivery_pipeline_id is not None: + request.delivery_pipeline_id = delivery_pipeline_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_delivery_pipeline, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloud_deploy.DeliveryPipeline, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_delivery_pipeline(self, + request: Union[cloud_deploy.UpdateDeliveryPipelineRequest, dict] = None, + *, + delivery_pipeline: cloud_deploy.DeliveryPipeline = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates the parameters of a single DeliveryPipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_update_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateDeliveryPipelineRequest( + ) + + # Make the request + operation = client.update_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest, dict]): + The request object. The request object for + `UpdateDeliveryPipeline`. + delivery_pipeline (:class:`google.cloud.deploy_v1.types.DeliveryPipeline`): + Required. The ``DeliveryPipeline`` to update. + This corresponds to the ``delivery_pipeline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. Field mask is used to specify the fields to be + overwritten in the ``DeliveryPipeline`` resource by the + update. The fields specified in the update_mask are + relative to the resource, not the full request. A field + will be overwritten if it is in the mask. If the user + does not provide a mask then all fields will be + overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A + DeliveryPipeline resource in the Google Cloud Deploy + API. + + A DeliveryPipeline defines a pipeline through which a + Skaffold configuration can progress. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([delivery_pipeline, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.UpdateDeliveryPipelineRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if delivery_pipeline is not None: + request.delivery_pipeline = delivery_pipeline + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_delivery_pipeline, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("delivery_pipeline.name", request.delivery_pipeline.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloud_deploy.DeliveryPipeline, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_delivery_pipeline(self, + request: Union[cloud_deploy.DeleteDeliveryPipelineRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes a single DeliveryPipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_delete_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest, dict]): + The request object. The request object for + `DeleteDeliveryPipeline`. + name (:class:`str`): + Required. The name of the ``DeliveryPipeline`` to + delete. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.DeleteDeliveryPipelineRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_delivery_pipeline, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_targets(self, + request: Union[cloud_deploy.ListTargetsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTargetsAsyncPager: + r"""Lists Targets in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_list_targets(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListTargetsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_targets(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListTargetsRequest, dict]): + The request object. The request object for + `ListTargets`. + parent (:class:`str`): + Required. The parent, which owns this collection of + targets. Format must be + projects/{project_id}/locations/{location_name}. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsAsyncPager: + The response object from ListTargets. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.ListTargetsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_targets, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListTargetsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_target(self, + request: Union[cloud_deploy.GetTargetRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Target: + r"""Gets details of a single Target. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_get_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetTargetRequest( + name="name_value", + ) + + # Make the request + response = await client.get_target(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetTargetRequest, dict]): + The request object. The request object for `GetTarget`. + name (:class:`str`): + Required. Name of the ``Target``. Format must be + projects/{project_id}/locations/{location_name}/targets/{target_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Target: + A Target resource in the Google Cloud Deploy API. + + A Target defines a location to which a Skaffold + configuration can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.GetTargetRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_target, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_target(self, + request: Union[cloud_deploy.CreateTargetRequest, dict] = None, + *, + parent: str = None, + target: cloud_deploy.Target = None, + target_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a new Target in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_create_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.CreateTargetRequest( + parent="parent_value", + target_id="target_id_value", + ) + + # Make the request + operation = client.create_target(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateTargetRequest, dict]): + The request object. The request object for + `CreateTarget`. + parent (:class:`str`): + Required. The parent collection in which the ``Target`` + should be created. Format should be + projects/{project_id}/locations/{location_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + target (:class:`google.cloud.deploy_v1.types.Target`): + Required. The ``Target`` to create. + This corresponds to the ``target`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + target_id (:class:`str`): + Required. ID of the ``Target``. + This corresponds to the ``target_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Target` A Target + resource in the Google Cloud Deploy API. + + A Target defines a location to which a Skaffold + configuration can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, target, target_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.CreateTargetRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if target is not None: + request.target = target + if target_id is not None: + request.target_id = target_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_target, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloud_deploy.Target, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_target(self, + request: Union[cloud_deploy.UpdateTargetRequest, dict] = None, + *, + target: cloud_deploy.Target = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates the parameters of a single Target. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_update_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateTargetRequest( + ) + + # Make the request + operation = client.update_target(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.UpdateTargetRequest, dict]): + The request object. The request object for + `UpdateTarget`. + target (:class:`google.cloud.deploy_v1.types.Target`): + Required. The ``Target`` to update. + This corresponds to the ``target`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. Field mask is used to specify the fields to be + overwritten in the Target resource by the update. The + fields specified in the update_mask are relative to the + resource, not the full request. A field will be + overwritten if it is in the mask. If the user does not + provide a mask then all fields will be overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Target` A Target + resource in the Google Cloud Deploy API. + + A Target defines a location to which a Skaffold + configuration can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([target, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.UpdateTargetRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if target is not None: + request.target = target + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_target, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("target.name", request.target.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloud_deploy.Target, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_target(self, + request: Union[cloud_deploy.DeleteTargetRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes a single Target. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_delete_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteTargetRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_target(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.DeleteTargetRequest, dict]): + The request object. The request object for + `DeleteTarget`. + name (:class:`str`): + Required. The name of the ``Target`` to delete. Format + should be + projects/{project_id}/locations/{location_name}/targets/{target_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.DeleteTargetRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_target, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_releases(self, + request: Union[cloud_deploy.ListReleasesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReleasesAsyncPager: + r"""Lists Releases in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_list_releases(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListReleasesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_releases(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListReleasesRequest, dict]): + The request object. The request object for + `ListReleases`. + parent (:class:`str`): + Required. The ``DeliveryPipeline`` which owns this + collection of ``Release`` objects. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesAsyncPager: + The response object from ListReleases. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.ListReleasesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_releases, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListReleasesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_release(self, + request: Union[cloud_deploy.GetReleaseRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Release: + r"""Gets details of a single Release. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_get_release(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetReleaseRequest( + name="name_value", + ) + + # Make the request + response = await client.get_release(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetReleaseRequest, dict]): + The request object. The request object for `GetRelease`. + name (:class:`str`): + Required. Name of the ``Release``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Release: + A Release resource in the Google Cloud Deploy API. + + A Release defines a specific Skaffold configuration + instance that can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.GetReleaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_release, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_release(self, + request: Union[cloud_deploy.CreateReleaseRequest, dict] = None, + *, + parent: str = None, + release: cloud_deploy.Release = None, + release_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a new Release in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_create_release(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.CreateReleaseRequest( + parent="parent_value", + release_id="release_id_value", + ) + + # Make the request + operation = client.create_release(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateReleaseRequest, dict]): + The request object. The request object for + `CreateRelease`, + parent (:class:`str`): + Required. The parent collection in which the ``Release`` + should be created. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + release (:class:`google.cloud.deploy_v1.types.Release`): + Required. The ``Release`` to create. + This corresponds to the ``release`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + release_id (:class:`str`): + Required. ID of the ``Release``. + This corresponds to the ``release_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Release` A Release + resource in the Google Cloud Deploy API. + + A Release defines a specific Skaffold configuration + instance that can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, release, release_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.CreateReleaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if release is not None: + request.release = release + if release_id is not None: + request.release_id = release_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_release, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloud_deploy.Release, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def abandon_release(self, + request: Union[cloud_deploy.AbandonReleaseRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.AbandonReleaseResponse: + r"""Abandons a Release in the Delivery Pipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_abandon_release(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.AbandonReleaseRequest( + name="name_value", + ) + + # Make the request + response = await client.abandon_release(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.AbandonReleaseRequest, dict]): + The request object. The request object used by + `AbandonRelease`. + name (:class:`str`): + Required. Name of the Release. Format + is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.AbandonReleaseResponse: + The response object for AbandonRelease. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.AbandonReleaseRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.abandon_release, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def approve_rollout(self, + request: Union[cloud_deploy.ApproveRolloutRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.ApproveRolloutResponse: + r"""Approves a Rollout. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_approve_rollout(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ApproveRolloutRequest( + name="name_value", + approved=True, + ) + + # Make the request + response = await client.approve_rollout(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ApproveRolloutRequest, dict]): + The request object. The request object used by + `ApproveRollout`. + name (:class:`str`): + Required. Name of the Rollout. Format + is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}/rollouts/{rollout}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.ApproveRolloutResponse: + The response object from ApproveRollout. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.ApproveRolloutRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.approve_rollout, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_rollouts(self, + request: Union[cloud_deploy.ListRolloutsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListRolloutsAsyncPager: + r"""Lists Rollouts in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_list_rollouts(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListRolloutsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_rollouts(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListRolloutsRequest, dict]): + The request object. ListRolloutsRequest is the request + object used by `ListRollouts`. + parent (:class:`str`): + Required. The ``Release`` which owns this collection of + ``Rollout`` objects. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsAsyncPager: + ListRolloutsResponse is the response object reutrned by + ListRollouts. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.ListRolloutsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_rollouts, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListRolloutsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_rollout(self, + request: Union[cloud_deploy.GetRolloutRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Rollout: + r"""Gets details of a single Rollout. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_get_rollout(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetRolloutRequest( + name="name_value", + ) + + # Make the request + response = await client.get_rollout(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetRolloutRequest, dict]): + The request object. GetRolloutRequest is the request + object used by `GetRollout`. + name (:class:`str`): + Required. Name of the ``Rollout``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Rollout: + A Rollout resource in the Google Cloud Deploy API. + + A Rollout contains information around a specific + deployment to a Target. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.GetRolloutRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_rollout, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_rollout(self, + request: Union[cloud_deploy.CreateRolloutRequest, dict] = None, + *, + parent: str = None, + rollout: cloud_deploy.Rollout = None, + rollout_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a new Rollout in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_create_rollout(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + rollout = deploy_v1.Rollout() + rollout.target_id = "target_id_value" + + request = deploy_v1.CreateRolloutRequest( + parent="parent_value", + rollout_id="rollout_id_value", + rollout=rollout, + ) + + # Make the request + operation = client.create_rollout(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateRolloutRequest, dict]): + The request object. CreateRolloutRequest is the request + object used by `CreateRollout`. + parent (:class:`str`): + Required. The parent collection in which the ``Rollout`` + should be created. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + rollout (:class:`google.cloud.deploy_v1.types.Rollout`): + Required. The ``Rollout`` to create. + This corresponds to the ``rollout`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + rollout_id (:class:`str`): + Required. ID of the ``Rollout``. + This corresponds to the ``rollout_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Rollout` A Rollout + resource in the Google Cloud Deploy API. + + A Rollout contains information around a specific + deployment to a Target. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, rollout, rollout_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.CreateRolloutRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if rollout is not None: + request.rollout = rollout + if rollout_id is not None: + request.rollout_id = rollout_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_rollout, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloud_deploy.Rollout, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + async def retry_job(self, + request: Union[cloud_deploy.RetryJobRequest, dict] = None, + *, + rollout: str = None, + phase_id: str = None, + job_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.RetryJobResponse: + r"""Retries the specified Job in a Rollout. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_retry_job(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.RetryJobRequest( + rollout="rollout_value", + phase_id="phase_id_value", + job_id="job_id_value", + ) + + # Make the request + response = await client.retry_job(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.RetryJobRequest, dict]): + The request object. RetryJobRequest is the request + object used by `RetryJob`. + rollout (:class:`str`): + Required. Name of the Rollout. Format + is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}/rollouts/{rollout}. + + This corresponds to the ``rollout`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + phase_id (:class:`str`): + Required. The phase ID the Job to + retry belongs to. + + This corresponds to the ``phase_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + job_id (:class:`str`): + Required. The job ID for the Job to + retry. + + This corresponds to the ``job_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.RetryJobResponse: + The response object from 'RetryJob'. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([rollout, phase_id, job_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.RetryJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if rollout is not None: + request.rollout = rollout + if phase_id is not None: + request.phase_id = phase_id + if job_id is not None: + request.job_id = job_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.retry_job, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("rollout", request.rollout), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_job_runs(self, + request: Union[cloud_deploy.ListJobRunsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListJobRunsAsyncPager: + r"""Lists JobRuns in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_list_job_runs(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListJobRunsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_job_runs(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListJobRunsRequest, dict]): + The request object. ListJobRunsRequest is the request + object used by `ListJobRuns`. + parent (:class:`str`): + Required. The ``Rollout`` which owns this collection of + ``JobRun`` objects. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsAsyncPager: + ListJobRunsResponse is the response object returned by + ListJobRuns. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.ListJobRunsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_job_runs, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListJobRunsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_job_run(self, + request: Union[cloud_deploy.GetJobRunRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.JobRun: + r"""Gets details of a single JobRun. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_get_job_run(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetJobRunRequest( + name="name_value", + ) + + # Make the request + response = await client.get_job_run(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetJobRunRequest, dict]): + The request object. GetJobRunRequest is the request + object used by `GetJobRun`. + name (:class:`str`): + Required. Name of the ``JobRun``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.JobRun: + A JobRun resource in the Google Cloud Deploy API. + + A JobRun contains information of a single Rollout job + evaluation. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.GetJobRunRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_job_run, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_config(self, + request: Union[cloud_deploy.GetConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Config: + r"""Gets the configuration for a location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + async def sample_get_config(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetConfigRequest, dict]): + The request object. Request to get a configuration. + name (:class:`str`): + Required. Name of requested + configuration. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Config: + Service-wide configuration. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = cloud_deploy.GetConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_config, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_operations( + self, + request: operations_pb2.ListOperationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_operation( + self, + request: operations_pb2.GetOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_operation( + self, + request: operations_pb2.DeleteOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def cancel_operation( + self, + request: operations_pb2.CancelOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def set_iam_policy( + self, + request: iam_policy_pb2.SetIamPolicyRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Sets the IAM access control policy on the specified function. + + Replaces any existing policy. + + Args: + request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`): + The request object. Request message for `SetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # Create or coerce a protobuf request object. + + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.SetIamPolicyRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.set_iam_policy, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request.resource),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_iam_policy( + self, + request: iam_policy_pb2.GetIamPolicyRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Gets the IAM access control policy for a function. + + Returns an empty policy if the function exists and does not have a + policy set. + + Args: + request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`): + The request object. Request message for `GetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if + any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # Create or coerce a protobuf request object. + + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.GetIamPolicyRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.get_iam_policy, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request.resource),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def test_iam_permissions( + self, + request: iam_policy_pb2.TestIamPermissionsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Tests the specified IAM permissions against the IAM access control + policy for a function. + + If the function does not exist, this will return an empty set + of permissions, not a NOT_FOUND error. + + Args: + request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`): + The request object. Request message for + `TestIamPermissions` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.iam_policy_pb2.TestIamPermissionsResponse: + Response message for ``TestIamPermissions`` method. + """ + # Create or coerce a protobuf request object. + + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.TestIamPermissionsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.test_iam_permissions, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request.resource),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_location( + self, + request: locations_pb2.GetLocationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.Location: + r"""Gets information about a location. + + Args: + request (:class:`~.location_pb2.GetLocationRequest`): + The request object. Request message for + `GetLocation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.Location: + Location object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.GetLocationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.get_location, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_locations( + self, + request: locations_pb2.ListLocationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.ListLocationsResponse: + r"""Lists information about the supported locations for this service. + + Args: + request (:class:`~.location_pb2.ListLocationsRequest`): + The request object. Request message for + `ListLocations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.ListLocationsResponse: + Response message for ``ListLocations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.ListLocationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.list_locations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-deploy", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ( + "CloudDeployAsyncClient", +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py new file mode 100644 index 0000000..90eb766 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py @@ -0,0 +1,3681 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.deploy_v1.services.cloud_deploy import pagers +from google.cloud.deploy_v1.types import cloud_deploy +from google.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from .transports.base import CloudDeployTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import CloudDeployGrpcTransport +from .transports.grpc_asyncio import CloudDeployGrpcAsyncIOTransport + + +class CloudDeployClientMeta(type): + """Metaclass for the CloudDeploy client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + _transport_registry = OrderedDict() # type: Dict[str, Type[CloudDeployTransport]] + _transport_registry["grpc"] = CloudDeployGrpcTransport + _transport_registry["grpc_asyncio"] = CloudDeployGrpcAsyncIOTransport + + def get_transport_class(cls, + label: str = None, + ) -> Type[CloudDeployTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class CloudDeployClient(metaclass=CloudDeployClientMeta): + """CloudDeploy service creates and manages Continuous Delivery + operations on Google Cloud Platform via Skaffold + (https://skaffold.dev). + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "clouddeploy.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudDeployClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudDeployClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file( + filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> CloudDeployTransport: + """Returns the transport used by the client instance. + + Returns: + CloudDeployTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def build_path(project: str,location: str,build: str,) -> str: + """Returns a fully-qualified build string.""" + return "projects/{project}/locations/{location}/builds/{build}".format(project=project, location=location, build=build, ) + + @staticmethod + def parse_build_path(path: str) -> Dict[str,str]: + """Parses a build path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/builds/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def cluster_path(project: str,location: str,cluster: str,) -> str: + """Returns a fully-qualified cluster string.""" + return "projects/{project}/locations/{location}/clusters/{cluster}".format(project=project, location=location, cluster=cluster, ) + + @staticmethod + def parse_cluster_path(path: str) -> Dict[str,str]: + """Parses a cluster path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/clusters/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def config_path(project: str,location: str,) -> str: + """Returns a fully-qualified config string.""" + return "projects/{project}/locations/{location}/config".format(project=project, location=location, ) + + @staticmethod + def parse_config_path(path: str) -> Dict[str,str]: + """Parses a config path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/config$", path) + return m.groupdict() if m else {} + + @staticmethod + def delivery_pipeline_path(project: str,location: str,delivery_pipeline: str,) -> str: + """Returns a fully-qualified delivery_pipeline string.""" + return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, ) + + @staticmethod + def parse_delivery_pipeline_path(path: str) -> Dict[str,str]: + """Parses a delivery_pipeline path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def job_run_path(project: str,location: str,delivery_pipeline: str,release: str,rollout: str,job_run: str,) -> str: + """Returns a fully-qualified job_run string.""" + return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, job_run=job_run, ) + + @staticmethod + def parse_job_run_path(path: str) -> Dict[str,str]: + """Parses a job_run path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)/releases/(?P.+?)/rollouts/(?P.+?)/jobRuns/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def membership_path(project: str,location: str,membership: str,) -> str: + """Returns a fully-qualified membership string.""" + return "projects/{project}/locations/{location}/memberships/{membership}".format(project=project, location=location, membership=membership, ) + + @staticmethod + def parse_membership_path(path: str) -> Dict[str,str]: + """Parses a membership path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/memberships/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def release_path(project: str,location: str,delivery_pipeline: str,release: str,) -> str: + """Returns a fully-qualified release string.""" + return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, ) + + @staticmethod + def parse_release_path(path: str) -> Dict[str,str]: + """Parses a release path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)/releases/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def rollout_path(project: str,location: str,delivery_pipeline: str,release: str,rollout: str,) -> str: + """Returns a fully-qualified rollout string.""" + return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, ) + + @staticmethod + def parse_rollout_path(path: str) -> Dict[str,str]: + """Parses a rollout path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)/releases/(?P.+?)/rollouts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def target_path(project: str,location: str,target: str,) -> str: + """Returns a fully-qualified target string.""" + return "projects/{project}/locations/{location}/targets/{target}".format(project=project, location=location, target=target, ) + + @staticmethod + def parse_target_path(path: str) -> Dict[str,str]: + """Parses a target path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/targets/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def worker_pool_path(project: str,location: str,worker_pool: str,) -> str: + """Returns a fully-qualified worker_pool string.""" + return "projects/{project}/locations/{location}/workerPools/{worker_pool}".format(project=project, location=location, worker_pool=worker_pool, ) + + @staticmethod + def parse_worker_pool_path(path: str) -> Dict[str,str]: + """Parses a worker_pool path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/workerPools/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str, ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str,str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str, ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder, ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str,str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str, ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization, ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str,str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str, ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format(project=project, ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str,str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str, ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format(project=project, location=location, ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str,str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, CloudDeployTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cloud deploy client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, CloudDeployTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError("client_options.api_key and credentials are mutually exclusive") + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, CloudDeployTransport): + # transport is a CloudDeployTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): + credentials = google.auth._default.get_api_key_credentials(api_key_value) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=client_options.api_audience, + ) + + def list_delivery_pipelines(self, + request: Union[cloud_deploy.ListDeliveryPipelinesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListDeliveryPipelinesPager: + r"""Lists DeliveryPipelines in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_list_delivery_pipelines(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListDeliveryPipelinesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_delivery_pipelines(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest, dict]): + The request object. The request object for + `ListDeliveryPipelines`. + parent (str): + Required. The parent, which owns this collection of + pipelines. Format must be + projects/{project_id}/locations/{location_name}. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesPager: + The response object from ListDeliveryPipelines. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.ListDeliveryPipelinesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.ListDeliveryPipelinesRequest): + request = cloud_deploy.ListDeliveryPipelinesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_delivery_pipelines] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListDeliveryPipelinesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_delivery_pipeline(self, + request: Union[cloud_deploy.GetDeliveryPipelineRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.DeliveryPipeline: + r"""Gets details of a single DeliveryPipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_get_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + response = client.get_delivery_pipeline(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetDeliveryPipelineRequest, dict]): + The request object. The request object for + `GetDeliveryPipeline` + name (str): + Required. Name of the ``DeliveryPipeline``. Format must + be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.DeliveryPipeline: + A DeliveryPipeline resource in the Google Cloud Deploy + API. + + A DeliveryPipeline defines a pipeline through which a + Skaffold configuration can progress. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.GetDeliveryPipelineRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.GetDeliveryPipelineRequest): + request = cloud_deploy.GetDeliveryPipelineRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_delivery_pipeline] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_delivery_pipeline(self, + request: Union[cloud_deploy.CreateDeliveryPipelineRequest, dict] = None, + *, + parent: str = None, + delivery_pipeline: cloud_deploy.DeliveryPipeline = None, + delivery_pipeline_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a new DeliveryPipeline in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_create_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.CreateDeliveryPipelineRequest( + parent="parent_value", + delivery_pipeline_id="delivery_pipeline_id_value", + ) + + # Make the request + operation = client.create_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest, dict]): + The request object. The request object for + `CreateDeliveryPipeline`. + parent (str): + Required. The parent collection in which the + ``DeliveryPipeline`` should be created. Format should be + projects/{project_id}/locations/{location_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): + Required. The ``DeliveryPipeline`` to create. + This corresponds to the ``delivery_pipeline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + delivery_pipeline_id (str): + Required. ID of the ``DeliveryPipeline``. + This corresponds to the ``delivery_pipeline_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A + DeliveryPipeline resource in the Google Cloud Deploy + API. + + A DeliveryPipeline defines a pipeline through which a + Skaffold configuration can progress. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, delivery_pipeline, delivery_pipeline_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.CreateDeliveryPipelineRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.CreateDeliveryPipelineRequest): + request = cloud_deploy.CreateDeliveryPipelineRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if delivery_pipeline is not None: + request.delivery_pipeline = delivery_pipeline + if delivery_pipeline_id is not None: + request.delivery_pipeline_id = delivery_pipeline_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_delivery_pipeline] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + cloud_deploy.DeliveryPipeline, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_delivery_pipeline(self, + request: Union[cloud_deploy.UpdateDeliveryPipelineRequest, dict] = None, + *, + delivery_pipeline: cloud_deploy.DeliveryPipeline = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates the parameters of a single DeliveryPipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_update_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateDeliveryPipelineRequest( + ) + + # Make the request + operation = client.update_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest, dict]): + The request object. The request object for + `UpdateDeliveryPipeline`. + delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): + Required. The ``DeliveryPipeline`` to update. + This corresponds to the ``delivery_pipeline`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. Field mask is used to specify the fields to be + overwritten in the ``DeliveryPipeline`` resource by the + update. The fields specified in the update_mask are + relative to the resource, not the full request. A field + will be overwritten if it is in the mask. If the user + does not provide a mask then all fields will be + overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A + DeliveryPipeline resource in the Google Cloud Deploy + API. + + A DeliveryPipeline defines a pipeline through which a + Skaffold configuration can progress. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([delivery_pipeline, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.UpdateDeliveryPipelineRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.UpdateDeliveryPipelineRequest): + request = cloud_deploy.UpdateDeliveryPipelineRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if delivery_pipeline is not None: + request.delivery_pipeline = delivery_pipeline + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_delivery_pipeline] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("delivery_pipeline.name", request.delivery_pipeline.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + cloud_deploy.DeliveryPipeline, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_delivery_pipeline(self, + request: Union[cloud_deploy.DeleteDeliveryPipelineRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes a single DeliveryPipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_delete_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest, dict]): + The request object. The request object for + `DeleteDeliveryPipeline`. + name (str): + Required. The name of the ``DeliveryPipeline`` to + delete. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.DeleteDeliveryPipelineRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.DeleteDeliveryPipelineRequest): + request = cloud_deploy.DeleteDeliveryPipelineRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_delivery_pipeline] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def list_targets(self, + request: Union[cloud_deploy.ListTargetsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTargetsPager: + r"""Lists Targets in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_list_targets(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListTargetsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_targets(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListTargetsRequest, dict]): + The request object. The request object for + `ListTargets`. + parent (str): + Required. The parent, which owns this collection of + targets. Format must be + projects/{project_id}/locations/{location_name}. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsPager: + The response object from ListTargets. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.ListTargetsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.ListTargetsRequest): + request = cloud_deploy.ListTargetsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_targets] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListTargetsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_target(self, + request: Union[cloud_deploy.GetTargetRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Target: + r"""Gets details of a single Target. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_get_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetTargetRequest( + name="name_value", + ) + + # Make the request + response = client.get_target(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetTargetRequest, dict]): + The request object. The request object for `GetTarget`. + name (str): + Required. Name of the ``Target``. Format must be + projects/{project_id}/locations/{location_name}/targets/{target_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Target: + A Target resource in the Google Cloud Deploy API. + + A Target defines a location to which a Skaffold + configuration can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.GetTargetRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.GetTargetRequest): + request = cloud_deploy.GetTargetRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_target] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_target(self, + request: Union[cloud_deploy.CreateTargetRequest, dict] = None, + *, + parent: str = None, + target: cloud_deploy.Target = None, + target_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a new Target in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_create_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.CreateTargetRequest( + parent="parent_value", + target_id="target_id_value", + ) + + # Make the request + operation = client.create_target(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateTargetRequest, dict]): + The request object. The request object for + `CreateTarget`. + parent (str): + Required. The parent collection in which the ``Target`` + should be created. Format should be + projects/{project_id}/locations/{location_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + target (google.cloud.deploy_v1.types.Target): + Required. The ``Target`` to create. + This corresponds to the ``target`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + target_id (str): + Required. ID of the ``Target``. + This corresponds to the ``target_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Target` A Target + resource in the Google Cloud Deploy API. + + A Target defines a location to which a Skaffold + configuration can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, target, target_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.CreateTargetRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.CreateTargetRequest): + request = cloud_deploy.CreateTargetRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if target is not None: + request.target = target + if target_id is not None: + request.target_id = target_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_target] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + cloud_deploy.Target, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_target(self, + request: Union[cloud_deploy.UpdateTargetRequest, dict] = None, + *, + target: cloud_deploy.Target = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates the parameters of a single Target. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_update_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateTargetRequest( + ) + + # Make the request + operation = client.update_target(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.UpdateTargetRequest, dict]): + The request object. The request object for + `UpdateTarget`. + target (google.cloud.deploy_v1.types.Target): + Required. The ``Target`` to update. + This corresponds to the ``target`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. Field mask is used to specify the fields to be + overwritten in the Target resource by the update. The + fields specified in the update_mask are relative to the + resource, not the full request. A field will be + overwritten if it is in the mask. If the user does not + provide a mask then all fields will be overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Target` A Target + resource in the Google Cloud Deploy API. + + A Target defines a location to which a Skaffold + configuration can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([target, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.UpdateTargetRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.UpdateTargetRequest): + request = cloud_deploy.UpdateTargetRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if target is not None: + request.target = target + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_target] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("target.name", request.target.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + cloud_deploy.Target, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_target(self, + request: Union[cloud_deploy.DeleteTargetRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes a single Target. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_delete_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteTargetRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_target(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.DeleteTargetRequest, dict]): + The request object. The request object for + `DeleteTarget`. + name (str): + Required. The name of the ``Target`` to delete. Format + should be + projects/{project_id}/locations/{location_name}/targets/{target_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.DeleteTargetRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.DeleteTargetRequest): + request = cloud_deploy.DeleteTargetRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_target] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def list_releases(self, + request: Union[cloud_deploy.ListReleasesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReleasesPager: + r"""Lists Releases in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_list_releases(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListReleasesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_releases(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListReleasesRequest, dict]): + The request object. The request object for + `ListReleases`. + parent (str): + Required. The ``DeliveryPipeline`` which owns this + collection of ``Release`` objects. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesPager: + The response object from ListReleases. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.ListReleasesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.ListReleasesRequest): + request = cloud_deploy.ListReleasesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_releases] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListReleasesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_release(self, + request: Union[cloud_deploy.GetReleaseRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Release: + r"""Gets details of a single Release. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_get_release(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetReleaseRequest( + name="name_value", + ) + + # Make the request + response = client.get_release(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetReleaseRequest, dict]): + The request object. The request object for `GetRelease`. + name (str): + Required. Name of the ``Release``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Release: + A Release resource in the Google Cloud Deploy API. + + A Release defines a specific Skaffold configuration + instance that can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.GetReleaseRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.GetReleaseRequest): + request = cloud_deploy.GetReleaseRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_release] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_release(self, + request: Union[cloud_deploy.CreateReleaseRequest, dict] = None, + *, + parent: str = None, + release: cloud_deploy.Release = None, + release_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a new Release in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_create_release(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.CreateReleaseRequest( + parent="parent_value", + release_id="release_id_value", + ) + + # Make the request + operation = client.create_release(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateReleaseRequest, dict]): + The request object. The request object for + `CreateRelease`, + parent (str): + Required. The parent collection in which the ``Release`` + should be created. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + release (google.cloud.deploy_v1.types.Release): + Required. The ``Release`` to create. + This corresponds to the ``release`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + release_id (str): + Required. ID of the ``Release``. + This corresponds to the ``release_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Release` A Release + resource in the Google Cloud Deploy API. + + A Release defines a specific Skaffold configuration + instance that can be deployed. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, release, release_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.CreateReleaseRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.CreateReleaseRequest): + request = cloud_deploy.CreateReleaseRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if release is not None: + request.release = release + if release_id is not None: + request.release_id = release_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_release] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + cloud_deploy.Release, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def abandon_release(self, + request: Union[cloud_deploy.AbandonReleaseRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.AbandonReleaseResponse: + r"""Abandons a Release in the Delivery Pipeline. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_abandon_release(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.AbandonReleaseRequest( + name="name_value", + ) + + # Make the request + response = client.abandon_release(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.AbandonReleaseRequest, dict]): + The request object. The request object used by + `AbandonRelease`. + name (str): + Required. Name of the Release. Format + is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.AbandonReleaseResponse: + The response object for AbandonRelease. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.AbandonReleaseRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.AbandonReleaseRequest): + request = cloud_deploy.AbandonReleaseRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.abandon_release] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def approve_rollout(self, + request: Union[cloud_deploy.ApproveRolloutRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.ApproveRolloutResponse: + r"""Approves a Rollout. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_approve_rollout(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ApproveRolloutRequest( + name="name_value", + approved=True, + ) + + # Make the request + response = client.approve_rollout(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ApproveRolloutRequest, dict]): + The request object. The request object used by + `ApproveRollout`. + name (str): + Required. Name of the Rollout. Format + is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}/rollouts/{rollout}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.ApproveRolloutResponse: + The response object from ApproveRollout. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.ApproveRolloutRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.ApproveRolloutRequest): + request = cloud_deploy.ApproveRolloutRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.approve_rollout] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_rollouts(self, + request: Union[cloud_deploy.ListRolloutsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListRolloutsPager: + r"""Lists Rollouts in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_list_rollouts(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListRolloutsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_rollouts(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListRolloutsRequest, dict]): + The request object. ListRolloutsRequest is the request + object used by `ListRollouts`. + parent (str): + Required. The ``Release`` which owns this collection of + ``Rollout`` objects. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsPager: + ListRolloutsResponse is the response object reutrned by + ListRollouts. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.ListRolloutsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.ListRolloutsRequest): + request = cloud_deploy.ListRolloutsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_rollouts] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListRolloutsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_rollout(self, + request: Union[cloud_deploy.GetRolloutRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Rollout: + r"""Gets details of a single Rollout. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_get_rollout(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetRolloutRequest( + name="name_value", + ) + + # Make the request + response = client.get_rollout(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetRolloutRequest, dict]): + The request object. GetRolloutRequest is the request + object used by `GetRollout`. + name (str): + Required. Name of the ``Rollout``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Rollout: + A Rollout resource in the Google Cloud Deploy API. + + A Rollout contains information around a specific + deployment to a Target. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.GetRolloutRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.GetRolloutRequest): + request = cloud_deploy.GetRolloutRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_rollout] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_rollout(self, + request: Union[cloud_deploy.CreateRolloutRequest, dict] = None, + *, + parent: str = None, + rollout: cloud_deploy.Rollout = None, + rollout_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a new Rollout in a given project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_create_rollout(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + rollout = deploy_v1.Rollout() + rollout.target_id = "target_id_value" + + request = deploy_v1.CreateRolloutRequest( + parent="parent_value", + rollout_id="rollout_id_value", + rollout=rollout, + ) + + # Make the request + operation = client.create_rollout(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.CreateRolloutRequest, dict]): + The request object. CreateRolloutRequest is the request + object used by `CreateRollout`. + parent (str): + Required. The parent collection in which the ``Rollout`` + should be created. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + rollout (google.cloud.deploy_v1.types.Rollout): + Required. The ``Rollout`` to create. + This corresponds to the ``rollout`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + rollout_id (str): + Required. ID of the ``Rollout``. + This corresponds to the ``rollout_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.deploy_v1.types.Rollout` A Rollout + resource in the Google Cloud Deploy API. + + A Rollout contains information around a specific + deployment to a Target. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, rollout, rollout_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.CreateRolloutRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.CreateRolloutRequest): + request = cloud_deploy.CreateRolloutRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if rollout is not None: + request.rollout = rollout + if rollout_id is not None: + request.rollout_id = rollout_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_rollout] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + cloud_deploy.Rollout, + metadata_type=cloud_deploy.OperationMetadata, + ) + + # Done; return the response. + return response + + def retry_job(self, + request: Union[cloud_deploy.RetryJobRequest, dict] = None, + *, + rollout: str = None, + phase_id: str = None, + job_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.RetryJobResponse: + r"""Retries the specified Job in a Rollout. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_retry_job(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.RetryJobRequest( + rollout="rollout_value", + phase_id="phase_id_value", + job_id="job_id_value", + ) + + # Make the request + response = client.retry_job(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.RetryJobRequest, dict]): + The request object. RetryJobRequest is the request + object used by `RetryJob`. + rollout (str): + Required. Name of the Rollout. Format + is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}/rollouts/{rollout}. + + This corresponds to the ``rollout`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + phase_id (str): + Required. The phase ID the Job to + retry belongs to. + + This corresponds to the ``phase_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + job_id (str): + Required. The job ID for the Job to + retry. + + This corresponds to the ``job_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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.RetryJobResponse: + The response object from 'RetryJob'. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([rollout, phase_id, job_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.RetryJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.RetryJobRequest): + request = cloud_deploy.RetryJobRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if rollout is not None: + request.rollout = rollout + if phase_id is not None: + request.phase_id = phase_id + if job_id is not None: + request.job_id = job_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.retry_job] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("rollout", request.rollout), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_job_runs(self, + request: Union[cloud_deploy.ListJobRunsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListJobRunsPager: + r"""Lists JobRuns in a given project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_list_job_runs(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListJobRunsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_job_runs(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.ListJobRunsRequest, dict]): + The request object. ListJobRunsRequest is the request + object used by `ListJobRuns`. + parent (str): + Required. The ``Rollout`` which owns this collection of + ``JobRun`` objects. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsPager: + ListJobRunsResponse is the response object returned by + ListJobRuns. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.ListJobRunsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.ListJobRunsRequest): + request = cloud_deploy.ListJobRunsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_job_runs] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListJobRunsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_job_run(self, + request: Union[cloud_deploy.GetJobRunRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.JobRun: + r"""Gets details of a single JobRun. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_get_job_run(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetJobRunRequest( + name="name_value", + ) + + # Make the request + response = client.get_job_run(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetJobRunRequest, dict]): + The request object. GetJobRunRequest is the request + object used by `GetJobRun`. + name (str): + Required. Name of the ``JobRun``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.JobRun: + A JobRun resource in the Google Cloud Deploy API. + + A JobRun contains information of a single Rollout job + evaluation. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.GetJobRunRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.GetJobRunRequest): + request = cloud_deploy.GetJobRunRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_job_run] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_config(self, + request: Union[cloud_deploy.GetConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloud_deploy.Config: + r"""Gets the configuration for a location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import deploy_v1 + + def sample_get_config(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.deploy_v1.types.GetConfigRequest, dict]): + The request object. Request to get a configuration. + name (str): + Required. Name of requested + configuration. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.deploy_v1.types.Config: + Service-wide configuration. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a cloud_deploy.GetConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cloud_deploy.GetConfigRequest): + request = cloud_deploy.GetConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + def list_operations( + self, + request: operations_pb2.ListOperationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_operation( + self, + request: operations_pb2.GetOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_operation( + self, + request: operations_pb2.DeleteOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + def cancel_operation( + self, + request: operations_pb2.CancelOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + def set_iam_policy( + self, + request: iam_policy_pb2.SetIamPolicyRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Sets the IAM access control policy on the specified function. + + Replaces any existing policy. + + Args: + request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`): + The request object. Request message for `SetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # Create or coerce a protobuf request object. + + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.SetIamPolicyRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.set_iam_policy, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request.resource),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_iam_policy( + self, + request: iam_policy_pb2.GetIamPolicyRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Gets the IAM access control policy for a function. + + Returns an empty policy if the function exists and does not have a + policy set. + + Args: + request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`): + The request object. Request message for `GetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if + any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.policy_pb2.Policy: + Defines an Identity and Access Management (IAM) policy. + It is used to specify access control policies for Cloud + Platform resources. + A ``Policy`` is a collection of ``bindings``. A + ``binding`` binds one or more ``members`` to a single + ``role``. Members can be user accounts, service + accounts, Google groups, and domains (such as G Suite). + A ``role`` is a named list of permissions (defined by + IAM or configured by users). A ``binding`` can + optionally specify a ``condition``, which is a logic + expression that further constrains the role binding + based on attributes about the request and/or target + resource. + + **JSON Example** + + :: + + { + "bindings": [ + { + "role": "roles/resourcemanager.organizationAdmin", + "members": [ + "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + }, + { + "role": "roles/resourcemanager.organizationViewer", + "members": ["user:eve@example.com"], + "condition": { + "title": "expirable access", + "description": "Does not grant access after Sep 2020", + "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", + } + } + ] + } + + **YAML Example** + + :: + + bindings: + - members: + - user:mike@example.com + - group:admins@example.com + - domain:google.com + - serviceAccount:my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin + - members: + - user:eve@example.com + role: roles/resourcemanager.organizationViewer + condition: + title: expirable access + description: Does not grant access after Sep 2020 + expression: request.time < timestamp('2020-10-01T00:00:00.000Z') + + For a description of IAM and its features, see the `IAM + developer's + guide `__. + """ + # Create or coerce a protobuf request object. + + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.GetIamPolicyRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_iam_policy, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request.resource),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def test_iam_permissions( + self, + request: iam_policy_pb2.TestIamPermissionsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Tests the specified IAM permissions against the IAM access control + policy for a function. + + If the function does not exist, this will return an empty set + of permissions, not a NOT_FOUND error. + + Args: + request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`): + The request object. Request message for + `TestIamPermissions` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.iam_policy_pb2.TestIamPermissionsResponse: + Response message for ``TestIamPermissions`` method. + """ + # Create or coerce a protobuf request object. + + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.TestIamPermissionsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.test_iam_permissions, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("resource", request.resource),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_location( + self, + request: locations_pb2.GetLocationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.Location: + r"""Gets information about a location. + + Args: + request (:class:`~.location_pb2.GetLocationRequest`): + The request object. Request message for + `GetLocation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.Location: + Location object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.GetLocationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_location, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_locations( + self, + request: locations_pb2.ListLocationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.ListLocationsResponse: + r"""Lists information about the supported locations for this service. + + Args: + request (:class:`~.location_pb2.ListLocationsRequest`): + The request object. Request message for + `ListLocations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.ListLocationsResponse: + Response message for ``ListLocations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.ListLocationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_locations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-deploy", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ( + "CloudDeployClient", +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py new file mode 100644 index 0000000..2fe8519 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py @@ -0,0 +1,623 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator + +from google.cloud.deploy_v1.types import cloud_deploy + + +class ListDeliveryPipelinesPager: + """A pager for iterating through ``list_delivery_pipelines`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``delivery_pipelines`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListDeliveryPipelines`` requests and continue to iterate + through the ``delivery_pipelines`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., cloud_deploy.ListDeliveryPipelinesResponse], + request: cloud_deploy.ListDeliveryPipelinesRequest, + response: cloud_deploy.ListDeliveryPipelinesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListDeliveryPipelinesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[cloud_deploy.ListDeliveryPipelinesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[cloud_deploy.DeliveryPipeline]: + for page in self.pages: + yield from page.delivery_pipelines + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListDeliveryPipelinesAsyncPager: + """A pager for iterating through ``list_delivery_pipelines`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``delivery_pipelines`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListDeliveryPipelines`` requests and continue to iterate + through the ``delivery_pipelines`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[cloud_deploy.ListDeliveryPipelinesResponse]], + request: cloud_deploy.ListDeliveryPipelinesRequest, + response: cloud_deploy.ListDeliveryPipelinesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListDeliveryPipelinesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[cloud_deploy.ListDeliveryPipelinesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[cloud_deploy.DeliveryPipeline]: + async def async_generator(): + async for page in self.pages: + for response in page.delivery_pipelines: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListTargetsPager: + """A pager for iterating through ``list_targets`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListTargetsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``targets`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListTargets`` requests and continue to iterate + through the ``targets`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListTargetsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., cloud_deploy.ListTargetsResponse], + request: cloud_deploy.ListTargetsRequest, + response: cloud_deploy.ListTargetsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListTargetsRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListTargetsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListTargetsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[cloud_deploy.ListTargetsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[cloud_deploy.Target]: + for page in self.pages: + yield from page.targets + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListTargetsAsyncPager: + """A pager for iterating through ``list_targets`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListTargetsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``targets`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListTargets`` requests and continue to iterate + through the ``targets`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListTargetsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[cloud_deploy.ListTargetsResponse]], + request: cloud_deploy.ListTargetsRequest, + response: cloud_deploy.ListTargetsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListTargetsRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListTargetsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListTargetsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[cloud_deploy.ListTargetsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[cloud_deploy.Target]: + async def async_generator(): + async for page in self.pages: + for response in page.targets: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListReleasesPager: + """A pager for iterating through ``list_releases`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListReleasesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``releases`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListReleases`` requests and continue to iterate + through the ``releases`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListReleasesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., cloud_deploy.ListReleasesResponse], + request: cloud_deploy.ListReleasesRequest, + response: cloud_deploy.ListReleasesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListReleasesRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListReleasesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListReleasesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[cloud_deploy.ListReleasesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[cloud_deploy.Release]: + for page in self.pages: + yield from page.releases + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListReleasesAsyncPager: + """A pager for iterating through ``list_releases`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListReleasesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``releases`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListReleases`` requests and continue to iterate + through the ``releases`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListReleasesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[cloud_deploy.ListReleasesResponse]], + request: cloud_deploy.ListReleasesRequest, + response: cloud_deploy.ListReleasesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListReleasesRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListReleasesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListReleasesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[cloud_deploy.ListReleasesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[cloud_deploy.Release]: + async def async_generator(): + async for page in self.pages: + for response in page.releases: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListRolloutsPager: + """A pager for iterating through ``list_rollouts`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``rollouts`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListRollouts`` requests and continue to iterate + through the ``rollouts`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., cloud_deploy.ListRolloutsResponse], + request: cloud_deploy.ListRolloutsRequest, + response: cloud_deploy.ListRolloutsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListRolloutsRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListRolloutsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListRolloutsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[cloud_deploy.ListRolloutsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[cloud_deploy.Rollout]: + for page in self.pages: + yield from page.rollouts + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListRolloutsAsyncPager: + """A pager for iterating through ``list_rollouts`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``rollouts`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListRollouts`` requests and continue to iterate + through the ``rollouts`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[cloud_deploy.ListRolloutsResponse]], + request: cloud_deploy.ListRolloutsRequest, + response: cloud_deploy.ListRolloutsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListRolloutsRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListRolloutsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListRolloutsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[cloud_deploy.ListRolloutsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[cloud_deploy.Rollout]: + async def async_generator(): + async for page in self.pages: + for response in page.rollouts: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListJobRunsPager: + """A pager for iterating through ``list_job_runs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``job_runs`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListJobRuns`` requests and continue to iterate + through the ``job_runs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., cloud_deploy.ListJobRunsResponse], + request: cloud_deploy.ListJobRunsRequest, + response: cloud_deploy.ListJobRunsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListJobRunsRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListJobRunsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListJobRunsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[cloud_deploy.ListJobRunsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[cloud_deploy.JobRun]: + for page in self.pages: + yield from page.job_runs + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListJobRunsAsyncPager: + """A pager for iterating through ``list_job_runs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``job_runs`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListJobRuns`` requests and continue to iterate + through the ``job_runs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[cloud_deploy.ListJobRunsResponse]], + request: cloud_deploy.ListJobRunsRequest, + response: cloud_deploy.ListJobRunsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.deploy_v1.types.ListJobRunsRequest): + The initial request object. + response (google.cloud.deploy_v1.types.ListJobRunsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = cloud_deploy.ListJobRunsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[cloud_deploy.ListJobRunsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[cloud_deploy.JobRun]: + async def async_generator(): + async for page in self.pages: + for response in page.job_runs: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py new file mode 100644 index 0000000..0f4bac6 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import CloudDeployTransport +from .grpc import CloudDeployGrpcTransport +from .grpc_asyncio import CloudDeployGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CloudDeployTransport]] +_transport_registry['grpc'] = CloudDeployGrpcTransport +_transport_registry['grpc_asyncio'] = CloudDeployGrpcAsyncIOTransport + +__all__ = ( + 'CloudDeployTransport', + 'CloudDeployGrpcTransport', + 'CloudDeployGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py new file mode 100644 index 0000000..e0c3f9b --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py @@ -0,0 +1,607 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import pkg_resources + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.deploy_v1.types import cloud_deploy +from google.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + 'google-cloud-deploy', + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class CloudDeployTransport(abc.ABC): + """Abstract transport class for CloudDeploy.""" + + AUTH_SCOPES = ( + 'https://www.googleapis.com/auth/cloud-platform', + ) + + DEFAULT_HOST: str = 'clouddeploy.googleapis.com' + def __init__( + self, *, + 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, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, + **scopes_kwargs, + quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ':' not in host: + host += ':443' + self._host = host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_delivery_pipelines: gapic_v1.method.wrap_method( + self.list_delivery_pipelines, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.get_delivery_pipeline: gapic_v1.method.wrap_method( + self.get_delivery_pipeline, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.create_delivery_pipeline: gapic_v1.method.wrap_method( + self.create_delivery_pipeline, + default_timeout=60.0, + client_info=client_info, + ), + self.update_delivery_pipeline: gapic_v1.method.wrap_method( + self.update_delivery_pipeline, + default_timeout=60.0, + client_info=client_info, + ), + self.delete_delivery_pipeline: gapic_v1.method.wrap_method( + self.delete_delivery_pipeline, + default_timeout=60.0, + client_info=client_info, + ), + self.list_targets: gapic_v1.method.wrap_method( + self.list_targets, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.get_target: gapic_v1.method.wrap_method( + self.get_target, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.create_target: gapic_v1.method.wrap_method( + self.create_target, + default_timeout=60.0, + client_info=client_info, + ), + self.update_target: gapic_v1.method.wrap_method( + self.update_target, + default_timeout=60.0, + client_info=client_info, + ), + self.delete_target: gapic_v1.method.wrap_method( + self.delete_target, + default_timeout=60.0, + client_info=client_info, + ), + self.list_releases: gapic_v1.method.wrap_method( + self.list_releases, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.get_release: gapic_v1.method.wrap_method( + self.get_release, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.create_release: gapic_v1.method.wrap_method( + self.create_release, + default_timeout=60.0, + client_info=client_info, + ), + self.abandon_release: gapic_v1.method.wrap_method( + self.abandon_release, + default_timeout=60.0, + client_info=client_info, + ), + self.approve_rollout: gapic_v1.method.wrap_method( + self.approve_rollout, + default_timeout=60.0, + client_info=client_info, + ), + self.list_rollouts: gapic_v1.method.wrap_method( + self.list_rollouts, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.get_rollout: gapic_v1.method.wrap_method( + self.get_rollout, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.create_rollout: gapic_v1.method.wrap_method( + self.create_rollout, + default_timeout=60.0, + client_info=client_info, + ), + self.retry_job: gapic_v1.method.wrap_method( + self.retry_job, + default_timeout=60.0, + client_info=client_info, + ), + self.list_job_runs: gapic_v1.method.wrap_method( + self.list_job_runs, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.get_job_run: gapic_v1.method.wrap_method( + self.get_job_run, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + self.get_config: gapic_v1.method.wrap_method( + self.get_config, + default_retry=retries.Retry( +initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_delivery_pipelines(self) -> Callable[ + [cloud_deploy.ListDeliveryPipelinesRequest], + Union[ + cloud_deploy.ListDeliveryPipelinesResponse, + Awaitable[cloud_deploy.ListDeliveryPipelinesResponse] + ]]: + raise NotImplementedError() + + @property + def get_delivery_pipeline(self) -> Callable[ + [cloud_deploy.GetDeliveryPipelineRequest], + Union[ + cloud_deploy.DeliveryPipeline, + Awaitable[cloud_deploy.DeliveryPipeline] + ]]: + raise NotImplementedError() + + @property + def create_delivery_pipeline(self) -> Callable[ + [cloud_deploy.CreateDeliveryPipelineRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_delivery_pipeline(self) -> Callable[ + [cloud_deploy.UpdateDeliveryPipelineRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_delivery_pipeline(self) -> Callable[ + [cloud_deploy.DeleteDeliveryPipelineRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def list_targets(self) -> Callable[ + [cloud_deploy.ListTargetsRequest], + Union[ + cloud_deploy.ListTargetsResponse, + Awaitable[cloud_deploy.ListTargetsResponse] + ]]: + raise NotImplementedError() + + @property + def get_target(self) -> Callable[ + [cloud_deploy.GetTargetRequest], + Union[ + cloud_deploy.Target, + Awaitable[cloud_deploy.Target] + ]]: + raise NotImplementedError() + + @property + def create_target(self) -> Callable[ + [cloud_deploy.CreateTargetRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_target(self) -> Callable[ + [cloud_deploy.UpdateTargetRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_target(self) -> Callable[ + [cloud_deploy.DeleteTargetRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def list_releases(self) -> Callable[ + [cloud_deploy.ListReleasesRequest], + Union[ + cloud_deploy.ListReleasesResponse, + Awaitable[cloud_deploy.ListReleasesResponse] + ]]: + raise NotImplementedError() + + @property + def get_release(self) -> Callable[ + [cloud_deploy.GetReleaseRequest], + Union[ + cloud_deploy.Release, + Awaitable[cloud_deploy.Release] + ]]: + raise NotImplementedError() + + @property + def create_release(self) -> Callable[ + [cloud_deploy.CreateReleaseRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def abandon_release(self) -> Callable[ + [cloud_deploy.AbandonReleaseRequest], + Union[ + cloud_deploy.AbandonReleaseResponse, + Awaitable[cloud_deploy.AbandonReleaseResponse] + ]]: + raise NotImplementedError() + + @property + def approve_rollout(self) -> Callable[ + [cloud_deploy.ApproveRolloutRequest], + Union[ + cloud_deploy.ApproveRolloutResponse, + Awaitable[cloud_deploy.ApproveRolloutResponse] + ]]: + raise NotImplementedError() + + @property + def list_rollouts(self) -> Callable[ + [cloud_deploy.ListRolloutsRequest], + Union[ + cloud_deploy.ListRolloutsResponse, + Awaitable[cloud_deploy.ListRolloutsResponse] + ]]: + raise NotImplementedError() + + @property + def get_rollout(self) -> Callable[ + [cloud_deploy.GetRolloutRequest], + Union[ + cloud_deploy.Rollout, + Awaitable[cloud_deploy.Rollout] + ]]: + raise NotImplementedError() + + @property + def create_rollout(self) -> Callable[ + [cloud_deploy.CreateRolloutRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def retry_job(self) -> Callable[ + [cloud_deploy.RetryJobRequest], + Union[ + cloud_deploy.RetryJobResponse, + Awaitable[cloud_deploy.RetryJobResponse] + ]]: + raise NotImplementedError() + + @property + def list_job_runs(self) -> Callable[ + [cloud_deploy.ListJobRunsRequest], + Union[ + cloud_deploy.ListJobRunsResponse, + Awaitable[cloud_deploy.ListJobRunsResponse] + ]]: + raise NotImplementedError() + + @property + def get_job_run(self) -> Callable[ + [cloud_deploy.GetJobRunRequest], + Union[ + cloud_deploy.JobRun, + Awaitable[cloud_deploy.JobRun] + ]]: + raise NotImplementedError() + + @property + def get_config(self) -> Callable[ + [cloud_deploy.GetConfigRequest], + Union[ + cloud_deploy.Config, + Awaitable[cloud_deploy.Config] + ]]: + raise NotImplementedError() + + @property + def list_operations( + self, + ) -> Callable[ + [operations_pb2.ListOperationsRequest], + Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], + ]: + raise NotImplementedError() + + @property + def get_operation( + self, + ) -> Callable[ + [operations_pb2.GetOperationRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def cancel_operation( + self, + ) -> Callable[ + [operations_pb2.CancelOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def delete_operation( + self, + ) -> Callable[ + [operations_pb2.DeleteOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def set_iam_policy( + self, + ) -> Callable[ + [iam_policy_pb2.SetIamPolicyRequest], + Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], + ]: + raise NotImplementedError() + + @property + def get_iam_policy( + self, + ) -> Callable[ + [iam_policy_pb2.GetIamPolicyRequest], + Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], + ]: + raise NotImplementedError() + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], + Union[ + iam_policy_pb2.TestIamPermissionsResponse, + Awaitable[iam_policy_pb2.TestIamPermissionsResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_location(self, + ) -> Callable[ + [locations_pb2.GetLocationRequest], + Union[locations_pb2.Location, Awaitable[locations_pb2.Location]], + ]: + raise NotImplementedError() + + @property + def list_locations(self, + ) -> Callable[ + [locations_pb2.ListLocationsRequest], + Union[locations_pb2.ListLocationsResponse, Awaitable[locations_pb2.ListLocationsResponse]], + ]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'CloudDeployTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py new file mode 100644 index 0000000..386fb61 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py @@ -0,0 +1,1026 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_v1 +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.deploy_v1.types import cloud_deploy +from google.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from .base import CloudDeployTransport, DEFAULT_CLIENT_INFO + + +class CloudDeployGrpcTransport(CloudDeployTransport): + """gRPC backend transport for CloudDeploy. + + CloudDeploy service creates and manages Continuous Delivery + operations on Google Cloud Platform via Skaffold + (https://skaffold.dev). + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + _stubs: Dict[str, Callable] + + def __init__(self, *, + host: str = 'clouddeploy.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'clouddeploy.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_delivery_pipelines(self) -> Callable[ + [cloud_deploy.ListDeliveryPipelinesRequest], + cloud_deploy.ListDeliveryPipelinesResponse]: + r"""Return a callable for the list delivery pipelines method over gRPC. + + Lists DeliveryPipelines in a given project and + location. + + Returns: + Callable[[~.ListDeliveryPipelinesRequest], + ~.ListDeliveryPipelinesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_delivery_pipelines' not in self._stubs: + self._stubs['list_delivery_pipelines'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines', + request_serializer=cloud_deploy.ListDeliveryPipelinesRequest.serialize, + response_deserializer=cloud_deploy.ListDeliveryPipelinesResponse.deserialize, + ) + return self._stubs['list_delivery_pipelines'] + + @property + def get_delivery_pipeline(self) -> Callable[ + [cloud_deploy.GetDeliveryPipelineRequest], + cloud_deploy.DeliveryPipeline]: + r"""Return a callable for the get delivery pipeline method over gRPC. + + Gets details of a single DeliveryPipeline. + + Returns: + Callable[[~.GetDeliveryPipelineRequest], + ~.DeliveryPipeline]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_delivery_pipeline' not in self._stubs: + self._stubs['get_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline', + request_serializer=cloud_deploy.GetDeliveryPipelineRequest.serialize, + response_deserializer=cloud_deploy.DeliveryPipeline.deserialize, + ) + return self._stubs['get_delivery_pipeline'] + + @property + def create_delivery_pipeline(self) -> Callable[ + [cloud_deploy.CreateDeliveryPipelineRequest], + operations_pb2.Operation]: + r"""Return a callable for the create delivery pipeline method over gRPC. + + Creates a new DeliveryPipeline in a given project and + location. + + Returns: + Callable[[~.CreateDeliveryPipelineRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_delivery_pipeline' not in self._stubs: + self._stubs['create_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline', + request_serializer=cloud_deploy.CreateDeliveryPipelineRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_delivery_pipeline'] + + @property + def update_delivery_pipeline(self) -> Callable[ + [cloud_deploy.UpdateDeliveryPipelineRequest], + operations_pb2.Operation]: + r"""Return a callable for the update delivery pipeline method over gRPC. + + Updates the parameters of a single DeliveryPipeline. + + Returns: + Callable[[~.UpdateDeliveryPipelineRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_delivery_pipeline' not in self._stubs: + self._stubs['update_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline', + request_serializer=cloud_deploy.UpdateDeliveryPipelineRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_delivery_pipeline'] + + @property + def delete_delivery_pipeline(self) -> Callable[ + [cloud_deploy.DeleteDeliveryPipelineRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete delivery pipeline method over gRPC. + + Deletes a single DeliveryPipeline. + + Returns: + Callable[[~.DeleteDeliveryPipelineRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_delivery_pipeline' not in self._stubs: + self._stubs['delete_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline', + request_serializer=cloud_deploy.DeleteDeliveryPipelineRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_delivery_pipeline'] + + @property + def list_targets(self) -> Callable[ + [cloud_deploy.ListTargetsRequest], + cloud_deploy.ListTargetsResponse]: + r"""Return a callable for the list targets method over gRPC. + + Lists Targets in a given project and location. + + Returns: + Callable[[~.ListTargetsRequest], + ~.ListTargetsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_targets' not in self._stubs: + self._stubs['list_targets'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListTargets', + request_serializer=cloud_deploy.ListTargetsRequest.serialize, + response_deserializer=cloud_deploy.ListTargetsResponse.deserialize, + ) + return self._stubs['list_targets'] + + @property + def get_target(self) -> Callable[ + [cloud_deploy.GetTargetRequest], + cloud_deploy.Target]: + r"""Return a callable for the get target method over gRPC. + + Gets details of a single Target. + + Returns: + Callable[[~.GetTargetRequest], + ~.Target]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_target' not in self._stubs: + self._stubs['get_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetTarget', + request_serializer=cloud_deploy.GetTargetRequest.serialize, + response_deserializer=cloud_deploy.Target.deserialize, + ) + return self._stubs['get_target'] + + @property + def create_target(self) -> Callable[ + [cloud_deploy.CreateTargetRequest], + operations_pb2.Operation]: + r"""Return a callable for the create target method over gRPC. + + Creates a new Target in a given project and location. + + Returns: + Callable[[~.CreateTargetRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_target' not in self._stubs: + self._stubs['create_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateTarget', + request_serializer=cloud_deploy.CreateTargetRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_target'] + + @property + def update_target(self) -> Callable[ + [cloud_deploy.UpdateTargetRequest], + operations_pb2.Operation]: + r"""Return a callable for the update target method over gRPC. + + Updates the parameters of a single Target. + + Returns: + Callable[[~.UpdateTargetRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_target' not in self._stubs: + self._stubs['update_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/UpdateTarget', + request_serializer=cloud_deploy.UpdateTargetRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_target'] + + @property + def delete_target(self) -> Callable[ + [cloud_deploy.DeleteTargetRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete target method over gRPC. + + Deletes a single Target. + + Returns: + Callable[[~.DeleteTargetRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_target' not in self._stubs: + self._stubs['delete_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/DeleteTarget', + request_serializer=cloud_deploy.DeleteTargetRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_target'] + + @property + def list_releases(self) -> Callable[ + [cloud_deploy.ListReleasesRequest], + cloud_deploy.ListReleasesResponse]: + r"""Return a callable for the list releases method over gRPC. + + Lists Releases in a given project and location. + + Returns: + Callable[[~.ListReleasesRequest], + ~.ListReleasesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_releases' not in self._stubs: + self._stubs['list_releases'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListReleases', + request_serializer=cloud_deploy.ListReleasesRequest.serialize, + response_deserializer=cloud_deploy.ListReleasesResponse.deserialize, + ) + return self._stubs['list_releases'] + + @property + def get_release(self) -> Callable[ + [cloud_deploy.GetReleaseRequest], + cloud_deploy.Release]: + r"""Return a callable for the get release method over gRPC. + + Gets details of a single Release. + + Returns: + Callable[[~.GetReleaseRequest], + ~.Release]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_release' not in self._stubs: + self._stubs['get_release'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetRelease', + request_serializer=cloud_deploy.GetReleaseRequest.serialize, + response_deserializer=cloud_deploy.Release.deserialize, + ) + return self._stubs['get_release'] + + @property + def create_release(self) -> Callable[ + [cloud_deploy.CreateReleaseRequest], + operations_pb2.Operation]: + r"""Return a callable for the create release method over gRPC. + + Creates a new Release in a given project and + location. + + Returns: + Callable[[~.CreateReleaseRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_release' not in self._stubs: + self._stubs['create_release'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateRelease', + request_serializer=cloud_deploy.CreateReleaseRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_release'] + + @property + def abandon_release(self) -> Callable[ + [cloud_deploy.AbandonReleaseRequest], + cloud_deploy.AbandonReleaseResponse]: + r"""Return a callable for the abandon release method over gRPC. + + Abandons a Release in the Delivery Pipeline. + + Returns: + Callable[[~.AbandonReleaseRequest], + ~.AbandonReleaseResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'abandon_release' not in self._stubs: + self._stubs['abandon_release'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/AbandonRelease', + request_serializer=cloud_deploy.AbandonReleaseRequest.serialize, + response_deserializer=cloud_deploy.AbandonReleaseResponse.deserialize, + ) + return self._stubs['abandon_release'] + + @property + def approve_rollout(self) -> Callable[ + [cloud_deploy.ApproveRolloutRequest], + cloud_deploy.ApproveRolloutResponse]: + r"""Return a callable for the approve rollout method over gRPC. + + Approves a Rollout. + + Returns: + Callable[[~.ApproveRolloutRequest], + ~.ApproveRolloutResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'approve_rollout' not in self._stubs: + self._stubs['approve_rollout'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ApproveRollout', + request_serializer=cloud_deploy.ApproveRolloutRequest.serialize, + response_deserializer=cloud_deploy.ApproveRolloutResponse.deserialize, + ) + return self._stubs['approve_rollout'] + + @property + def list_rollouts(self) -> Callable[ + [cloud_deploy.ListRolloutsRequest], + cloud_deploy.ListRolloutsResponse]: + r"""Return a callable for the list rollouts method over gRPC. + + Lists Rollouts in a given project and location. + + Returns: + Callable[[~.ListRolloutsRequest], + ~.ListRolloutsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_rollouts' not in self._stubs: + self._stubs['list_rollouts'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListRollouts', + request_serializer=cloud_deploy.ListRolloutsRequest.serialize, + response_deserializer=cloud_deploy.ListRolloutsResponse.deserialize, + ) + return self._stubs['list_rollouts'] + + @property + def get_rollout(self) -> Callable[ + [cloud_deploy.GetRolloutRequest], + cloud_deploy.Rollout]: + r"""Return a callable for the get rollout method over gRPC. + + Gets details of a single Rollout. + + Returns: + Callable[[~.GetRolloutRequest], + ~.Rollout]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_rollout' not in self._stubs: + self._stubs['get_rollout'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetRollout', + request_serializer=cloud_deploy.GetRolloutRequest.serialize, + response_deserializer=cloud_deploy.Rollout.deserialize, + ) + return self._stubs['get_rollout'] + + @property + def create_rollout(self) -> Callable[ + [cloud_deploy.CreateRolloutRequest], + operations_pb2.Operation]: + r"""Return a callable for the create rollout method over gRPC. + + Creates a new Rollout in a given project and + location. + + Returns: + Callable[[~.CreateRolloutRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_rollout' not in self._stubs: + self._stubs['create_rollout'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateRollout', + request_serializer=cloud_deploy.CreateRolloutRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_rollout'] + + @property + def retry_job(self) -> Callable[ + [cloud_deploy.RetryJobRequest], + cloud_deploy.RetryJobResponse]: + r"""Return a callable for the retry job method over gRPC. + + Retries the specified Job in a Rollout. + + Returns: + Callable[[~.RetryJobRequest], + ~.RetryJobResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'retry_job' not in self._stubs: + self._stubs['retry_job'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/RetryJob', + request_serializer=cloud_deploy.RetryJobRequest.serialize, + response_deserializer=cloud_deploy.RetryJobResponse.deserialize, + ) + return self._stubs['retry_job'] + + @property + def list_job_runs(self) -> Callable[ + [cloud_deploy.ListJobRunsRequest], + cloud_deploy.ListJobRunsResponse]: + r"""Return a callable for the list job runs method over gRPC. + + Lists JobRuns in a given project and location. + + Returns: + Callable[[~.ListJobRunsRequest], + ~.ListJobRunsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_job_runs' not in self._stubs: + self._stubs['list_job_runs'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListJobRuns', + request_serializer=cloud_deploy.ListJobRunsRequest.serialize, + response_deserializer=cloud_deploy.ListJobRunsResponse.deserialize, + ) + return self._stubs['list_job_runs'] + + @property + def get_job_run(self) -> Callable[ + [cloud_deploy.GetJobRunRequest], + cloud_deploy.JobRun]: + r"""Return a callable for the get job run method over gRPC. + + Gets details of a single JobRun. + + Returns: + Callable[[~.GetJobRunRequest], + ~.JobRun]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_job_run' not in self._stubs: + self._stubs['get_job_run'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetJobRun', + request_serializer=cloud_deploy.GetJobRunRequest.serialize, + response_deserializer=cloud_deploy.JobRun.deserialize, + ) + return self._stubs['get_job_run'] + + @property + def get_config(self) -> Callable[ + [cloud_deploy.GetConfigRequest], + cloud_deploy.Config]: + r"""Return a callable for the get config method over gRPC. + + Gets the configuration for a location. + + Returns: + Callable[[~.GetConfigRequest], + ~.Config]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_config' not in self._stubs: + self._stubs['get_config'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetConfig', + request_serializer=cloud_deploy.GetConfigRequest.serialize, + response_deserializer=cloud_deploy.Config.deserialize, + ) + return self._stubs['get_config'] + + def close(self): + self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + @property + def list_locations( + self, + ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_locations" not in self._stubs: + self._stubs["list_locations"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/ListLocations", + request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, + response_deserializer=locations_pb2.ListLocationsResponse.FromString, + ) + return self._stubs["list_locations"] + + @property + def get_location( + self, + ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_location" not in self._stubs: + self._stubs["get_location"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/GetLocation", + request_serializer=locations_pb2.GetLocationRequest.SerializeToString, + response_deserializer=locations_pb2.Location.FromString, + ) + return self._stubs["get_location"] + + @property + def set_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the set iam policy method over gRPC. + Sets the IAM access control policy on the specified + function. Replaces any existing policy. + Returns: + Callable[[~.SetIamPolicyRequest], + ~.Policy]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_iam_policy" not in self._stubs: + self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + "/google.iam.v1.IAMPolicy/SetIamPolicy", + request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["set_iam_policy"] + + @property + def get_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the get iam policy method over gRPC. + Gets the IAM access control policy for a function. + Returns an empty policy if the function exists and does + not have a policy set. + Returns: + Callable[[~.GetIamPolicyRequest], + ~.Policy]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_iam_policy" not in self._stubs: + self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + "/google.iam.v1.IAMPolicy/GetIamPolicy", + request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["get_iam_policy"] + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], iam_policy_pb2.TestIamPermissionsResponse + ]: + r"""Return a callable for the test iam permissions method over gRPC. + Tests the specified permissions against the IAM access control + policy for a function. If the function does not exist, this will + return an empty set of permissions, not a NOT_FOUND error. + Returns: + Callable[[~.TestIamPermissionsRequest], + ~.TestIamPermissionsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "test_iam_permissions" not in self._stubs: + self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + "/google.iam.v1.IAMPolicy/TestIamPermissions", + request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, + ) + return self._stubs["test_iam_permissions"] + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'CloudDeployGrpcTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py new file mode 100644 index 0000000..11bd3c8 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py @@ -0,0 +1,1025 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.deploy_v1.types import cloud_deploy +from google.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from .base import CloudDeployTransport, DEFAULT_CLIENT_INFO +from .grpc import CloudDeployGrpcTransport + + +class CloudDeployGrpcAsyncIOTransport(CloudDeployTransport): + """gRPC AsyncIO backend transport for CloudDeploy. + + CloudDeploy service creates and manages Continuous Delivery + operations on Google Cloud Platform via Skaffold + (https://skaffold.dev). + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel(cls, + host: str = 'clouddeploy.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + def __init__(self, *, + host: str = 'clouddeploy.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_delivery_pipelines(self) -> Callable[ + [cloud_deploy.ListDeliveryPipelinesRequest], + Awaitable[cloud_deploy.ListDeliveryPipelinesResponse]]: + r"""Return a callable for the list delivery pipelines method over gRPC. + + Lists DeliveryPipelines in a given project and + location. + + Returns: + Callable[[~.ListDeliveryPipelinesRequest], + Awaitable[~.ListDeliveryPipelinesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_delivery_pipelines' not in self._stubs: + self._stubs['list_delivery_pipelines'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines', + request_serializer=cloud_deploy.ListDeliveryPipelinesRequest.serialize, + response_deserializer=cloud_deploy.ListDeliveryPipelinesResponse.deserialize, + ) + return self._stubs['list_delivery_pipelines'] + + @property + def get_delivery_pipeline(self) -> Callable[ + [cloud_deploy.GetDeliveryPipelineRequest], + Awaitable[cloud_deploy.DeliveryPipeline]]: + r"""Return a callable for the get delivery pipeline method over gRPC. + + Gets details of a single DeliveryPipeline. + + Returns: + Callable[[~.GetDeliveryPipelineRequest], + Awaitable[~.DeliveryPipeline]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_delivery_pipeline' not in self._stubs: + self._stubs['get_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline', + request_serializer=cloud_deploy.GetDeliveryPipelineRequest.serialize, + response_deserializer=cloud_deploy.DeliveryPipeline.deserialize, + ) + return self._stubs['get_delivery_pipeline'] + + @property + def create_delivery_pipeline(self) -> Callable[ + [cloud_deploy.CreateDeliveryPipelineRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create delivery pipeline method over gRPC. + + Creates a new DeliveryPipeline in a given project and + location. + + Returns: + Callable[[~.CreateDeliveryPipelineRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_delivery_pipeline' not in self._stubs: + self._stubs['create_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline', + request_serializer=cloud_deploy.CreateDeliveryPipelineRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_delivery_pipeline'] + + @property + def update_delivery_pipeline(self) -> Callable[ + [cloud_deploy.UpdateDeliveryPipelineRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update delivery pipeline method over gRPC. + + Updates the parameters of a single DeliveryPipeline. + + Returns: + Callable[[~.UpdateDeliveryPipelineRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_delivery_pipeline' not in self._stubs: + self._stubs['update_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline', + request_serializer=cloud_deploy.UpdateDeliveryPipelineRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_delivery_pipeline'] + + @property + def delete_delivery_pipeline(self) -> Callable[ + [cloud_deploy.DeleteDeliveryPipelineRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete delivery pipeline method over gRPC. + + Deletes a single DeliveryPipeline. + + Returns: + Callable[[~.DeleteDeliveryPipelineRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_delivery_pipeline' not in self._stubs: + self._stubs['delete_delivery_pipeline'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline', + request_serializer=cloud_deploy.DeleteDeliveryPipelineRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_delivery_pipeline'] + + @property + def list_targets(self) -> Callable[ + [cloud_deploy.ListTargetsRequest], + Awaitable[cloud_deploy.ListTargetsResponse]]: + r"""Return a callable for the list targets method over gRPC. + + Lists Targets in a given project and location. + + Returns: + Callable[[~.ListTargetsRequest], + Awaitable[~.ListTargetsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_targets' not in self._stubs: + self._stubs['list_targets'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListTargets', + request_serializer=cloud_deploy.ListTargetsRequest.serialize, + response_deserializer=cloud_deploy.ListTargetsResponse.deserialize, + ) + return self._stubs['list_targets'] + + @property + def get_target(self) -> Callable[ + [cloud_deploy.GetTargetRequest], + Awaitable[cloud_deploy.Target]]: + r"""Return a callable for the get target method over gRPC. + + Gets details of a single Target. + + Returns: + Callable[[~.GetTargetRequest], + Awaitable[~.Target]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_target' not in self._stubs: + self._stubs['get_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetTarget', + request_serializer=cloud_deploy.GetTargetRequest.serialize, + response_deserializer=cloud_deploy.Target.deserialize, + ) + return self._stubs['get_target'] + + @property + def create_target(self) -> Callable[ + [cloud_deploy.CreateTargetRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create target method over gRPC. + + Creates a new Target in a given project and location. + + Returns: + Callable[[~.CreateTargetRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_target' not in self._stubs: + self._stubs['create_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateTarget', + request_serializer=cloud_deploy.CreateTargetRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_target'] + + @property + def update_target(self) -> Callable[ + [cloud_deploy.UpdateTargetRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update target method over gRPC. + + Updates the parameters of a single Target. + + Returns: + Callable[[~.UpdateTargetRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_target' not in self._stubs: + self._stubs['update_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/UpdateTarget', + request_serializer=cloud_deploy.UpdateTargetRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_target'] + + @property + def delete_target(self) -> Callable[ + [cloud_deploy.DeleteTargetRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete target method over gRPC. + + Deletes a single Target. + + Returns: + Callable[[~.DeleteTargetRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_target' not in self._stubs: + self._stubs['delete_target'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/DeleteTarget', + request_serializer=cloud_deploy.DeleteTargetRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_target'] + + @property + def list_releases(self) -> Callable[ + [cloud_deploy.ListReleasesRequest], + Awaitable[cloud_deploy.ListReleasesResponse]]: + r"""Return a callable for the list releases method over gRPC. + + Lists Releases in a given project and location. + + Returns: + Callable[[~.ListReleasesRequest], + Awaitable[~.ListReleasesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_releases' not in self._stubs: + self._stubs['list_releases'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListReleases', + request_serializer=cloud_deploy.ListReleasesRequest.serialize, + response_deserializer=cloud_deploy.ListReleasesResponse.deserialize, + ) + return self._stubs['list_releases'] + + @property + def get_release(self) -> Callable[ + [cloud_deploy.GetReleaseRequest], + Awaitable[cloud_deploy.Release]]: + r"""Return a callable for the get release method over gRPC. + + Gets details of a single Release. + + Returns: + Callable[[~.GetReleaseRequest], + Awaitable[~.Release]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_release' not in self._stubs: + self._stubs['get_release'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetRelease', + request_serializer=cloud_deploy.GetReleaseRequest.serialize, + response_deserializer=cloud_deploy.Release.deserialize, + ) + return self._stubs['get_release'] + + @property + def create_release(self) -> Callable[ + [cloud_deploy.CreateReleaseRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create release method over gRPC. + + Creates a new Release in a given project and + location. + + Returns: + Callable[[~.CreateReleaseRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_release' not in self._stubs: + self._stubs['create_release'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateRelease', + request_serializer=cloud_deploy.CreateReleaseRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_release'] + + @property + def abandon_release(self) -> Callable[ + [cloud_deploy.AbandonReleaseRequest], + Awaitable[cloud_deploy.AbandonReleaseResponse]]: + r"""Return a callable for the abandon release method over gRPC. + + Abandons a Release in the Delivery Pipeline. + + Returns: + Callable[[~.AbandonReleaseRequest], + Awaitable[~.AbandonReleaseResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'abandon_release' not in self._stubs: + self._stubs['abandon_release'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/AbandonRelease', + request_serializer=cloud_deploy.AbandonReleaseRequest.serialize, + response_deserializer=cloud_deploy.AbandonReleaseResponse.deserialize, + ) + return self._stubs['abandon_release'] + + @property + def approve_rollout(self) -> Callable[ + [cloud_deploy.ApproveRolloutRequest], + Awaitable[cloud_deploy.ApproveRolloutResponse]]: + r"""Return a callable for the approve rollout method over gRPC. + + Approves a Rollout. + + Returns: + Callable[[~.ApproveRolloutRequest], + Awaitable[~.ApproveRolloutResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'approve_rollout' not in self._stubs: + self._stubs['approve_rollout'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ApproveRollout', + request_serializer=cloud_deploy.ApproveRolloutRequest.serialize, + response_deserializer=cloud_deploy.ApproveRolloutResponse.deserialize, + ) + return self._stubs['approve_rollout'] + + @property + def list_rollouts(self) -> Callable[ + [cloud_deploy.ListRolloutsRequest], + Awaitable[cloud_deploy.ListRolloutsResponse]]: + r"""Return a callable for the list rollouts method over gRPC. + + Lists Rollouts in a given project and location. + + Returns: + Callable[[~.ListRolloutsRequest], + Awaitable[~.ListRolloutsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_rollouts' not in self._stubs: + self._stubs['list_rollouts'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListRollouts', + request_serializer=cloud_deploy.ListRolloutsRequest.serialize, + response_deserializer=cloud_deploy.ListRolloutsResponse.deserialize, + ) + return self._stubs['list_rollouts'] + + @property + def get_rollout(self) -> Callable[ + [cloud_deploy.GetRolloutRequest], + Awaitable[cloud_deploy.Rollout]]: + r"""Return a callable for the get rollout method over gRPC. + + Gets details of a single Rollout. + + Returns: + Callable[[~.GetRolloutRequest], + Awaitable[~.Rollout]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_rollout' not in self._stubs: + self._stubs['get_rollout'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetRollout', + request_serializer=cloud_deploy.GetRolloutRequest.serialize, + response_deserializer=cloud_deploy.Rollout.deserialize, + ) + return self._stubs['get_rollout'] + + @property + def create_rollout(self) -> Callable[ + [cloud_deploy.CreateRolloutRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create rollout method over gRPC. + + Creates a new Rollout in a given project and + location. + + Returns: + Callable[[~.CreateRolloutRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_rollout' not in self._stubs: + self._stubs['create_rollout'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/CreateRollout', + request_serializer=cloud_deploy.CreateRolloutRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_rollout'] + + @property + def retry_job(self) -> Callable[ + [cloud_deploy.RetryJobRequest], + Awaitable[cloud_deploy.RetryJobResponse]]: + r"""Return a callable for the retry job method over gRPC. + + Retries the specified Job in a Rollout. + + Returns: + Callable[[~.RetryJobRequest], + Awaitable[~.RetryJobResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'retry_job' not in self._stubs: + self._stubs['retry_job'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/RetryJob', + request_serializer=cloud_deploy.RetryJobRequest.serialize, + response_deserializer=cloud_deploy.RetryJobResponse.deserialize, + ) + return self._stubs['retry_job'] + + @property + def list_job_runs(self) -> Callable[ + [cloud_deploy.ListJobRunsRequest], + Awaitable[cloud_deploy.ListJobRunsResponse]]: + r"""Return a callable for the list job runs method over gRPC. + + Lists JobRuns in a given project and location. + + Returns: + Callable[[~.ListJobRunsRequest], + Awaitable[~.ListJobRunsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_job_runs' not in self._stubs: + self._stubs['list_job_runs'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/ListJobRuns', + request_serializer=cloud_deploy.ListJobRunsRequest.serialize, + response_deserializer=cloud_deploy.ListJobRunsResponse.deserialize, + ) + return self._stubs['list_job_runs'] + + @property + def get_job_run(self) -> Callable[ + [cloud_deploy.GetJobRunRequest], + Awaitable[cloud_deploy.JobRun]]: + r"""Return a callable for the get job run method over gRPC. + + Gets details of a single JobRun. + + Returns: + Callable[[~.GetJobRunRequest], + Awaitable[~.JobRun]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_job_run' not in self._stubs: + self._stubs['get_job_run'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetJobRun', + request_serializer=cloud_deploy.GetJobRunRequest.serialize, + response_deserializer=cloud_deploy.JobRun.deserialize, + ) + return self._stubs['get_job_run'] + + @property + def get_config(self) -> Callable[ + [cloud_deploy.GetConfigRequest], + Awaitable[cloud_deploy.Config]]: + r"""Return a callable for the get config method over gRPC. + + Gets the configuration for a location. + + Returns: + Callable[[~.GetConfigRequest], + Awaitable[~.Config]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_config' not in self._stubs: + self._stubs['get_config'] = self.grpc_channel.unary_unary( + '/google.cloud.deploy.v1.CloudDeploy/GetConfig', + request_serializer=cloud_deploy.GetConfigRequest.serialize, + response_deserializer=cloud_deploy.Config.deserialize, + ) + return self._stubs['get_config'] + + def close(self): + return self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + @property + def list_locations( + self, + ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_locations" not in self._stubs: + self._stubs["list_locations"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/ListLocations", + request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, + response_deserializer=locations_pb2.ListLocationsResponse.FromString, + ) + return self._stubs["list_locations"] + + @property + def get_location( + self, + ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_location" not in self._stubs: + self._stubs["get_location"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/GetLocation", + request_serializer=locations_pb2.GetLocationRequest.SerializeToString, + response_deserializer=locations_pb2.Location.FromString, + ) + return self._stubs["get_location"] + + @property + def set_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the set iam policy method over gRPC. + Sets the IAM access control policy on the specified + function. Replaces any existing policy. + Returns: + Callable[[~.SetIamPolicyRequest], + ~.Policy]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_iam_policy" not in self._stubs: + self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + "/google.iam.v1.IAMPolicy/SetIamPolicy", + request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["set_iam_policy"] + + @property + def get_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the get iam policy method over gRPC. + Gets the IAM access control policy for a function. + Returns an empty policy if the function exists and does + not have a policy set. + Returns: + Callable[[~.GetIamPolicyRequest], + ~.Policy]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_iam_policy" not in self._stubs: + self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + "/google.iam.v1.IAMPolicy/GetIamPolicy", + request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["get_iam_policy"] + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], iam_policy_pb2.TestIamPermissionsResponse + ]: + r"""Return a callable for the test iam permissions method over gRPC. + Tests the specified permissions against the IAM access control + policy for a function. If the function does not exist, this will + return an empty set of permissions, not a NOT_FOUND error. + Returns: + Callable[[~.TestIamPermissionsRequest], + ~.TestIamPermissionsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "test_iam_permissions" not in self._stubs: + self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + "/google.iam.v1.IAMPolicy/TestIamPermissions", + request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, + ) + return self._stubs["test_iam_permissions"] + + +__all__ = ( + 'CloudDeployGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py new file mode 100644 index 0000000..7b13af7 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .cloud_deploy import ( + AbandonReleaseRequest, + AbandonReleaseResponse, + AnthosCluster, + ApproveRolloutRequest, + ApproveRolloutResponse, + BuildArtifact, + CloudRunLocation, + CloudRunMetadata, + Config, + CreateDeliveryPipelineRequest, + CreateReleaseRequest, + CreateRolloutRequest, + CreateTargetRequest, + DefaultPool, + DeleteDeliveryPipelineRequest, + DeleteTargetRequest, + DeliveryPipeline, + DeployJob, + DeployJobRun, + DeployJobRunMetadata, + DeploymentJobs, + ExecutionConfig, + GetConfigRequest, + GetDeliveryPipelineRequest, + GetJobRunRequest, + GetReleaseRequest, + GetRolloutRequest, + GetTargetRequest, + GkeCluster, + Job, + JobRun, + ListDeliveryPipelinesRequest, + ListDeliveryPipelinesResponse, + ListJobRunsRequest, + ListJobRunsResponse, + ListReleasesRequest, + ListReleasesResponse, + ListRolloutsRequest, + ListRolloutsResponse, + ListTargetsRequest, + ListTargetsResponse, + Metadata, + OperationMetadata, + Phase, + PipelineCondition, + PipelineReadyCondition, + PrivatePool, + Release, + RetryJobRequest, + RetryJobResponse, + Rollout, + SerialPipeline, + SkaffoldVersion, + Stage, + Standard, + Strategy, + Target, + TargetArtifact, + TargetsPresentCondition, + UpdateDeliveryPipelineRequest, + UpdateTargetRequest, + VerifyJob, + VerifyJobRun, +) +from .deliverypipeline_notification_payload import ( + DeliveryPipelineNotificationEvent, +) +from .jobrun_notification_payload import ( + JobRunNotificationEvent, +) +from .release_notification_payload import ( + ReleaseNotificationEvent, +) +from .release_render_payload import ( + ReleaseRenderEvent, +) +from .rollout_notification_payload import ( + RolloutNotificationEvent, +) +from .target_notification_payload import ( + TargetNotificationEvent, +) + +__all__ = ( + 'AbandonReleaseRequest', + 'AbandonReleaseResponse', + 'AnthosCluster', + 'ApproveRolloutRequest', + 'ApproveRolloutResponse', + 'BuildArtifact', + 'CloudRunLocation', + 'CloudRunMetadata', + 'Config', + 'CreateDeliveryPipelineRequest', + 'CreateReleaseRequest', + 'CreateRolloutRequest', + 'CreateTargetRequest', + 'DefaultPool', + 'DeleteDeliveryPipelineRequest', + 'DeleteTargetRequest', + 'DeliveryPipeline', + 'DeployJob', + 'DeployJobRun', + 'DeployJobRunMetadata', + 'DeploymentJobs', + 'ExecutionConfig', + 'GetConfigRequest', + 'GetDeliveryPipelineRequest', + 'GetJobRunRequest', + 'GetReleaseRequest', + 'GetRolloutRequest', + 'GetTargetRequest', + 'GkeCluster', + 'Job', + 'JobRun', + 'ListDeliveryPipelinesRequest', + 'ListDeliveryPipelinesResponse', + 'ListJobRunsRequest', + 'ListJobRunsResponse', + 'ListReleasesRequest', + 'ListReleasesResponse', + 'ListRolloutsRequest', + 'ListRolloutsResponse', + 'ListTargetsRequest', + 'ListTargetsResponse', + 'Metadata', + 'OperationMetadata', + 'Phase', + 'PipelineCondition', + 'PipelineReadyCondition', + 'PrivatePool', + 'Release', + 'RetryJobRequest', + 'RetryJobResponse', + 'Rollout', + 'SerialPipeline', + 'SkaffoldVersion', + 'Stage', + 'Standard', + 'Strategy', + 'Target', + 'TargetArtifact', + 'TargetsPresentCondition', + 'UpdateDeliveryPipelineRequest', + 'UpdateTargetRequest', + 'VerifyJob', + 'VerifyJobRun', + 'DeliveryPipelineNotificationEvent', + 'JobRunNotificationEvent', + 'Type', + 'ReleaseNotificationEvent', + 'ReleaseRenderEvent', + 'RolloutNotificationEvent', + 'TargetNotificationEvent', +) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py new file mode 100644 index 0000000..2ff5e30 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py @@ -0,0 +1,2862 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import date_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'DeliveryPipeline', + 'SerialPipeline', + 'Stage', + 'Strategy', + 'Standard', + 'PipelineReadyCondition', + 'TargetsPresentCondition', + 'PipelineCondition', + 'ListDeliveryPipelinesRequest', + 'ListDeliveryPipelinesResponse', + 'GetDeliveryPipelineRequest', + 'CreateDeliveryPipelineRequest', + 'UpdateDeliveryPipelineRequest', + 'DeleteDeliveryPipelineRequest', + 'Target', + 'ExecutionConfig', + 'DefaultPool', + 'PrivatePool', + 'GkeCluster', + 'AnthosCluster', + 'CloudRunLocation', + 'ListTargetsRequest', + 'ListTargetsResponse', + 'GetTargetRequest', + 'CreateTargetRequest', + 'UpdateTargetRequest', + 'DeleteTargetRequest', + 'Release', + 'BuildArtifact', + 'TargetArtifact', + 'ListReleasesRequest', + 'ListReleasesResponse', + 'GetReleaseRequest', + 'CreateReleaseRequest', + 'Rollout', + 'Metadata', + 'DeployJobRunMetadata', + 'CloudRunMetadata', + 'Phase', + 'DeploymentJobs', + 'Job', + 'DeployJob', + 'VerifyJob', + 'ListRolloutsRequest', + 'ListRolloutsResponse', + 'GetRolloutRequest', + 'CreateRolloutRequest', + 'OperationMetadata', + 'ApproveRolloutRequest', + 'ApproveRolloutResponse', + 'RetryJobRequest', + 'RetryJobResponse', + 'AbandonReleaseRequest', + 'AbandonReleaseResponse', + 'JobRun', + 'DeployJobRun', + 'VerifyJobRun', + 'ListJobRunsRequest', + 'ListJobRunsResponse', + 'GetJobRunRequest', + 'Config', + 'SkaffoldVersion', + 'GetConfigRequest', + }, +) + + +class DeliveryPipeline(proto.Message): + r"""A ``DeliveryPipeline`` resource in the Google Cloud Deploy API. + + A ``DeliveryPipeline`` defines a pipeline through which a Skaffold + configuration can progress. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Optional. Name of the ``DeliveryPipeline``. Format is + projects/{project}/ + locations/{location}/deliveryPipelines/[a-z][a-z0-9-]{0,62}. + uid (str): + Output only. Unique identifier of the ``DeliveryPipeline``. + description (str): + Description of the ``DeliveryPipeline``. Max length is 255 + characters. + annotations (Mapping[str, str]): + User annotations. These attributes can only + be set and used by the user, and not by Google + Cloud Deploy. + labels (Mapping[str, str]): + Labels are attributes that can be set and used by both the + user and by Google Cloud Deploy. Labels must meet the + following constraints: + + - Keys and values can contain only lowercase letters, + numeric characters, underscores, and dashes. + - All characters must use UTF-8 encoding, and international + characters are allowed. + - Keys must start with a lowercase letter or international + character. + - Each resource is limited to a maximum of 64 labels. + + Both keys and values are additionally constrained to be <= + 128 bytes. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the pipeline was + created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Most recent time at which the + pipeline was updated. + serial_pipeline (google.cloud.deploy_v1.types.SerialPipeline): + SerialPipeline defines a sequential set of stages for a + ``DeliveryPipeline``. + + This field is a member of `oneof`_ ``pipeline``. + condition (google.cloud.deploy_v1.types.PipelineCondition): + Output only. Information around the state of + the Delivery Pipeline. + etag (str): + This checksum is computed by the server based + on the value of other fields, and may be sent on + update and delete requests to ensure the client + has an up-to-date value before proceeding. + suspended (bool): + When suspended, no new releases or rollouts + can be created, but in-progress ones will + complete. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + uid = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + serial_pipeline = proto.Field( + proto.MESSAGE, + number=8, + oneof='pipeline', + message='SerialPipeline', + ) + condition = proto.Field( + proto.MESSAGE, + number=11, + message='PipelineCondition', + ) + etag = proto.Field( + proto.STRING, + number=10, + ) + suspended = proto.Field( + proto.BOOL, + number=12, + ) + + +class SerialPipeline(proto.Message): + r"""SerialPipeline defines a sequential set of stages for a + ``DeliveryPipeline``. + + Attributes: + stages (Sequence[google.cloud.deploy_v1.types.Stage]): + Each stage specifies configuration for a ``Target``. The + ordering of this list defines the promotion flow. + """ + + stages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Stage', + ) + + +class Stage(proto.Message): + r"""Stage specifies a location to which to deploy. + + Attributes: + target_id (str): + The target_id to which this stage points. This field refers + exclusively to the last segment of a target name. For + example, this field would just be ``my-target`` (rather than + ``projects/project/locations/location/targets/my-target``). + The location of the ``Target`` is inferred to be the same as + the location of the ``DeliveryPipeline`` that contains this + ``Stage``. + profiles (Sequence[str]): + Skaffold profiles to use when rendering the manifest for + this stage's ``Target``. + strategy (google.cloud.deploy_v1.types.Strategy): + Optional. The strategy to use for a ``Rollout`` to this + stage. + """ + + target_id = proto.Field( + proto.STRING, + number=1, + ) + profiles = proto.RepeatedField( + proto.STRING, + number=2, + ) + strategy = proto.Field( + proto.MESSAGE, + number=5, + message='Strategy', + ) + + +class Strategy(proto.Message): + r"""Strategy contains deployment strategy information. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + standard (google.cloud.deploy_v1.types.Standard): + Standard deployment strategy executes a + single deploy and allows verifying the + deployment. + + This field is a member of `oneof`_ ``deployment_strategy``. + """ + + standard = proto.Field( + proto.MESSAGE, + number=1, + oneof='deployment_strategy', + message='Standard', + ) + + +class Standard(proto.Message): + r"""Standard represents the standard deployment strategy. + + Attributes: + verify (bool): + Whether to verify a deployment. + """ + + verify = proto.Field( + proto.BOOL, + number=1, + ) + + +class PipelineReadyCondition(proto.Message): + r"""PipelineReadyCondition contains information around the status + of the Pipeline. + + Attributes: + status (bool): + True if the Pipeline is in a valid state. Otherwise at least + one condition in ``PipelineCondition`` is in an invalid + state. Iterate over those conditions and see which + condition(s) has status = false to find out what is wrong + with the Pipeline. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Last time the condition was updated. + """ + + status = proto.Field( + proto.BOOL, + number=3, + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + + +class TargetsPresentCondition(proto.Message): + r"""TargetsPresentCondition contains information on any Targets + defined in the Delivery Pipeline that do not actually exist. + + Attributes: + status (bool): + True if there aren't any missing Targets. + missing_targets (Sequence[str]): + The list of Target names that are missing. For example, + projects/{project_id}/locations/{location_name}/targets/{target_name}. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Last time the condition was updated. + """ + + status = proto.Field( + proto.BOOL, + number=1, + ) + missing_targets = proto.RepeatedField( + proto.STRING, + number=2, + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + + +class PipelineCondition(proto.Message): + r"""PipelineCondition contains all conditions relevant to a + Delivery Pipeline. + + Attributes: + pipeline_ready_condition (google.cloud.deploy_v1.types.PipelineReadyCondition): + Details around the Pipeline's overall status. + targets_present_condition (google.cloud.deploy_v1.types.TargetsPresentCondition): + Detalis around targets enumerated in the + pipeline. + """ + + pipeline_ready_condition = proto.Field( + proto.MESSAGE, + number=1, + message='PipelineReadyCondition', + ) + targets_present_condition = proto.Field( + proto.MESSAGE, + number=3, + message='TargetsPresentCondition', + ) + + +class ListDeliveryPipelinesRequest(proto.Message): + r"""The request object for ``ListDeliveryPipelines``. + + Attributes: + parent (str): + Required. The parent, which owns this collection of + pipelines. Format must be + projects/{project_id}/locations/{location_name}. + page_size (int): + The maximum number of pipelines to return. + The service may return fewer than this value. If + unspecified, at most 50 pipelines will be + returned. The maximum value is 1000; values + above 1000 will be set to 1000. + page_token (str): + A page token, received from a previous + ``ListDeliveryPipelines`` call. Provide this to retrieve the + subsequent page. + + When paginating, all other provided parameters match the + call that provided the page token. + filter (str): + Filter pipelines to be returned. See + https://google.aip.dev/160 for more details. + order_by (str): + Field to sort by. See + https://google.aip.dev/132#ordering for more + details. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) + + +class ListDeliveryPipelinesResponse(proto.Message): + r"""The response object from ``ListDeliveryPipelines``. + + Attributes: + delivery_pipelines (Sequence[google.cloud.deploy_v1.types.DeliveryPipeline]): + The ``DeliveryPipeline`` objects. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (Sequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + delivery_pipelines = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='DeliveryPipeline', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetDeliveryPipelineRequest(proto.Message): + r"""The request object for ``GetDeliveryPipeline`` + + Attributes: + name (str): + Required. Name of the ``DeliveryPipeline``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateDeliveryPipelineRequest(proto.Message): + r"""The request object for ``CreateDeliveryPipeline``. + + Attributes: + parent (str): + Required. The parent collection in which the + ``DeliveryPipeline`` should be created. Format should be + projects/{project_id}/locations/{location_name}. + delivery_pipeline_id (str): + Required. ID of the ``DeliveryPipeline``. + delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): + Required. The ``DeliveryPipeline`` to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. If set to true, the request is + validated and the user is provided with an + expected result, but no actual change is made. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + delivery_pipeline_id = proto.Field( + proto.STRING, + number=2, + ) + delivery_pipeline = proto.Field( + proto.MESSAGE, + number=3, + message='DeliveryPipeline', + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + + +class UpdateDeliveryPipelineRequest(proto.Message): + r"""The request object for ``UpdateDeliveryPipeline``. + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. Field mask is used to specify the fields to be + overwritten in the ``DeliveryPipeline`` resource by the + update. The fields specified in the update_mask are relative + to the resource, not the full request. A field will be + overwritten if it is in the mask. If the user does not + provide a mask then all fields will be overwritten. + delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): + Required. The ``DeliveryPipeline`` to update. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + allow_missing (bool): + Optional. If set to true, updating a ``DeliveryPipeline`` + that does not exist will result in the creation of a new + ``DeliveryPipeline``. + validate_only (bool): + Optional. If set to true, the request is + validated and the user is provided with an + expected result, but no actual change is made. + """ + + update_mask = proto.Field( + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + delivery_pipeline = proto.Field( + proto.MESSAGE, + number=2, + message='DeliveryPipeline', + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + allow_missing = proto.Field( + proto.BOOL, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + + +class DeleteDeliveryPipelineRequest(proto.Message): + r"""The request object for ``DeleteDeliveryPipeline``. + + Attributes: + name (str): + Required. The name of the ``DeliveryPipeline`` to delete. + Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + allow_missing (bool): + Optional. If set to true, then deleting an already deleted + or non-existing ``DeliveryPipeline`` will succeed. + validate_only (bool): + Optional. If set, validate the request and + preview the review, but do not actually post it. + force (bool): + Optional. If set to true, all child resources + under this pipeline will also be deleted. + Otherwise, the request will only work if the + pipeline has no child resources. + etag (str): + Optional. This checksum is computed by the + server based on the value of other fields, and + may be sent on update and delete requests to + ensure the client has an up-to-date value before + proceeding. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) + allow_missing = proto.Field( + proto.BOOL, + number=3, + ) + validate_only = proto.Field( + proto.BOOL, + number=4, + ) + force = proto.Field( + proto.BOOL, + number=6, + ) + etag = proto.Field( + proto.STRING, + number=5, + ) + + +class Target(proto.Message): + r"""A ``Target`` resource in the Google Cloud Deploy API. + + A ``Target`` defines a location to which a Skaffold configuration + can be deployed. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Optional. Name of the ``Target``. Format is + projects/{project}/locations/{location}/targets/[a-z][a-z0-9-]{0,62}. + target_id (str): + Output only. Resource id of the ``Target``. + uid (str): + Output only. Unique identifier of the ``Target``. + description (str): + Optional. Description of the ``Target``. Max length is 255 + characters. + annotations (Mapping[str, str]): + Optional. User annotations. These attributes + can only be set and used by the user, and not by + Google Cloud Deploy. See + https://google.aip.dev/128#annotations for more + details such as format and size limitations. + labels (Mapping[str, str]): + Optional. Labels are attributes that can be set and used by + both the user and by Google Cloud Deploy. Labels must meet + the following constraints: + + - Keys and values can contain only lowercase letters, + numeric characters, underscores, and dashes. + - All characters must use UTF-8 encoding, and international + characters are allowed. + - Keys must start with a lowercase letter or international + character. + - Each resource is limited to a maximum of 64 labels. + + Both keys and values are additionally constrained to be <= + 128 bytes. + require_approval (bool): + Optional. Whether or not the ``Target`` requires approval. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``Target`` was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Most recent time at which the ``Target`` was + updated. + gke (google.cloud.deploy_v1.types.GkeCluster): + Information specifying a GKE Cluster. + + This field is a member of `oneof`_ ``deployment_target``. + anthos_cluster (google.cloud.deploy_v1.types.AnthosCluster): + Information specifying an Anthos Cluster. + + This field is a member of `oneof`_ ``deployment_target``. + run (google.cloud.deploy_v1.types.CloudRunLocation): + Information specifying a Cloud Run deployment + target. + + This field is a member of `oneof`_ ``deployment_target``. + etag (str): + Optional. This checksum is computed by the + server based on the value of other fields, and + may be sent on update and delete requests to + ensure the client has an up-to-date value before + proceeding. + execution_configs (Sequence[google.cloud.deploy_v1.types.ExecutionConfig]): + Configurations for all execution that relates to this + ``Target``. Each ``ExecutionEnvironmentUsage`` value may + only be used in a single configuration; using the same value + multiple times is an error. When one or more configurations + are specified, they must include the ``RENDER`` and + ``DEPLOY`` ``ExecutionEnvironmentUsage`` values. When no + configurations are specified, execution will use the default + specified in ``DefaultPool``. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + target_id = proto.Field( + proto.STRING, + number=2, + ) + uid = proto.Field( + proto.STRING, + number=3, + ) + description = proto.Field( + proto.STRING, + number=4, + ) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) + require_approval = proto.Field( + proto.BOOL, + number=13, + ) + create_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=9, + message=timestamp_pb2.Timestamp, + ) + gke = proto.Field( + proto.MESSAGE, + number=15, + oneof='deployment_target', + message='GkeCluster', + ) + anthos_cluster = proto.Field( + proto.MESSAGE, + number=17, + oneof='deployment_target', + message='AnthosCluster', + ) + run = proto.Field( + proto.MESSAGE, + number=18, + oneof='deployment_target', + message='CloudRunLocation', + ) + etag = proto.Field( + proto.STRING, + number=12, + ) + execution_configs = proto.RepeatedField( + proto.MESSAGE, + number=16, + message='ExecutionConfig', + ) + + +class ExecutionConfig(proto.Message): + r"""Configuration of the environment to use when calling + Skaffold. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + usages (Sequence[google.cloud.deploy_v1.types.ExecutionConfig.ExecutionEnvironmentUsage]): + Required. Usages when this configuration + should be applied. + default_pool (google.cloud.deploy_v1.types.DefaultPool): + Optional. Use default Cloud Build pool. + + This field is a member of `oneof`_ ``execution_environment``. + private_pool (google.cloud.deploy_v1.types.PrivatePool): + Optional. Use private Cloud Build pool. + + This field is a member of `oneof`_ ``execution_environment``. + worker_pool (str): + Optional. The resource name of the ``WorkerPool``, with the + format + ``projects/{project}/locations/{location}/workerPools/{worker_pool}``. + If this optional field is unspecified, the default Cloud + Build pool will be used. + service_account (str): + Optional. Google service account to use for execution. If + unspecified, the project execution service account + (-compute@developer.gserviceaccount.com) is + used. + artifact_storage (str): + Optional. Cloud Storage location in which to + store execution outputs. This can either be a + bucket ("gs://my-bucket") or a path within a + bucket ("gs://my-bucket/my-dir"). + If unspecified, a default bucket located in the + same region will be used. + execution_timeout (google.protobuf.duration_pb2.Duration): + Optional. Execution timeout for a Cloud Build + Execution. This must be between 10m and 24h in + seconds format. If unspecified, a default + timeout of 1h is used. + """ + class ExecutionEnvironmentUsage(proto.Enum): + r"""Possible usages of this configuration.""" + EXECUTION_ENVIRONMENT_USAGE_UNSPECIFIED = 0 + RENDER = 1 + DEPLOY = 2 + VERIFY = 3 + + usages = proto.RepeatedField( + proto.ENUM, + number=1, + enum=ExecutionEnvironmentUsage, + ) + default_pool = proto.Field( + proto.MESSAGE, + number=2, + oneof='execution_environment', + message='DefaultPool', + ) + private_pool = proto.Field( + proto.MESSAGE, + number=3, + oneof='execution_environment', + message='PrivatePool', + ) + worker_pool = proto.Field( + proto.STRING, + number=4, + ) + service_account = proto.Field( + proto.STRING, + number=5, + ) + artifact_storage = proto.Field( + proto.STRING, + number=6, + ) + execution_timeout = proto.Field( + proto.MESSAGE, + number=7, + message=duration_pb2.Duration, + ) + + +class DefaultPool(proto.Message): + r"""Execution using the default Cloud Build pool. + + Attributes: + service_account (str): + Optional. Google service account to use for execution. If + unspecified, the project execution service account + (-compute@developer.gserviceaccount.com) + will be used. + artifact_storage (str): + Optional. Cloud Storage location where + execution outputs should be stored. This can + either be a bucket ("gs://my-bucket") or a path + within a bucket ("gs://my-bucket/my-dir"). + If unspecified, a default bucket located in the + same region will be used. + """ + + service_account = proto.Field( + proto.STRING, + number=1, + ) + artifact_storage = proto.Field( + proto.STRING, + number=2, + ) + + +class PrivatePool(proto.Message): + r"""Execution using a private Cloud Build pool. + + Attributes: + worker_pool (str): + Required. Resource name of the Cloud Build worker pool to + use. The format is + ``projects/{project}/locations/{location}/workerPools/{pool}``. + service_account (str): + Optional. Google service account to use for execution. If + unspecified, the project execution service account + (-compute@developer.gserviceaccount.com) + will be used. + artifact_storage (str): + Optional. Cloud Storage location where + execution outputs should be stored. This can + either be a bucket ("gs://my-bucket") or a path + within a bucket ("gs://my-bucket/my-dir"). + If unspecified, a default bucket located in the + same region will be used. + """ + + worker_pool = proto.Field( + proto.STRING, + number=1, + ) + service_account = proto.Field( + proto.STRING, + number=2, + ) + artifact_storage = proto.Field( + proto.STRING, + number=3, + ) + + +class GkeCluster(proto.Message): + r"""Information specifying a GKE Cluster. + + Attributes: + cluster (str): + Information specifying a GKE Cluster. Format is + \`projects/{project_id}/locations/{location_id}/clusters/{cluster_id}. + internal_ip (bool): + Optional. If true, ``cluster`` is accessed using the private + IP address of the control plane endpoint. Otherwise, the + default IP address of the control plane endpoint is used. + The default IP address is the private IP address for + clusters with private control-plane endpoints and the public + IP address otherwise. + + Only specify this option when ``cluster`` is a `private GKE + cluster `__. + """ + + cluster = proto.Field( + proto.STRING, + number=1, + ) + internal_ip = proto.Field( + proto.BOOL, + number=2, + ) + + +class AnthosCluster(proto.Message): + r"""Information specifying an Anthos Cluster. + + Attributes: + membership (str): + Membership of the GKE Hub-registered cluster to which to + apply the Skaffold configuration. Format is + ``projects/{project}/locations/{location}/memberships/{membership_name}``. + """ + + membership = proto.Field( + proto.STRING, + number=1, + ) + + +class CloudRunLocation(proto.Message): + r"""Information specifying where to deploy a Cloud Run Service. + + Attributes: + location (str): + Required. The location for the Cloud Run Service. Format + must be ``projects/{project}/locations/{location}``. + """ + + location = proto.Field( + proto.STRING, + number=1, + ) + + +class ListTargetsRequest(proto.Message): + r"""The request object for ``ListTargets``. + + Attributes: + parent (str): + Required. The parent, which owns this collection of targets. + Format must be + projects/{project_id}/locations/{location_name}. + page_size (int): + Optional. The maximum number of ``Target`` objects to + return. The service may return fewer than this value. If + unspecified, at most 50 ``Target`` objects will be returned. + The maximum value is 1000; values above 1000 will be set to + 1000. + page_token (str): + Optional. A page token, received from a previous + ``ListTargets`` call. Provide this to retrieve the + subsequent page. + + When paginating, all other provided parameters match the + call that provided the page token. + filter (str): + Optional. Filter targets to be returned. See + https://google.aip.dev/160 for more details. + order_by (str): + Optional. Field to sort by. See + https://google.aip.dev/132#ordering for more + details. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) + + +class ListTargetsResponse(proto.Message): + r"""The response object from ``ListTargets``. + + Attributes: + targets (Sequence[google.cloud.deploy_v1.types.Target]): + The ``Target`` objects. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (Sequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + targets = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Target', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetTargetRequest(proto.Message): + r"""The request object for ``GetTarget``. + + Attributes: + name (str): + Required. Name of the ``Target``. Format must be + projects/{project_id}/locations/{location_name}/targets/{target_name}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateTargetRequest(proto.Message): + r"""The request object for ``CreateTarget``. + + Attributes: + parent (str): + Required. The parent collection in which the ``Target`` + should be created. Format should be + projects/{project_id}/locations/{location_name}. + target_id (str): + Required. ID of the ``Target``. + target (google.cloud.deploy_v1.types.Target): + Required. The ``Target`` to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. If set to true, the request is + validated and the user is provided with an + expected result, but no actual change is made. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + target_id = proto.Field( + proto.STRING, + number=2, + ) + target = proto.Field( + proto.MESSAGE, + number=3, + message='Target', + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + + +class UpdateTargetRequest(proto.Message): + r"""The request object for ``UpdateTarget``. + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. Field mask is used to specify the fields to be + overwritten in the Target resource by the update. The fields + specified in the update_mask are relative to the resource, + not the full request. A field will be overwritten if it is + in the mask. If the user does not provide a mask then all + fields will be overwritten. + target (google.cloud.deploy_v1.types.Target): + Required. The ``Target`` to update. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + allow_missing (bool): + Optional. If set to true, updating a ``Target`` that does + not exist will result in the creation of a new ``Target``. + validate_only (bool): + Optional. If set to true, the request is + validated and the user is provided with an + expected result, but no actual change is made. + """ + + update_mask = proto.Field( + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + target = proto.Field( + proto.MESSAGE, + number=2, + message='Target', + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + allow_missing = proto.Field( + proto.BOOL, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + + +class DeleteTargetRequest(proto.Message): + r"""The request object for ``DeleteTarget``. + + Attributes: + name (str): + Required. The name of the ``Target`` to delete. Format + should be + projects/{project_id}/locations/{location_name}/targets/{target_name}. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + allow_missing (bool): + Optional. If set to true, then deleting an + already deleted or non-existing DeliveryPipeline + will succeed. + validate_only (bool): + Optional. If set, validate the request and + preview the review, but do not actually post it. + etag (str): + Optional. This checksum is computed by the + server based on the value of other fields, and + may be sent on update and delete requests to + ensure the client has an up-to-date value before + proceeding. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) + allow_missing = proto.Field( + proto.BOOL, + number=3, + ) + validate_only = proto.Field( + proto.BOOL, + number=4, + ) + etag = proto.Field( + proto.STRING, + number=5, + ) + + +class Release(proto.Message): + r"""A ``Release`` resource in the Google Cloud Deploy API. + + A ``Release`` defines a specific Skaffold configuration instance + that can be deployed. + + Attributes: + name (str): + Optional. Name of the ``Release``. Format is + projects/{project}/ + locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/[a-z][a-z0-9-]{0,62}. + uid (str): + Output only. Unique identifier of the ``Release``. + description (str): + Description of the ``Release``. Max length is 255 + characters. + annotations (Mapping[str, str]): + User annotations. These attributes can only + be set and used by the user, and not by Google + Cloud Deploy. See + https://google.aip.dev/128#annotations for more + details such as format and size limitations. + labels (Mapping[str, str]): + Labels are attributes that can be set and used by both the + user and by Google Cloud Deploy. Labels must meet the + following constraints: + + - Keys and values can contain only lowercase letters, + numeric characters, underscores, and dashes. + - All characters must use UTF-8 encoding, and international + characters are allowed. + - Keys must start with a lowercase letter or international + character. + - Each resource is limited to a maximum of 64 labels. + + Both keys and values are additionally constrained to be <= + 128 bytes. + abandoned (bool): + Output only. Indicates whether this is an + abandoned release. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``Release`` was created. + render_start_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the render began. + render_end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the render + completed. + skaffold_config_uri (str): + Cloud Storage URI of tar.gz archive + containing Skaffold configuration. + skaffold_config_path (str): + Filepath of the Skaffold config inside of the + config URI. + build_artifacts (Sequence[google.cloud.deploy_v1.types.BuildArtifact]): + List of artifacts to pass through to Skaffold + command. + delivery_pipeline_snapshot (google.cloud.deploy_v1.types.DeliveryPipeline): + Output only. Snapshot of the parent pipeline + taken at release creation time. + target_snapshots (Sequence[google.cloud.deploy_v1.types.Target]): + Output only. Snapshot of the targets taken at + release creation time. + render_state (google.cloud.deploy_v1.types.Release.RenderState): + Output only. Current state of the render + operation. + etag (str): + This checksum is computed by the server based + on the value of other fields, and may be sent on + update and delete requests to ensure the client + has an up-to-date value before proceeding. + skaffold_version (str): + The Skaffold version to use when operating on + this release, such as "1.20.0". Not all versions + are valid; Google Cloud Deploy supports a + specific set of versions. + + If unset, the most recent supported Skaffold + version will be used. + target_artifacts (Mapping[str, google.cloud.deploy_v1.types.TargetArtifact]): + Output only. Map from target ID to the target + artifacts created during the render operation. + target_renders (Mapping[str, google.cloud.deploy_v1.types.Release.TargetRender]): + Output only. Map from target ID to details of + the render operation for that target. + """ + class RenderState(proto.Enum): + r"""Valid states of the render operation.""" + RENDER_STATE_UNSPECIFIED = 0 + SUCCEEDED = 1 + FAILED = 2 + IN_PROGRESS = 3 + + class TargetRender(proto.Message): + r"""Details of rendering for a single target. + + Attributes: + rendering_build (str): + Output only. The resource name of the Cloud Build ``Build`` + object that is used to render the manifest for this target. + Format is + ``projects/{project}/locations/{location}/builds/{build}``. + rendering_state (google.cloud.deploy_v1.types.Release.TargetRender.TargetRenderState): + Output only. Current state of the render + operation for this Target. + failure_cause (google.cloud.deploy_v1.types.Release.TargetRender.FailureCause): + Output only. Reason this render failed. This + will always be unspecified while the render in + progress. + failure_message (str): + Output only. Additional information about the + render failure, if available. + """ + class TargetRenderState(proto.Enum): + r"""Valid states of the render operation.""" + TARGET_RENDER_STATE_UNSPECIFIED = 0 + SUCCEEDED = 1 + FAILED = 2 + IN_PROGRESS = 3 + + class FailureCause(proto.Enum): + r"""Well-known rendering failures.""" + FAILURE_CAUSE_UNSPECIFIED = 0 + CLOUD_BUILD_UNAVAILABLE = 1 + EXECUTION_FAILED = 2 + + rendering_build = proto.Field( + proto.STRING, + number=1, + ) + rendering_state = proto.Field( + proto.ENUM, + number=2, + enum='Release.TargetRender.TargetRenderState', + ) + failure_cause = proto.Field( + proto.ENUM, + number=4, + enum='Release.TargetRender.FailureCause', + ) + failure_message = proto.Field( + proto.STRING, + number=5, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + uid = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + abandoned = proto.Field( + proto.BOOL, + number=23, + ) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + render_start_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + render_end_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + skaffold_config_uri = proto.Field( + proto.STRING, + number=17, + ) + skaffold_config_path = proto.Field( + proto.STRING, + number=9, + ) + build_artifacts = proto.RepeatedField( + proto.MESSAGE, + number=10, + message='BuildArtifact', + ) + delivery_pipeline_snapshot = proto.Field( + proto.MESSAGE, + number=11, + message='DeliveryPipeline', + ) + target_snapshots = proto.RepeatedField( + proto.MESSAGE, + number=12, + message='Target', + ) + render_state = proto.Field( + proto.ENUM, + number=13, + enum=RenderState, + ) + etag = proto.Field( + proto.STRING, + number=16, + ) + skaffold_version = proto.Field( + proto.STRING, + number=19, + ) + target_artifacts = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=20, + message='TargetArtifact', + ) + target_renders = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=22, + message=TargetRender, + ) + + +class BuildArtifact(proto.Message): + r"""Description of an a image to use during Skaffold rendering. + + Attributes: + image (str): + Image name in Skaffold configuration. + tag (str): + Image tag to use. This will generally be the + full path to an image, such as + "gcr.io/my-project/busybox:1.2.3" or + "gcr.io/my-project/busybox@sha256:abc123". + """ + + image = proto.Field( + proto.STRING, + number=3, + ) + tag = proto.Field( + proto.STRING, + number=2, + ) + + +class TargetArtifact(proto.Message): + r"""The artifacts produced by a target render operation. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + artifact_uri (str): + Output only. URI of a directory containing + the artifacts. This contains deployment + configuration used by Skaffold during a rollout, + and all paths are relative to this location. + + This field is a member of `oneof`_ ``uri``. + skaffold_config_path (str): + Output only. File path of the resolved + Skaffold configuration relative to the URI. + manifest_path (str): + Output only. File path of the rendered + manifest relative to the URI. + """ + + artifact_uri = proto.Field( + proto.STRING, + number=4, + oneof='uri', + ) + skaffold_config_path = proto.Field( + proto.STRING, + number=2, + ) + manifest_path = proto.Field( + proto.STRING, + number=3, + ) + + +class ListReleasesRequest(proto.Message): + r"""The request object for ``ListReleases``. + + Attributes: + parent (str): + Required. The ``DeliveryPipeline`` which owns this + collection of ``Release`` objects. + page_size (int): + Optional. The maximum number of ``Release`` objects to + return. The service may return fewer than this value. If + unspecified, at most 50 ``Release`` objects will be + returned. The maximum value is 1000; values above 1000 will + be set to 1000. + page_token (str): + Optional. A page token, received from a previous + ``ListReleases`` call. Provide this to retrieve the + subsequent page. + + When paginating, all other provided parameters match the + call that provided the page token. + filter (str): + Optional. Filter releases to be returned. See + https://google.aip.dev/160 for more details. + order_by (str): + Optional. Field to sort by. See + https://google.aip.dev/132#ordering for more + details. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) + + +class ListReleasesResponse(proto.Message): + r"""The response object from ``ListReleases``. + + Attributes: + releases (Sequence[google.cloud.deploy_v1.types.Release]): + The ``Release`` objects. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (Sequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + releases = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Release', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetReleaseRequest(proto.Message): + r"""The request object for ``GetRelease``. + + Attributes: + name (str): + Required. Name of the ``Release``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateReleaseRequest(proto.Message): + r"""The request object for ``CreateRelease``, + + Attributes: + parent (str): + Required. The parent collection in which the ``Release`` + should be created. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. + release_id (str): + Required. ID of the ``Release``. + release (google.cloud.deploy_v1.types.Release): + Required. The ``Release`` to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. If set to true, the request is + validated and the user is provided with an + expected result, but no actual change is made. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + release_id = proto.Field( + proto.STRING, + number=2, + ) + release = proto.Field( + proto.MESSAGE, + number=3, + message='Release', + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + + +class Rollout(proto.Message): + r"""A ``Rollout`` resource in the Google Cloud Deploy API. + + A ``Rollout`` contains information around a specific deployment to a + ``Target``. + + Attributes: + name (str): + Optional. Name of the ``Rollout``. Format is + projects/{project}/ + locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}/rollouts/[a-z][a-z0-9-]{0,62}. + uid (str): + Output only. Unique identifier of the ``Rollout``. + description (str): + Description of the ``Rollout`` for user purposes. Max length + is 255 characters. + annotations (Mapping[str, str]): + User annotations. These attributes can only + be set and used by the user, and not by Google + Cloud Deploy. See + https://google.aip.dev/128#annotations for more + details such as format and size limitations. + labels (Mapping[str, str]): + Labels are attributes that can be set and used by both the + user and by Google Cloud Deploy. Labels must meet the + following constraints: + + - Keys and values can contain only lowercase letters, + numeric characters, underscores, and dashes. + - All characters must use UTF-8 encoding, and international + characters are allowed. + - Keys must start with a lowercase letter or international + character. + - Each resource is limited to a maximum of 64 labels. + + Both keys and values are additionally constrained to be <= + 128 bytes. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``Rollout`` was created. + approve_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``Rollout`` was approved. + enqueue_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``Rollout`` was enqueued. + deploy_start_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``Rollout`` started + deploying. + deploy_end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``Rollout`` finished + deploying. + target_id (str): + Required. The ID of Target to which this ``Rollout`` is + deploying. + approval_state (google.cloud.deploy_v1.types.Rollout.ApprovalState): + Output only. Approval state of the ``Rollout``. + state (google.cloud.deploy_v1.types.Rollout.State): + Output only. Current state of the ``Rollout``. + failure_reason (str): + Output only. Additional information about the + rollout failure, if available. + deploying_build (str): + Output only. The resource name of the Cloud Build ``Build`` + object that is used to deploy the Rollout. Format is + ``projects/{project}/locations/{location}/builds/{build}``. + etag (str): + This checksum is computed by the server based + on the value of other fields, and may be sent on + update and delete requests to ensure the client + has an up-to-date value before proceeding. + deploy_failure_cause (google.cloud.deploy_v1.types.Rollout.FailureCause): + Output only. The reason this rollout failed. + This will always be unspecified while the + rollout is in progress. + phases (Sequence[google.cloud.deploy_v1.types.Phase]): + Output only. The phases that represent the workflows of this + ``Rollout``. + metadata (google.cloud.deploy_v1.types.Metadata): + Output only. Metadata contains information + about the rollout. + """ + class ApprovalState(proto.Enum): + r"""Valid approval states of a ``Rollout``.""" + APPROVAL_STATE_UNSPECIFIED = 0 + NEEDS_APPROVAL = 1 + DOES_NOT_NEED_APPROVAL = 2 + APPROVED = 3 + REJECTED = 4 + + class State(proto.Enum): + r"""Valid states of a ``Rollout``.""" + STATE_UNSPECIFIED = 0 + SUCCEEDED = 1 + FAILED = 2 + IN_PROGRESS = 3 + PENDING_APPROVAL = 4 + APPROVAL_REJECTED = 5 + PENDING = 6 + PENDING_RELEASE = 7 + + class FailureCause(proto.Enum): + r"""Well-known rollout failures.""" + FAILURE_CAUSE_UNSPECIFIED = 0 + CLOUD_BUILD_UNAVAILABLE = 1 + EXECUTION_FAILED = 2 + DEADLINE_EXCEEDED = 3 + RELEASE_FAILED = 4 + RELEASE_ABANDONED = 5 + VERIFICATION_CONFIG_NOT_FOUND = 6 + + name = proto.Field( + proto.STRING, + number=1, + ) + uid = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + annotations = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + approve_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + enqueue_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + deploy_start_time = proto.Field( + proto.MESSAGE, + number=9, + message=timestamp_pb2.Timestamp, + ) + deploy_end_time = proto.Field( + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, + ) + target_id = proto.Field( + proto.STRING, + number=18, + ) + approval_state = proto.Field( + proto.ENUM, + number=12, + enum=ApprovalState, + ) + state = proto.Field( + proto.ENUM, + number=13, + enum=State, + ) + failure_reason = proto.Field( + proto.STRING, + number=14, + ) + deploying_build = proto.Field( + proto.STRING, + number=17, + ) + etag = proto.Field( + proto.STRING, + number=16, + ) + deploy_failure_cause = proto.Field( + proto.ENUM, + number=19, + enum=FailureCause, + ) + phases = proto.RepeatedField( + proto.MESSAGE, + number=23, + message='Phase', + ) + metadata = proto.Field( + proto.MESSAGE, + number=24, + message='Metadata', + ) + + +class Metadata(proto.Message): + r"""Metadata includes information associated with a ``Rollout``. + + Attributes: + cloud_run (google.cloud.deploy_v1.types.CloudRunMetadata): + Output only. The name of the Cloud Run Service that is + associated with a ``Rollout``. + """ + + cloud_run = proto.Field( + proto.MESSAGE, + number=1, + message='CloudRunMetadata', + ) + + +class DeployJobRunMetadata(proto.Message): + r"""DeployJobRunMetadata surfaces information associated with a + ``DeployJobRun`` to the user. + + Attributes: + cloud_run (google.cloud.deploy_v1.types.CloudRunMetadata): + Output only. The name of the Cloud Run Service that is + associated with a ``DeployJobRun``. + """ + + cloud_run = proto.Field( + proto.MESSAGE, + number=1, + message='CloudRunMetadata', + ) + + +class CloudRunMetadata(proto.Message): + r"""CloudRunMetadata contains information from a Cloud Run + deployment. + + Attributes: + service (str): + Output only. The name of the Cloud Run Service that is + associated with a ``Rollout``. Format is + projects/{project}/locations/{location}/services/{service}. + service_urls (Sequence[str]): + Output only. The Cloud Run Service urls that are associated + with a ``Rollout``. + revision (str): + Output only. The Cloud Run Revision id associated with a + ``Rollout``. + """ + + service = proto.Field( + proto.STRING, + number=1, + ) + service_urls = proto.RepeatedField( + proto.STRING, + number=2, + ) + revision = proto.Field( + proto.STRING, + number=3, + ) + + +class Phase(proto.Message): + r"""Phase represents a collection of jobs that are logically grouped + together for a ``Rollout``. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + id (str): + Output only. The ID of the Phase. + state (google.cloud.deploy_v1.types.Phase.State): + Output only. Current state of the Phase. + deployment_jobs (google.cloud.deploy_v1.types.DeploymentJobs): + Output only. Deployment job composition. + + This field is a member of `oneof`_ ``jobs``. + """ + class State(proto.Enum): + r"""Valid states of a Phase.""" + STATE_UNSPECIFIED = 0 + PENDING = 1 + IN_PROGRESS = 2 + SUCCEEDED = 3 + FAILED = 4 + ABORTED = 5 + + id = proto.Field( + proto.STRING, + number=1, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=State, + ) + deployment_jobs = proto.Field( + proto.MESSAGE, + number=4, + oneof='jobs', + message='DeploymentJobs', + ) + + +class DeploymentJobs(proto.Message): + r"""Deployment job composition. + + Attributes: + deploy_job (google.cloud.deploy_v1.types.Job): + Output only. The deploy Job. This is the + first job run in the phase. + verify_job (google.cloud.deploy_v1.types.Job): + Output only. The verify Job. Runs after a + deploy if the deploy succeeds. + """ + + deploy_job = proto.Field( + proto.MESSAGE, + number=1, + message='Job', + ) + verify_job = proto.Field( + proto.MESSAGE, + number=2, + message='Job', + ) + + +class Job(proto.Message): + r"""Job represents an operation for a ``Rollout``. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + id (str): + Output only. The ID of the Job. + state (google.cloud.deploy_v1.types.Job.State): + Output only. The current state of the Job. + job_run (str): + Output only. The name of the ``JobRun`` responsible for the + most recent invocation of this Job. + deploy_job (google.cloud.deploy_v1.types.DeployJob): + Output only. A deploy Job. + + This field is a member of `oneof`_ ``job_type``. + verify_job (google.cloud.deploy_v1.types.VerifyJob): + Output only. A verify Job. + + This field is a member of `oneof`_ ``job_type``. + """ + class State(proto.Enum): + r"""Valid states of a Job.""" + STATE_UNSPECIFIED = 0 + PENDING = 1 + DISABLED = 2 + IN_PROGRESS = 3 + SUCCEEDED = 4 + FAILED = 5 + ABORTED = 6 + + id = proto.Field( + proto.STRING, + number=1, + ) + state = proto.Field( + proto.ENUM, + number=2, + enum=State, + ) + job_run = proto.Field( + proto.STRING, + number=3, + ) + deploy_job = proto.Field( + proto.MESSAGE, + number=4, + oneof='job_type', + message='DeployJob', + ) + verify_job = proto.Field( + proto.MESSAGE, + number=5, + oneof='job_type', + message='VerifyJob', + ) + + +class DeployJob(proto.Message): + r"""A deploy Job. + """ + + +class VerifyJob(proto.Message): + r"""A verify Job. + """ + + +class ListRolloutsRequest(proto.Message): + r"""ListRolloutsRequest is the request object used by ``ListRollouts``. + + Attributes: + parent (str): + Required. The ``Release`` which owns this collection of + ``Rollout`` objects. + page_size (int): + Optional. The maximum number of ``Rollout`` objects to + return. The service may return fewer than this value. If + unspecified, at most 50 ``Rollout`` objects will be + returned. The maximum value is 1000; values above 1000 will + be set to 1000. + page_token (str): + Optional. A page token, received from a previous + ``ListRollouts`` call. Provide this to retrieve the + subsequent page. + + When paginating, all other provided parameters match the + call that provided the page token. + filter (str): + Optional. Filter rollouts to be returned. See + https://google.aip.dev/160 for more details. + order_by (str): + Optional. Field to sort by. See + https://google.aip.dev/132#ordering for more + details. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) + + +class ListRolloutsResponse(proto.Message): + r"""ListRolloutsResponse is the response object reutrned by + ``ListRollouts``. + + Attributes: + rollouts (Sequence[google.cloud.deploy_v1.types.Rollout]): + The ``Rollout`` objects. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (Sequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + rollouts = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Rollout', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetRolloutRequest(proto.Message): + r"""GetRolloutRequest is the request object used by ``GetRollout``. + + Attributes: + name (str): + Required. Name of the ``Rollout``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateRolloutRequest(proto.Message): + r"""CreateRolloutRequest is the request object used by + ``CreateRollout``. + + Attributes: + parent (str): + Required. The parent collection in which the ``Rollout`` + should be created. Format should be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. + rollout_id (str): + Required. ID of the ``Rollout``. + rollout (google.cloud.deploy_v1.types.Rollout): + Required. The ``Rollout`` to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. If set to true, the request is + validated and the user is provided with an + expected result, but no actual change is made. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + rollout_id = proto.Field( + proto.STRING, + number=2, + ) + rollout = proto.Field( + proto.MESSAGE, + number=3, + message='Rollout', + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + + +class OperationMetadata(proto.Message): + r"""Represents the metadata of the long-running operation. + + Attributes: + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation was + created. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation finished + running. + target (str): + Output only. Server-defined resource path for + the target of the operation. + verb (str): + Output only. Name of the verb executed by the + operation. + status_message (str): + Output only. Human-readable status of the + operation, if any. + requested_cancellation (bool): + Output only. Identifies whether the user has requested + cancellation of the operation. Operations that have + successfully been cancelled have [Operation.error][] value + with a [google.rpc.Status.code][google.rpc.Status.code] of + 1, corresponding to ``Code.CANCELLED``. + api_version (str): + Output only. API version used to start the + operation. + """ + + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + status_message = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation = proto.Field( + proto.BOOL, + number=6, + ) + api_version = proto.Field( + proto.STRING, + number=7, + ) + + +class ApproveRolloutRequest(proto.Message): + r"""The request object used by ``ApproveRollout``. + + Attributes: + name (str): + Required. Name of the Rollout. Format is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}/rollouts/{rollout}. + approved (bool): + Required. True = approve; false = reject + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + approved = proto.Field( + proto.BOOL, + number=2, + ) + + +class ApproveRolloutResponse(proto.Message): + r"""The response object from ``ApproveRollout``. + """ + + +class RetryJobRequest(proto.Message): + r"""RetryJobRequest is the request object used by ``RetryJob``. + + Attributes: + rollout (str): + Required. Name of the Rollout. Format is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}/rollouts/{rollout}. + phase_id (str): + Required. The phase ID the Job to retry + belongs to. + job_id (str): + Required. The job ID for the Job to retry. + """ + + rollout = proto.Field( + proto.STRING, + number=1, + ) + phase_id = proto.Field( + proto.STRING, + number=2, + ) + job_id = proto.Field( + proto.STRING, + number=3, + ) + + +class RetryJobResponse(proto.Message): + r"""The response object from 'RetryJob'. + """ + + +class AbandonReleaseRequest(proto.Message): + r"""The request object used by ``AbandonRelease``. + + Attributes: + name (str): + Required. Name of the Release. Format is + projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ + releases/{release}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class AbandonReleaseResponse(proto.Message): + r"""The response object for ``AbandonRelease``. + """ + + +class JobRun(proto.Message): + r"""A ``JobRun`` resource in the Google Cloud Deploy API. + + A ``JobRun`` contains information of a single ``Rollout`` job + evaluation. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Optional. Name of the ``JobRun``. Format is + projects/{project}/locations/{location}/ + deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/ + {rollouts}/jobRuns/{uuid}. + uid (str): + Output only. Unique identifier of the ``JobRun``. + phase_id (str): + Output only. ID of the ``Rollout`` phase this ``JobRun`` + belongs in. + job_id (str): + Output only. ID of the ``Rollout`` job this ``JobRun`` + corresponds to. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``JobRun`` was created. + start_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``JobRun`` was started. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time at which the ``JobRun`` ended. + state (google.cloud.deploy_v1.types.JobRun.State): + Output only. The current state of the ``JobRun``. + deploy_job_run (google.cloud.deploy_v1.types.DeployJobRun): + Output only. Information specific to a deploy ``JobRun``. + + This field is a member of `oneof`_ ``job_run``. + verify_job_run (google.cloud.deploy_v1.types.VerifyJobRun): + Output only. Information specific to a verify ``JobRun``. + + This field is a member of `oneof`_ ``job_run``. + etag (str): + Output only. This checksum is computed by the + server based on the value of other fields, and + may be sent on update and delete requests to + ensure the client has an up-to-date value before + proceeding. + """ + class State(proto.Enum): + r"""Valid states of a ``JobRun``.""" + STATE_UNSPECIFIED = 0 + IN_PROGRESS = 1 + SUCCEEDED = 2 + FAILED = 3 + + name = proto.Field( + proto.STRING, + number=1, + ) + uid = proto.Field( + proto.STRING, + number=2, + ) + phase_id = proto.Field( + proto.STRING, + number=3, + ) + job_id = proto.Field( + proto.STRING, + number=4, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + start_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.ENUM, + number=8, + enum=State, + ) + deploy_job_run = proto.Field( + proto.MESSAGE, + number=9, + oneof='job_run', + message='DeployJobRun', + ) + verify_job_run = proto.Field( + proto.MESSAGE, + number=10, + oneof='job_run', + message='VerifyJobRun', + ) + etag = proto.Field( + proto.STRING, + number=11, + ) + + +class DeployJobRun(proto.Message): + r"""DeployJobRun contains information specific to a deploy ``JobRun``. + + Attributes: + build (str): + Output only. The resource name of the Cloud Build ``Build`` + object that is used to deploy. Format is + projects/{project}/locations/{location}/builds/{build}. + failure_cause (google.cloud.deploy_v1.types.DeployJobRun.FailureCause): + Output only. The reason the deploy failed. + This will always be unspecified while the deploy + is in progress or if it succeeded. + failure_message (str): + Output only. Additional information about the + deploy failure, if available. + metadata (google.cloud.deploy_v1.types.DeployJobRunMetadata): + Output only. Metadata containing information + about the deploy job run. + """ + class FailureCause(proto.Enum): + r"""Well-known deploy failures.""" + FAILURE_CAUSE_UNSPECIFIED = 0 + CLOUD_BUILD_UNAVAILABLE = 1 + EXECUTION_FAILED = 2 + DEADLINE_EXCEEDED = 3 + + build = proto.Field( + proto.STRING, + number=1, + ) + failure_cause = proto.Field( + proto.ENUM, + number=2, + enum=FailureCause, + ) + failure_message = proto.Field( + proto.STRING, + number=3, + ) + metadata = proto.Field( + proto.MESSAGE, + number=4, + message='DeployJobRunMetadata', + ) + + +class VerifyJobRun(proto.Message): + r"""VerifyJobRun contains information specific to a verify ``JobRun``. + + Attributes: + build (str): + Output only. The resource name of the Cloud Build ``Build`` + object that is used to verify. Format is + projects/{project}/locations/{location}/builds/{build}. + artifact_uri (str): + Output only. URI of a directory containing + the verify artifacts. This contains the Skaffold + event log. + event_log_path (str): + Output only. File path of the Skaffold event + log relative to the artifact URI. + failure_cause (google.cloud.deploy_v1.types.VerifyJobRun.FailureCause): + Output only. The reason the verify failed. + This will always be unspecified while the verify + is in progress or if it succeeded. + failure_message (str): + Output only. Additional information about the + verify failure, if available. + """ + class FailureCause(proto.Enum): + r"""Well-known verify failures.""" + FAILURE_CAUSE_UNSPECIFIED = 0 + CLOUD_BUILD_UNAVAILABLE = 1 + EXECUTION_FAILED = 2 + DEADLINE_EXCEEDED = 3 + VERIFICATION_CONFIG_NOT_FOUND = 4 + + build = proto.Field( + proto.STRING, + number=1, + ) + artifact_uri = proto.Field( + proto.STRING, + number=2, + ) + event_log_path = proto.Field( + proto.STRING, + number=3, + ) + failure_cause = proto.Field( + proto.ENUM, + number=4, + enum=FailureCause, + ) + failure_message = proto.Field( + proto.STRING, + number=5, + ) + + +class ListJobRunsRequest(proto.Message): + r"""ListJobRunsRequest is the request object used by ``ListJobRuns``. + + Attributes: + parent (str): + Required. The ``Rollout`` which owns this collection of + ``JobRun`` objects. + page_size (int): + Optional. The maximum number of ``JobRun`` objects to + return. The service may return fewer than this value. If + unspecified, at most 50 ``JobRun`` objects will be returned. + The maximum value is 1000; values above 1000 will be set to + 1000. + page_token (str): + Optional. A page token, received from a previous + ``ListJobRuns`` call. Provide this to retrieve the + subsequent page. + + When paginating, all other provided parameters match the + call that provided the page token. + filter (str): + Optional. Filter results to be returned. See + https://google.aip.dev/160 for more details. + order_by (str): + Optional. Field to sort by. See + https://google.aip.dev/132#ordering for more + details. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) + + +class ListJobRunsResponse(proto.Message): + r"""ListJobRunsResponse is the response object returned by + ``ListJobRuns``. + + Attributes: + job_runs (Sequence[google.cloud.deploy_v1.types.JobRun]): + The ``JobRun`` objects. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (Sequence[str]): + Locations that could not be reached + """ + + @property + def raw_page(self): + return self + + job_runs = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='JobRun', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetJobRunRequest(proto.Message): + r"""GetJobRunRequest is the request object used by ``GetJobRun``. + + Attributes: + name (str): + Required. Name of the ``JobRun``. Format must be + projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class Config(proto.Message): + r"""Service-wide configuration. + + Attributes: + name (str): + Name of the configuration. + supported_versions (Sequence[google.cloud.deploy_v1.types.SkaffoldVersion]): + Output only. All supported versions of + Skaffold. + default_skaffold_version (str): + Output only. Default Skaffold version that is + assigned when a Release is created without + specifying a Skaffold version. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + supported_versions = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='SkaffoldVersion', + ) + default_skaffold_version = proto.Field( + proto.STRING, + number=3, + ) + + +class SkaffoldVersion(proto.Message): + r"""Details of a supported Skaffold version. + + Attributes: + version (str): + Release version number. For example, + "1.20.3". + support_end_date (google.type.date_pb2.Date): + Date when this version is expected to no + longer be supported. + """ + + version = proto.Field( + proto.STRING, + number=1, + ) + support_end_date = proto.Field( + proto.MESSAGE, + number=2, + message=date_pb2.Date, + ) + + +class GetConfigRequest(proto.Message): + r"""Request to get a configuration. + + Attributes: + name (str): + Required. Name of requested configuration. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py new file mode 100644 index 0000000..f8ab52b --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.deploy_v1.types import log_enums + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'DeliveryPipelineNotificationEvent', + }, +) + + +class DeliveryPipelineNotificationEvent(proto.Message): + r"""Payload proto for + "clouddeploy.googleapis.com/deliverypipeline_notification" Platform + Log event that describes the failure to send delivery pipeline + status change Pub/Sub notification. + + Attributes: + message (str): + Debug message for when a notification fails + to send. + delivery_pipeline (str): + The name of the ``Delivery Pipeline``. + type_ (google.cloud.deploy_v1.types.Type): + Type of this notification, e.g. for a Pub/Sub + failure. + """ + + message = proto.Field( + proto.STRING, + number=1, + ) + delivery_pipeline = proto.Field( + proto.STRING, + number=2, + ) + type_ = proto.Field( + proto.ENUM, + number=3, + enum=log_enums.Type, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py new file mode 100644 index 0000000..e645039 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.deploy_v1.types import log_enums + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'JobRunNotificationEvent', + }, +) + + +class JobRunNotificationEvent(proto.Message): + r"""Payload proto for "clouddeploy.googleapis.com/jobrun_notification" + Platform Log event that describes the failure to send JobRun + resource update Pub/Sub notification. + + Attributes: + message (str): + Debug message for when a notification fails + to send. + job_run (str): + The name of the ``JobRun``. + pipeline_uid (str): + Unique identifier of the ``DeliveryPipeline``. + release_uid (str): + Unique identifier of the ``Release``. + rollout_uid (str): + Unique identifier of the ``Rollout``. + target_id (str): + ID of the ``Target``. + type_ (google.cloud.deploy_v1.types.Type): + Type of this notification, e.g. for a Pub/Sub + failure. + """ + + message = proto.Field( + proto.STRING, + number=1, + ) + job_run = proto.Field( + proto.STRING, + number=2, + ) + pipeline_uid = proto.Field( + proto.STRING, + number=3, + ) + release_uid = proto.Field( + proto.STRING, + number=4, + ) + rollout_uid = proto.Field( + proto.STRING, + number=5, + ) + target_id = proto.Field( + proto.STRING, + number=6, + ) + type_ = proto.Field( + proto.ENUM, + number=7, + enum=log_enums.Type, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py new file mode 100644 index 0000000..ba4f410 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'Type', + }, +) + + +class Type(proto.Enum): + r"""Type indicates the type of the log entry and can be used as a + filter. + """ + TYPE_UNSPECIFIED = 0 + TYPE_PUBSUB_NOTIFICATION_FAILURE = 1 + TYPE_RENDER_STATUES_CHANGE = 2 + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py new file mode 100644 index 0000000..fec3657 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.deploy_v1.types import log_enums + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'ReleaseNotificationEvent', + }, +) + + +class ReleaseNotificationEvent(proto.Message): + r"""Payload proto for "clouddeploy.googleapis.com/release_notification" + Platform Log event that describes the failure to send release status + change Pub/Sub notification. + + Attributes: + message (str): + Debug message for when a notification fails + to send. + release (str): + The name of the ``Release``. + type_ (google.cloud.deploy_v1.types.Type): + Type of this notification, e.g. for a Pub/Sub + failure. + """ + + message = proto.Field( + proto.STRING, + number=1, + ) + release = proto.Field( + proto.STRING, + number=2, + ) + type_ = proto.Field( + proto.ENUM, + number=3, + enum=log_enums.Type, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py new file mode 100644 index 0000000..88ceff5 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'ReleaseRenderEvent', + }, +) + + +class ReleaseRenderEvent(proto.Message): + r"""Payload proto for "clouddeploy.googleapis.com/release_render" + Platform Log event that describes the render status change. + + Attributes: + message (str): + Debug message for when a render transition + occurs. Provides further details as rendering + progresses through render states. + release (str): + The name of the ``Release``. + """ + + message = proto.Field( + proto.STRING, + number=1, + ) + release = proto.Field( + proto.STRING, + number=2, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py new file mode 100644 index 0000000..278f53a --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.deploy_v1.types import log_enums + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'RolloutNotificationEvent', + }, +) + + +class RolloutNotificationEvent(proto.Message): + r"""Payload proto for "clouddeploy.googleapis.com/rollout_notification" + Platform Log event that describes the failure to send rollout status + change Pub/Sub notification. + + Attributes: + message (str): + Debug message for when a notification fails + to send. + pipeline_uid (str): + Unique identifier of the ``DeliveryPipeline``. + release_uid (str): + Unique identifier of the ``Release``. + rollout (str): + The name of the ``Rollout``. + type_ (google.cloud.deploy_v1.types.Type): + Type of this notification, e.g. for a Pub/Sub + failure. + target_id (str): + ID of the ``Target`` that the rollout is deployed to. + """ + + message = proto.Field( + proto.STRING, + number=1, + ) + pipeline_uid = proto.Field( + proto.STRING, + number=2, + ) + release_uid = proto.Field( + proto.STRING, + number=3, + ) + rollout = proto.Field( + proto.STRING, + number=4, + ) + type_ = proto.Field( + proto.ENUM, + number=5, + enum=log_enums.Type, + ) + target_id = proto.Field( + proto.STRING, + number=6, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py new file mode 100644 index 0000000..62d3ef1 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.deploy_v1.types import log_enums + + +__protobuf__ = proto.module( + package='google.cloud.deploy.v1', + manifest={ + 'TargetNotificationEvent', + }, +) + + +class TargetNotificationEvent(proto.Message): + r"""Payload proto for "clouddeploy.googleapis.com/target_notification" + Platform Log event that describes the failure to send target status + change Pub/Sub notification. + + Attributes: + message (str): + Debug message for when a notification fails + to send. + target (str): + The name of the ``Target``. + type_ (google.cloud.deploy_v1.types.Type): + Type of this notification, e.g. for a Pub/Sub + failure. + """ + + message = proto.Field( + proto.STRING, + number=1, + ) + target = proto.Field( + proto.STRING, + number=2, + ) + type_ = proto.Field( + proto.ENUM, + number=3, + enum=log_enums.Type, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini new file mode 100644 index 0000000..574c5ae --- /dev/null +++ b/owl-bot-staging/v1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py new file mode 100644 index 0000000..16ee5a2 --- /dev/null +++ b/owl-bot-staging/v1/noxfile.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import pathlib +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.10" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "lint_setup_py", +] + +@nox.session(python=ALL_PYTHON) +def unit(session): + """Run the unit test suite.""" + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.') + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/deploy_v1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)) + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def cover(session): + """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=100") + + session.run("coverage", "erase") + + +@nox.session(python=ALL_PYTHON) +def mypy(session): + """Run the type checker.""" + session.install('mypy', 'types-pkg_resources') + session.install('.') + session.run( + 'mypy', + '--explicit-package-bases', + 'google', + ) + + +@nox.session +def update_lower_bounds(session): + """Update lower bounds in constraints.txt to match setup.py""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'update', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + + +@nox.session +def check_lower_bounds(session): + """Check lower bounds in setup.py are reflected in constraints file""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'check', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docs(session): + """Build the docs for this library.""" + + session.install("-e", ".") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", BLACK_VERSION) + session.run( + "black", + "--check", + *BLACK_PATHS, + ) + session.run("flake8", "google", "tests", "samples") + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def blacken(session): + """Run black. Format code to uniform standard.""" + session.install(BLACK_VERSION) + session.run( + "black", + *BLACK_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py new file mode 100644 index 0000000..b010d9f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for AbandonRelease +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_AbandonRelease_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_abandon_release(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.AbandonReleaseRequest( + name="name_value", + ) + + # Make the request + response = await client.abandon_release(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_AbandonRelease_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py new file mode 100644 index 0000000..8ea56be --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for AbandonRelease +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_AbandonRelease_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_abandon_release(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.AbandonReleaseRequest( + name="name_value", + ) + + # Make the request + response = client.abandon_release(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_AbandonRelease_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py new file mode 100644 index 0000000..29c49c1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ApproveRollout +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ApproveRollout_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_approve_rollout(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ApproveRolloutRequest( + name="name_value", + approved=True, + ) + + # Make the request + response = await client.approve_rollout(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ApproveRollout_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py new file mode 100644 index 0000000..fa4d05f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ApproveRollout +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ApproveRollout_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_approve_rollout(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ApproveRolloutRequest( + name="name_value", + approved=True, + ) + + # Make the request + response = client.approve_rollout(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ApproveRollout_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py new file mode 100644 index 0000000..64b719d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_create_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.CreateDeliveryPipelineRequest( + parent="parent_value", + delivery_pipeline_id="delivery_pipeline_id_value", + ) + + # Make the request + operation = client.create_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py new file mode 100644 index 0000000..142679f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_create_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.CreateDeliveryPipelineRequest( + parent="parent_value", + delivery_pipeline_id="delivery_pipeline_id_value", + ) + + # Make the request + operation = client.create_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py new file mode 100644 index 0000000..f67e10f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRelease +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateRelease_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_create_release(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.CreateReleaseRequest( + parent="parent_value", + release_id="release_id_value", + ) + + # Make the request + operation = client.create_release(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateRelease_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py new file mode 100644 index 0000000..7898ed3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRelease +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateRelease_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_create_release(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.CreateReleaseRequest( + parent="parent_value", + release_id="release_id_value", + ) + + # Make the request + operation = client.create_release(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateRelease_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py new file mode 100644 index 0000000..e597f88 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRollout +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateRollout_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_create_rollout(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + rollout = deploy_v1.Rollout() + rollout.target_id = "target_id_value" + + request = deploy_v1.CreateRolloutRequest( + parent="parent_value", + rollout_id="rollout_id_value", + rollout=rollout, + ) + + # Make the request + operation = client.create_rollout(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateRollout_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py new file mode 100644 index 0000000..544ff1f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRollout +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateRollout_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_create_rollout(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + rollout = deploy_v1.Rollout() + rollout.target_id = "target_id_value" + + request = deploy_v1.CreateRolloutRequest( + parent="parent_value", + rollout_id="rollout_id_value", + rollout=rollout, + ) + + # Make the request + operation = client.create_rollout(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateRollout_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py new file mode 100644 index 0000000..3dc717c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateTarget_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_create_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.CreateTargetRequest( + parent="parent_value", + target_id="target_id_value", + ) + + # Make the request + operation = client.create_target(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py new file mode 100644 index 0000000..c6b93df --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_CreateTarget_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_create_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.CreateTargetRequest( + parent="parent_value", + target_id="target_id_value", + ) + + # Make the request + operation = client.create_target(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_CreateTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py new file mode 100644 index 0000000..a692a80 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_delete_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py new file mode 100644 index 0000000..09c4c75 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_delete_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py new file mode 100644 index 0000000..1bc2576 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_DeleteTarget_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_delete_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteTargetRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_target(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_DeleteTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py new file mode 100644 index 0000000..707cd34 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_DeleteTarget_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_delete_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.DeleteTargetRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_target(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_DeleteTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py new file mode 100644 index 0000000..554b5b8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_get_config(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_config(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py new file mode 100644 index 0000000..31da0f3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_get_config(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_config(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py new file mode 100644 index 0000000..719090b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_get_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + response = await client.get_delivery_pipeline(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py new file mode 100644 index 0000000..6a0e52c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_get_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetDeliveryPipelineRequest( + name="name_value", + ) + + # Make the request + response = client.get_delivery_pipeline(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py new file mode 100644 index 0000000..c2a80af --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetJobRun +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetJobRun_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_get_job_run(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetJobRunRequest( + name="name_value", + ) + + # Make the request + response = await client.get_job_run(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetJobRun_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py new file mode 100644 index 0000000..98e70b3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetJobRun +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetJobRun_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_get_job_run(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetJobRunRequest( + name="name_value", + ) + + # Make the request + response = client.get_job_run(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetJobRun_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py new file mode 100644 index 0000000..58defdb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRelease +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetRelease_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_get_release(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetReleaseRequest( + name="name_value", + ) + + # Make the request + response = await client.get_release(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetRelease_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py new file mode 100644 index 0000000..2943b12 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRelease +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetRelease_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_get_release(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetReleaseRequest( + name="name_value", + ) + + # Make the request + response = client.get_release(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetRelease_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py new file mode 100644 index 0000000..94db6be --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRollout +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetRollout_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_get_rollout(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetRolloutRequest( + name="name_value", + ) + + # Make the request + response = await client.get_rollout(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetRollout_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py new file mode 100644 index 0000000..2c26c55 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRollout +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetRollout_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_get_rollout(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetRolloutRequest( + name="name_value", + ) + + # Make the request + response = client.get_rollout(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetRollout_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py new file mode 100644 index 0000000..922f76b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetTarget_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_get_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.GetTargetRequest( + name="name_value", + ) + + # Make the request + response = await client.get_target(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py new file mode 100644 index 0000000..b4fd3eb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_GetTarget_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_get_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.GetTargetRequest( + name="name_value", + ) + + # Make the request + response = client.get_target(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_GetTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py new file mode 100644 index 0000000..11959d3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListDeliveryPipelines +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_list_delivery_pipelines(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListDeliveryPipelinesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_delivery_pipelines(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py new file mode 100644 index 0000000..c303b39 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListDeliveryPipelines +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_list_delivery_pipelines(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListDeliveryPipelinesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_delivery_pipelines(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py new file mode 100644 index 0000000..93414bf --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListJobRuns +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListJobRuns_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_list_job_runs(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListJobRunsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_job_runs(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListJobRuns_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py new file mode 100644 index 0000000..e63aa53 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListJobRuns +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListJobRuns_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_list_job_runs(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListJobRunsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_job_runs(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListJobRuns_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py new file mode 100644 index 0000000..c517811 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListReleases +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListReleases_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_list_releases(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListReleasesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_releases(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListReleases_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py new file mode 100644 index 0000000..fc3a469 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListReleases +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListReleases_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_list_releases(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListReleasesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_releases(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListReleases_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py new file mode 100644 index 0000000..67a4ecc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRollouts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListRollouts_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_list_rollouts(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListRolloutsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_rollouts(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListRollouts_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py new file mode 100644 index 0000000..3cd2e68 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRollouts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListRollouts_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_list_rollouts(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListRolloutsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_rollouts(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListRollouts_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py new file mode 100644 index 0000000..e9a1dee --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTargets +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListTargets_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_list_targets(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.ListTargetsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_targets(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListTargets_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py new file mode 100644 index 0000000..f967150 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTargets +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_ListTargets_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_list_targets(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.ListTargetsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_targets(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_ListTargets_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py new file mode 100644 index 0000000..d29e7d7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RetryJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_RetryJob_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_retry_job(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.RetryJobRequest( + rollout="rollout_value", + phase_id="phase_id_value", + job_id="job_id_value", + ) + + # Make the request + response = await client.retry_job(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_RetryJob_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py new file mode 100644 index 0000000..9ecfb1e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RetryJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_RetryJob_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_retry_job(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.RetryJobRequest( + rollout="rollout_value", + phase_id="phase_id_value", + job_id="job_id_value", + ) + + # Make the request + response = client.retry_job(request=request) + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_RetryJob_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py new file mode 100644 index 0000000..6055e9a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_update_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateDeliveryPipelineRequest( + ) + + # Make the request + operation = client.update_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py new file mode 100644 index 0000000..0f51fd2 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateDeliveryPipeline +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_update_delivery_pipeline(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateDeliveryPipelineRequest( + ) + + # Make the request + operation = client.update_delivery_pipeline(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py new file mode 100644 index 0000000..9130f33 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_UpdateTarget_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +async def sample_update_target(): + # Create a client + client = deploy_v1.CloudDeployAsyncClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateTargetRequest( + ) + + # Make the request + operation = client.update_target(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_UpdateTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py new file mode 100644 index 0000000..aed4b23 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateTarget +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-deploy + + +# [START clouddeploy_v1_generated_CloudDeploy_UpdateTarget_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import deploy_v1 + + +def sample_update_target(): + # Create a client + client = deploy_v1.CloudDeployClient() + + # Initialize request argument(s) + request = deploy_v1.UpdateTargetRequest( + ) + + # Make the request + operation = client.update_target(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END clouddeploy_v1_generated_CloudDeploy_UpdateTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json new file mode 100644 index 0000000..718fa57 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json @@ -0,0 +1,3652 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.deploy.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-deploy" + }, + "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.abandon_release", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.AbandonRelease", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "AbandonRelease" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.AbandonReleaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.AbandonReleaseResponse", + "shortName": "abandon_release" + }, + "description": "Sample for AbandonRelease", + "file": "clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_AbandonRelease_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.abandon_release", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.AbandonRelease", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "AbandonRelease" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.AbandonReleaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.AbandonReleaseResponse", + "shortName": "abandon_release" + }, + "description": "Sample for AbandonRelease", + "file": "clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_AbandonRelease_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.approve_rollout", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ApproveRollout", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ApproveRollout" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ApproveRolloutRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.ApproveRolloutResponse", + "shortName": "approve_rollout" + }, + "description": "Sample for ApproveRollout", + "file": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ApproveRollout_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.approve_rollout", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ApproveRollout", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ApproveRollout" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ApproveRolloutRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.ApproveRolloutResponse", + "shortName": "approve_rollout" + }, + "description": "Sample for ApproveRollout", + "file": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ApproveRollout_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "delivery_pipeline", + "type": "google.cloud.deploy_v1.types.DeliveryPipeline" + }, + { + "name": "delivery_pipeline_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_delivery_pipeline" + }, + "description": "Sample for CreateDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "delivery_pipeline", + "type": "google.cloud.deploy_v1.types.DeliveryPipeline" + }, + { + "name": "delivery_pipeline_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_delivery_pipeline" + }, + "description": "Sample for CreateDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_release", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRelease", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateRelease" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateReleaseRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "release", + "type": "google.cloud.deploy_v1.types.Release" + }, + { + "name": "release_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_release" + }, + "description": "Sample for CreateRelease", + "file": "clouddeploy_v1_generated_cloud_deploy_create_release_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRelease_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_release_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_release", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRelease", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateRelease" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateReleaseRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "release", + "type": "google.cloud.deploy_v1.types.Release" + }, + { + "name": "release_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_release" + }, + "description": "Sample for CreateRelease", + "file": "clouddeploy_v1_generated_cloud_deploy_create_release_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRelease_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_release_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_rollout", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRollout", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateRollout" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateRolloutRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "rollout", + "type": "google.cloud.deploy_v1.types.Rollout" + }, + { + "name": "rollout_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_rollout" + }, + "description": "Sample for CreateRollout", + "file": "clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRollout_async", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_rollout", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRollout", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateRollout" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateRolloutRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "rollout", + "type": "google.cloud.deploy_v1.types.Rollout" + }, + { + "name": "rollout_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_rollout" + }, + "description": "Sample for CreateRollout", + "file": "clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRollout_sync", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateTargetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "target", + "type": "google.cloud.deploy_v1.types.Target" + }, + { + "name": "target_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_target" + }, + "description": "Sample for CreateTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_create_target_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateTarget_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_target_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "CreateTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.CreateTargetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "target", + "type": "google.cloud.deploy_v1.types.Target" + }, + { + "name": "target_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_target" + }, + "description": "Sample for CreateTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_create_target_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateTarget_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_create_target_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.delete_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "DeleteDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_delivery_pipeline" + }, + "description": "Sample for DeleteDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.delete_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "DeleteDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_delivery_pipeline" + }, + "description": "Sample for DeleteDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.delete_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "DeleteTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.DeleteTargetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_target" + }, + "description": "Sample for DeleteTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_delete_target_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteTarget_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_delete_target_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.delete_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "DeleteTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.DeleteTargetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_target" + }, + "description": "Sample for DeleteTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteTarget_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_config", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetConfig", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Config", + "shortName": "get_config" + }, + "description": "Sample for GetConfig", + "file": "clouddeploy_v1_generated_cloud_deploy_get_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetConfig_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_config", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetConfig", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Config", + "shortName": "get_config" + }, + "description": "Sample for GetConfig", + "file": "clouddeploy_v1_generated_cloud_deploy_get_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetConfig_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetDeliveryPipelineRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.DeliveryPipeline", + "shortName": "get_delivery_pipeline" + }, + "description": "Sample for GetDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetDeliveryPipelineRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.DeliveryPipeline", + "shortName": "get_delivery_pipeline" + }, + "description": "Sample for GetDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_job_run", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetJobRun", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetJobRun" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetJobRunRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.JobRun", + "shortName": "get_job_run" + }, + "description": "Sample for GetJobRun", + "file": "clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetJobRun_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_job_run", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetJobRun", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetJobRun" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetJobRunRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.JobRun", + "shortName": "get_job_run" + }, + "description": "Sample for GetJobRun", + "file": "clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetJobRun_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_release", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRelease", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetRelease" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetReleaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Release", + "shortName": "get_release" + }, + "description": "Sample for GetRelease", + "file": "clouddeploy_v1_generated_cloud_deploy_get_release_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRelease_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_release_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_release", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRelease", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetRelease" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetReleaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Release", + "shortName": "get_release" + }, + "description": "Sample for GetRelease", + "file": "clouddeploy_v1_generated_cloud_deploy_get_release_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRelease_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_release_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_rollout", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRollout", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetRollout" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetRolloutRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Rollout", + "shortName": "get_rollout" + }, + "description": "Sample for GetRollout", + "file": "clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRollout_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_rollout", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRollout", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetRollout" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetRolloutRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Rollout", + "shortName": "get_rollout" + }, + "description": "Sample for GetRollout", + "file": "clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRollout_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetTargetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Target", + "shortName": "get_target" + }, + "description": "Sample for GetTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_get_target_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetTarget_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_target_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.GetTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "GetTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.GetTargetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.Target", + "shortName": "get_target" + }, + "description": "Sample for GetTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_get_target_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetTarget_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_get_target_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_delivery_pipelines", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListDeliveryPipelines", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListDeliveryPipelines" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesAsyncPager", + "shortName": "list_delivery_pipelines" + }, + "description": "Sample for ListDeliveryPipelines", + "file": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_delivery_pipelines", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListDeliveryPipelines", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListDeliveryPipelines" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesPager", + "shortName": "list_delivery_pipelines" + }, + "description": "Sample for ListDeliveryPipelines", + "file": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_job_runs", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListJobRuns", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListJobRuns" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListJobRunsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsAsyncPager", + "shortName": "list_job_runs" + }, + "description": "Sample for ListJobRuns", + "file": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListJobRuns_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_job_runs", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListJobRuns", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListJobRuns" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListJobRunsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsPager", + "shortName": "list_job_runs" + }, + "description": "Sample for ListJobRuns", + "file": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListJobRuns_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_releases", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListReleases", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListReleases" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListReleasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesAsyncPager", + "shortName": "list_releases" + }, + "description": "Sample for ListReleases", + "file": "clouddeploy_v1_generated_cloud_deploy_list_releases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListReleases_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_releases_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_releases", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListReleases", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListReleases" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListReleasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesPager", + "shortName": "list_releases" + }, + "description": "Sample for ListReleases", + "file": "clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListReleases_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_rollouts", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListRollouts", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListRollouts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListRolloutsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsAsyncPager", + "shortName": "list_rollouts" + }, + "description": "Sample for ListRollouts", + "file": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListRollouts_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_rollouts", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListRollouts", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListRollouts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListRolloutsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsPager", + "shortName": "list_rollouts" + }, + "description": "Sample for ListRollouts", + "file": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListRollouts_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_targets", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListTargets", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListTargets" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListTargetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsAsyncPager", + "shortName": "list_targets" + }, + "description": "Sample for ListTargets", + "file": "clouddeploy_v1_generated_cloud_deploy_list_targets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListTargets_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_targets_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_targets", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.ListTargets", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "ListTargets" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.ListTargetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsPager", + "shortName": "list_targets" + }, + "description": "Sample for ListTargets", + "file": "clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListTargets_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.retry_job", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.RetryJob", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "RetryJob" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.RetryJobRequest" + }, + { + "name": "rollout", + "type": "str" + }, + { + "name": "phase_id", + "type": "str" + }, + { + "name": "job_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.RetryJobResponse", + "shortName": "retry_job" + }, + "description": "Sample for RetryJob", + "file": "clouddeploy_v1_generated_cloud_deploy_retry_job_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_RetryJob_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_retry_job_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.retry_job", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.RetryJob", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "RetryJob" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.RetryJobRequest" + }, + { + "name": "rollout", + "type": "str" + }, + { + "name": "phase_id", + "type": "str" + }, + { + "name": "job_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.deploy_v1.types.RetryJobResponse", + "shortName": "retry_job" + }, + "description": "Sample for RetryJob", + "file": "clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_RetryJob_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.update_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "UpdateDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest" + }, + { + "name": "delivery_pipeline", + "type": "google.cloud.deploy_v1.types.DeliveryPipeline" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_delivery_pipeline" + }, + "description": "Sample for UpdateDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.update_delivery_pipeline", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateDeliveryPipeline", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "UpdateDeliveryPipeline" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest" + }, + { + "name": "delivery_pipeline", + "type": "google.cloud.deploy_v1.types.DeliveryPipeline" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_delivery_pipeline" + }, + "description": "Sample for UpdateDeliveryPipeline", + "file": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", + "shortName": "CloudDeployAsyncClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.update_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "UpdateTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.UpdateTargetRequest" + }, + { + "name": "target", + "type": "google.cloud.deploy_v1.types.Target" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_target" + }, + "description": "Sample for UpdateTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_update_target_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateTarget_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_update_target_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.deploy_v1.CloudDeployClient", + "shortName": "CloudDeployClient" + }, + "fullName": "google.cloud.deploy_v1.CloudDeployClient.update_target", + "method": { + "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateTarget", + "service": { + "fullName": "google.cloud.deploy.v1.CloudDeploy", + "shortName": "CloudDeploy" + }, + "shortName": "UpdateTarget" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.deploy_v1.types.UpdateTargetRequest" + }, + { + "name": "target", + "type": "google.cloud.deploy_v1.types.Target" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_target" + }, + "description": "Sample for UpdateTarget", + "file": "clouddeploy_v1_generated_cloud_deploy_update_target_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateTarget_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "clouddeploy_v1_generated_cloud_deploy_update_target_sync.py" + } + ] +} diff --git a/owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py new file mode 100644 index 0000000..a785c71 --- /dev/null +++ b/owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py @@ -0,0 +1,197 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class deployCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'abandon_release': ('name', ), + 'approve_rollout': ('name', 'approved', ), + 'create_delivery_pipeline': ('parent', 'delivery_pipeline_id', 'delivery_pipeline', 'request_id', 'validate_only', ), + 'create_release': ('parent', 'release_id', 'release', 'request_id', 'validate_only', ), + 'create_rollout': ('parent', 'rollout_id', 'rollout', 'request_id', 'validate_only', ), + 'create_target': ('parent', 'target_id', 'target', 'request_id', 'validate_only', ), + 'delete_delivery_pipeline': ('name', 'request_id', 'allow_missing', 'validate_only', 'force', 'etag', ), + 'delete_target': ('name', 'request_id', 'allow_missing', 'validate_only', 'etag', ), + 'get_config': ('name', ), + 'get_delivery_pipeline': ('name', ), + 'get_job_run': ('name', ), + 'get_release': ('name', ), + 'get_rollout': ('name', ), + 'get_target': ('name', ), + 'list_delivery_pipelines': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_job_runs': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_releases': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_rollouts': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_targets': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'retry_job': ('rollout', 'phase_id', 'job_id', ), + 'update_delivery_pipeline': ('update_mask', 'delivery_pipeline', 'request_id', 'allow_missing', 'validate_only', ), + 'update_target': ('update_mask', 'target', 'request_id', 'allow_missing', 'validate_only', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=deployCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the deploy client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py new file mode 100644 index 0000000..fff3b05 --- /dev/null +++ b/owl-bot-staging/v1/setup.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import io +import os +import setuptools # type: ignore + +version = '0.1.0' + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, 'README.rst') +with io.open(readme_filename, encoding='utf-8') as readme_file: + readme = readme_file.read() + +setuptools.setup( + name='google-cloud-deploy', + author="Google LLC", + author_email="googleapis-packages@google.com", + url="https://github.com/googleapis/python-google-cloud-deploy", + version=version, + long_description=readme, + packages=setuptools.PEP420PackageFinder.find(), + namespace_packages=('google', 'google.cloud'), + platforms='Posix; MacOS X; Windows', + include_package_data=True, + install_requires=( + 'google-api-core[grpc] >= 2.10.0, < 3.0.0dev', + 'libcst >= 0.2.5', + 'googleapis-common-protos >= 1.55.0, <2.0.0dev', + 'proto-plus >= 1.19.7', + 'grpc-google-iam-v1 >= 0.12.4, < 0.13dev', + ), + python_requires='>=3.7', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Topic :: Internet', + 'Topic :: Software Development :: Libraries :: Python Modules', + ], + zip_safe=False, +) diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py b/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py new file mode 100644 index 0000000..73d9d4e --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py @@ -0,0 +1,8966 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER + import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +from google.api_core import future +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import operation +from google.api_core import operation_async # type: ignore +from google.api_core import operations_v1 +from google.api_core import path_template +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.deploy_v1.services.cloud_deploy import CloudDeployAsyncClient +from google.cloud.deploy_v1.services.cloud_deploy import CloudDeployClient +from google.cloud.deploy_v1.services.cloud_deploy import pagers +from google.cloud.deploy_v1.services.cloud_deploy import transports +from google.cloud.deploy_v1.types import cloud_deploy +from google.cloud.location import locations_pb2 +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import options_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert CloudDeployClient._get_default_mtls_endpoint(None) is None + assert CloudDeployClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert CloudDeployClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert CloudDeployClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert CloudDeployClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert CloudDeployClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CloudDeployClient, "grpc"), + (CloudDeployAsyncClient, "grpc_asyncio"), +]) +def test_cloud_deploy_client_from_service_account_info(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'clouddeploy.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.CloudDeployGrpcTransport, "grpc"), + (transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cloud_deploy_client_service_account_always_use_jwt(transport_class, transport_name): + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CloudDeployClient, "grpc"), + (CloudDeployAsyncClient, "grpc_asyncio"), +]) +def test_cloud_deploy_client_from_service_account_file(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'clouddeploy.googleapis.com:443' + ) + + +def test_cloud_deploy_client_get_transport_class(): + transport = CloudDeployClient.get_transport_class() + available_transports = [ + transports.CloudDeployGrpcTransport, + ] + assert transport in available_transports + + transport = CloudDeployClient.get_transport_class("grpc") + assert transport == transports.CloudDeployGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc"), + (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(CloudDeployClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployClient)) +@mock.patch.object(CloudDeployAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployAsyncClient)) +def test_cloud_deploy_client_client_options(client_class, transport_class, transport_name): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(CloudDeployClient, 'get_transport_class') as gtc: + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(CloudDeployClient, 'get_transport_class') as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions(api_audience="https://language.googleapis.com") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com" + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ + (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", "true"), + (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", "false"), + (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(CloudDeployClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployClient)) +@mock.patch.object(CloudDeployAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_cloud_deploy_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class", [ + CloudDeployClient, CloudDeployAsyncClient +]) +@mock.patch.object(CloudDeployClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployClient)) +@mock.patch.object(CloudDeployAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployAsyncClient)) +def test_cloud_deploy_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc"), + (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cloud_deploy_client_client_options_scopes(client_class, transport_class, transport_name): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", grpc_helpers), + (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cloud_deploy_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +def test_cloud_deploy_client_client_options_from_dict(): + with mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = CloudDeployClient( + client_options={'api_endpoint': 'squid.clam.whelk'} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", grpc_helpers), + (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cloud_deploy_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "clouddeploy.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + scopes=None, + default_host="clouddeploy.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.ListDeliveryPipelinesRequest, + dict, +]) +def test_list_delivery_pipelines(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListDeliveryPipelinesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + ) + response = client.list_delivery_pipelines(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListDeliveryPipelinesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListDeliveryPipelinesPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +def test_list_delivery_pipelines_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + client.list_delivery_pipelines() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListDeliveryPipelinesRequest() + +@pytest.mark.asyncio +async def test_list_delivery_pipelines_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListDeliveryPipelinesRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListDeliveryPipelinesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_delivery_pipelines(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListDeliveryPipelinesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListDeliveryPipelinesAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_delivery_pipelines_async_from_dict(): + await test_list_delivery_pipelines_async(request_type=dict) + + +def test_list_delivery_pipelines_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListDeliveryPipelinesRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + call.return_value = cloud_deploy.ListDeliveryPipelinesResponse() + client.list_delivery_pipelines(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_delivery_pipelines_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListDeliveryPipelinesRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListDeliveryPipelinesResponse()) + await client.list_delivery_pipelines(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_delivery_pipelines_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListDeliveryPipelinesResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_delivery_pipelines( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_delivery_pipelines_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_delivery_pipelines( + cloud_deploy.ListDeliveryPipelinesRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_delivery_pipelines_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListDeliveryPipelinesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListDeliveryPipelinesResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_delivery_pipelines( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_delivery_pipelines_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_delivery_pipelines( + cloud_deploy.ListDeliveryPipelinesRequest(), + parent='parent_value', + ) + + +def test_list_delivery_pipelines_pager(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='abc', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[], + next_page_token='def', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_delivery_pipelines(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cloud_deploy.DeliveryPipeline) + for i in results) +def test_list_delivery_pipelines_pages(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='abc', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[], + next_page_token='def', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + ), + RuntimeError, + ) + pages = list(client.list_delivery_pipelines(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_delivery_pipelines_async_pager(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='abc', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[], + next_page_token='def', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_delivery_pipelines(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, cloud_deploy.DeliveryPipeline) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_delivery_pipelines_async_pages(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_delivery_pipelines), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='abc', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[], + next_page_token='def', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListDeliveryPipelinesResponse( + delivery_pipelines=[ + cloud_deploy.DeliveryPipeline(), + cloud_deploy.DeliveryPipeline(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_delivery_pipelines(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.GetDeliveryPipelineRequest, + dict, +]) +def test_get_delivery_pipeline(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.DeliveryPipeline( + name='name_value', + uid='uid_value', + description='description_value', + etag='etag_value', + suspended=True, + serial_pipeline=cloud_deploy.SerialPipeline(stages=[cloud_deploy.Stage(target_id='target_id_value')]), + ) + response = client.get_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.DeliveryPipeline) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.etag == 'etag_value' + assert response.suspended is True + + +def test_get_delivery_pipeline_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_delivery_pipeline), + '__call__') as call: + client.get_delivery_pipeline() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetDeliveryPipelineRequest() + +@pytest.mark.asyncio +async def test_get_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetDeliveryPipelineRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.DeliveryPipeline( + name='name_value', + uid='uid_value', + description='description_value', + etag='etag_value', + suspended=True, + )) + response = await client.get_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.DeliveryPipeline) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.etag == 'etag_value' + assert response.suspended is True + + +@pytest.mark.asyncio +async def test_get_delivery_pipeline_async_from_dict(): + await test_get_delivery_pipeline_async(request_type=dict) + + +def test_get_delivery_pipeline_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetDeliveryPipelineRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_delivery_pipeline), + '__call__') as call: + call.return_value = cloud_deploy.DeliveryPipeline() + client.get_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_delivery_pipeline_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetDeliveryPipelineRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_delivery_pipeline), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.DeliveryPipeline()) + await client.get_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_delivery_pipeline_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.DeliveryPipeline() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_delivery_pipeline( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_delivery_pipeline_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_delivery_pipeline( + cloud_deploy.GetDeliveryPipelineRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_delivery_pipeline_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.DeliveryPipeline() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.DeliveryPipeline()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_delivery_pipeline( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_delivery_pipeline_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_delivery_pipeline( + cloud_deploy.GetDeliveryPipelineRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.CreateDeliveryPipelineRequest, + dict, +]) +def test_create_delivery_pipeline(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_create_delivery_pipeline_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_delivery_pipeline), + '__call__') as call: + client.create_delivery_pipeline() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateDeliveryPipelineRequest() + +@pytest.mark.asyncio +async def test_create_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateDeliveryPipelineRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_delivery_pipeline_async_from_dict(): + await test_create_delivery_pipeline_async(request_type=dict) + + +def test_create_delivery_pipeline_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateDeliveryPipelineRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_delivery_pipeline), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_delivery_pipeline_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateDeliveryPipelineRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_delivery_pipeline), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_delivery_pipeline_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_delivery_pipeline( + parent='parent_value', + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + delivery_pipeline_id='delivery_pipeline_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].delivery_pipeline + mock_val = cloud_deploy.DeliveryPipeline(name='name_value') + assert arg == mock_val + arg = args[0].delivery_pipeline_id + mock_val = 'delivery_pipeline_id_value' + assert arg == mock_val + + +def test_create_delivery_pipeline_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_delivery_pipeline( + cloud_deploy.CreateDeliveryPipelineRequest(), + parent='parent_value', + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + delivery_pipeline_id='delivery_pipeline_id_value', + ) + +@pytest.mark.asyncio +async def test_create_delivery_pipeline_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_delivery_pipeline( + parent='parent_value', + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + delivery_pipeline_id='delivery_pipeline_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].delivery_pipeline + mock_val = cloud_deploy.DeliveryPipeline(name='name_value') + assert arg == mock_val + arg = args[0].delivery_pipeline_id + mock_val = 'delivery_pipeline_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_delivery_pipeline_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_delivery_pipeline( + cloud_deploy.CreateDeliveryPipelineRequest(), + parent='parent_value', + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + delivery_pipeline_id='delivery_pipeline_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.UpdateDeliveryPipelineRequest, + dict, +]) +def test_update_delivery_pipeline(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.update_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.UpdateDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_update_delivery_pipeline_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_delivery_pipeline), + '__call__') as call: + client.update_delivery_pipeline() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.UpdateDeliveryPipelineRequest() + +@pytest.mark.asyncio +async def test_update_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.UpdateDeliveryPipelineRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.UpdateDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_delivery_pipeline_async_from_dict(): + await test_update_delivery_pipeline_async(request_type=dict) + + +def test_update_delivery_pipeline_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.UpdateDeliveryPipelineRequest() + + request.delivery_pipeline.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_delivery_pipeline), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.update_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'delivery_pipeline.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_delivery_pipeline_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.UpdateDeliveryPipelineRequest() + + request.delivery_pipeline.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_delivery_pipeline), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.update_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'delivery_pipeline.name=name_value', + ) in kw['metadata'] + + +def test_update_delivery_pipeline_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_delivery_pipeline( + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].delivery_pipeline + mock_val = cloud_deploy.DeliveryPipeline(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_delivery_pipeline_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_delivery_pipeline( + cloud_deploy.UpdateDeliveryPipelineRequest(), + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_delivery_pipeline_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_delivery_pipeline( + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].delivery_pipeline + mock_val = cloud_deploy.DeliveryPipeline(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_delivery_pipeline_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_delivery_pipeline( + cloud_deploy.UpdateDeliveryPipelineRequest(), + delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.DeleteDeliveryPipelineRequest, + dict, +]) +def test_delete_delivery_pipeline(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.DeleteDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_delete_delivery_pipeline_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_delivery_pipeline), + '__call__') as call: + client.delete_delivery_pipeline() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.DeleteDeliveryPipelineRequest() + +@pytest.mark.asyncio +async def test_delete_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.DeleteDeliveryPipelineRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.DeleteDeliveryPipelineRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_delivery_pipeline_async_from_dict(): + await test_delete_delivery_pipeline_async(request_type=dict) + + +def test_delete_delivery_pipeline_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.DeleteDeliveryPipelineRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_delivery_pipeline), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_delivery_pipeline_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.DeleteDeliveryPipelineRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_delivery_pipeline), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_delivery_pipeline(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_delivery_pipeline_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_delivery_pipeline( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_delivery_pipeline_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_delivery_pipeline( + cloud_deploy.DeleteDeliveryPipelineRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_delivery_pipeline_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_delivery_pipeline), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_delivery_pipeline( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_delivery_pipeline_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_delivery_pipeline( + cloud_deploy.DeleteDeliveryPipelineRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.ListTargetsRequest, + dict, +]) +def test_list_targets(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListTargetsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + ) + response = client.list_targets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListTargetsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTargetsPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +def test_list_targets_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + client.list_targets() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListTargetsRequest() + +@pytest.mark.asyncio +async def test_list_targets_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListTargetsRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListTargetsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_targets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListTargetsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTargetsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_targets_async_from_dict(): + await test_list_targets_async(request_type=dict) + + +def test_list_targets_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListTargetsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + call.return_value = cloud_deploy.ListTargetsResponse() + client.list_targets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_targets_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListTargetsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListTargetsResponse()) + await client.list_targets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_targets_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListTargetsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_targets( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_targets_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_targets( + cloud_deploy.ListTargetsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_targets_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListTargetsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListTargetsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_targets( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_targets_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_targets( + cloud_deploy.ListTargetsRequest(), + parent='parent_value', + ) + + +def test_list_targets_pager(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + next_page_token='abc', + ), + cloud_deploy.ListTargetsResponse( + targets=[], + next_page_token='def', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_targets(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cloud_deploy.Target) + for i in results) +def test_list_targets_pages(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + next_page_token='abc', + ), + cloud_deploy.ListTargetsResponse( + targets=[], + next_page_token='def', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + ), + RuntimeError, + ) + pages = list(client.list_targets(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_targets_async_pager(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + next_page_token='abc', + ), + cloud_deploy.ListTargetsResponse( + targets=[], + next_page_token='def', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_targets(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, cloud_deploy.Target) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_targets_async_pages(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_targets), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + next_page_token='abc', + ), + cloud_deploy.ListTargetsResponse( + targets=[], + next_page_token='def', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListTargetsResponse( + targets=[ + cloud_deploy.Target(), + cloud_deploy.Target(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_targets(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.GetTargetRequest, + dict, +]) +def test_get_target(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Target( + name='name_value', + target_id='target_id_value', + uid='uid_value', + description='description_value', + require_approval=True, + etag='etag_value', + gke=cloud_deploy.GkeCluster(cluster='cluster_value'), + ) + response = client.get_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Target) + assert response.name == 'name_value' + assert response.target_id == 'target_id_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.require_approval is True + assert response.etag == 'etag_value' + + +def test_get_target_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_target), + '__call__') as call: + client.get_target() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetTargetRequest() + +@pytest.mark.asyncio +async def test_get_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetTargetRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Target( + name='name_value', + target_id='target_id_value', + uid='uid_value', + description='description_value', + require_approval=True, + etag='etag_value', + )) + response = await client.get_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Target) + assert response.name == 'name_value' + assert response.target_id == 'target_id_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.require_approval is True + assert response.etag == 'etag_value' + + +@pytest.mark.asyncio +async def test_get_target_async_from_dict(): + await test_get_target_async(request_type=dict) + + +def test_get_target_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetTargetRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_target), + '__call__') as call: + call.return_value = cloud_deploy.Target() + client.get_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_target_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetTargetRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_target), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Target()) + await client.get_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_target_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Target() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_target( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_target_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_target( + cloud_deploy.GetTargetRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_target_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Target() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Target()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_target( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_target_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_target( + cloud_deploy.GetTargetRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.CreateTargetRequest, + dict, +]) +def test_create_target(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_create_target_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_target), + '__call__') as call: + client.create_target() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateTargetRequest() + +@pytest.mark.asyncio +async def test_create_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateTargetRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_target_async_from_dict(): + await test_create_target_async(request_type=dict) + + +def test_create_target_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateTargetRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_target), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_target_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateTargetRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_target), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_target_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_target( + parent='parent_value', + target=cloud_deploy.Target(name='name_value'), + target_id='target_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].target + mock_val = cloud_deploy.Target(name='name_value') + assert arg == mock_val + arg = args[0].target_id + mock_val = 'target_id_value' + assert arg == mock_val + + +def test_create_target_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_target( + cloud_deploy.CreateTargetRequest(), + parent='parent_value', + target=cloud_deploy.Target(name='name_value'), + target_id='target_id_value', + ) + +@pytest.mark.asyncio +async def test_create_target_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_target( + parent='parent_value', + target=cloud_deploy.Target(name='name_value'), + target_id='target_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].target + mock_val = cloud_deploy.Target(name='name_value') + assert arg == mock_val + arg = args[0].target_id + mock_val = 'target_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_target_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_target( + cloud_deploy.CreateTargetRequest(), + parent='parent_value', + target=cloud_deploy.Target(name='name_value'), + target_id='target_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.UpdateTargetRequest, + dict, +]) +def test_update_target(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.update_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.UpdateTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_update_target_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_target), + '__call__') as call: + client.update_target() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.UpdateTargetRequest() + +@pytest.mark.asyncio +async def test_update_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.UpdateTargetRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.UpdateTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_target_async_from_dict(): + await test_update_target_async(request_type=dict) + + +def test_update_target_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.UpdateTargetRequest() + + request.target.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_target), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.update_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'target.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_target_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.UpdateTargetRequest() + + request.target.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_target), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.update_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'target.name=name_value', + ) in kw['metadata'] + + +def test_update_target_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_target( + target=cloud_deploy.Target(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].target + mock_val = cloud_deploy.Target(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_target_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_target( + cloud_deploy.UpdateTargetRequest(), + target=cloud_deploy.Target(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_target_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_target( + target=cloud_deploy.Target(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].target + mock_val = cloud_deploy.Target(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_target_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_target( + cloud_deploy.UpdateTargetRequest(), + target=cloud_deploy.Target(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.DeleteTargetRequest, + dict, +]) +def test_delete_target(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.DeleteTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_delete_target_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_target), + '__call__') as call: + client.delete_target() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.DeleteTargetRequest() + +@pytest.mark.asyncio +async def test_delete_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.DeleteTargetRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.DeleteTargetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_target_async_from_dict(): + await test_delete_target_async(request_type=dict) + + +def test_delete_target_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.DeleteTargetRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_target), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_target_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.DeleteTargetRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_target), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_target(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_target_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_target( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_target_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_target( + cloud_deploy.DeleteTargetRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_target_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_target), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_target( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_target_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_target( + cloud_deploy.DeleteTargetRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.ListReleasesRequest, + dict, +]) +def test_list_releases(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListReleasesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + ) + response = client.list_releases(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListReleasesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReleasesPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +def test_list_releases_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + client.list_releases() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListReleasesRequest() + +@pytest.mark.asyncio +async def test_list_releases_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListReleasesRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListReleasesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_releases(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListReleasesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReleasesAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_releases_async_from_dict(): + await test_list_releases_async(request_type=dict) + + +def test_list_releases_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListReleasesRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + call.return_value = cloud_deploy.ListReleasesResponse() + client.list_releases(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_releases_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListReleasesRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListReleasesResponse()) + await client.list_releases(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_releases_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListReleasesResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_releases( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_releases_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_releases( + cloud_deploy.ListReleasesRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_releases_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListReleasesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListReleasesResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_releases( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_releases_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_releases( + cloud_deploy.ListReleasesRequest(), + parent='parent_value', + ) + + +def test_list_releases_pager(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + next_page_token='abc', + ), + cloud_deploy.ListReleasesResponse( + releases=[], + next_page_token='def', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_releases(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cloud_deploy.Release) + for i in results) +def test_list_releases_pages(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + next_page_token='abc', + ), + cloud_deploy.ListReleasesResponse( + releases=[], + next_page_token='def', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + ), + RuntimeError, + ) + pages = list(client.list_releases(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_releases_async_pager(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + next_page_token='abc', + ), + cloud_deploy.ListReleasesResponse( + releases=[], + next_page_token='def', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_releases(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, cloud_deploy.Release) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_releases_async_pages(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_releases), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + next_page_token='abc', + ), + cloud_deploy.ListReleasesResponse( + releases=[], + next_page_token='def', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListReleasesResponse( + releases=[ + cloud_deploy.Release(), + cloud_deploy.Release(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_releases(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.GetReleaseRequest, + dict, +]) +def test_get_release(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Release( + name='name_value', + uid='uid_value', + description='description_value', + abandoned=True, + skaffold_config_uri='skaffold_config_uri_value', + skaffold_config_path='skaffold_config_path_value', + render_state=cloud_deploy.Release.RenderState.SUCCEEDED, + etag='etag_value', + skaffold_version='skaffold_version_value', + ) + response = client.get_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetReleaseRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Release) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.abandoned is True + assert response.skaffold_config_uri == 'skaffold_config_uri_value' + assert response.skaffold_config_path == 'skaffold_config_path_value' + assert response.render_state == cloud_deploy.Release.RenderState.SUCCEEDED + assert response.etag == 'etag_value' + assert response.skaffold_version == 'skaffold_version_value' + + +def test_get_release_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_release), + '__call__') as call: + client.get_release() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetReleaseRequest() + +@pytest.mark.asyncio +async def test_get_release_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetReleaseRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Release( + name='name_value', + uid='uid_value', + description='description_value', + abandoned=True, + skaffold_config_uri='skaffold_config_uri_value', + skaffold_config_path='skaffold_config_path_value', + render_state=cloud_deploy.Release.RenderState.SUCCEEDED, + etag='etag_value', + skaffold_version='skaffold_version_value', + )) + response = await client.get_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetReleaseRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Release) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.abandoned is True + assert response.skaffold_config_uri == 'skaffold_config_uri_value' + assert response.skaffold_config_path == 'skaffold_config_path_value' + assert response.render_state == cloud_deploy.Release.RenderState.SUCCEEDED + assert response.etag == 'etag_value' + assert response.skaffold_version == 'skaffold_version_value' + + +@pytest.mark.asyncio +async def test_get_release_async_from_dict(): + await test_get_release_async(request_type=dict) + + +def test_get_release_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetReleaseRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_release), + '__call__') as call: + call.return_value = cloud_deploy.Release() + client.get_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_release_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetReleaseRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_release), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Release()) + await client.get_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_release_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Release() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_release( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_release_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_release( + cloud_deploy.GetReleaseRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_release_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Release() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Release()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_release( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_release_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_release( + cloud_deploy.GetReleaseRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.CreateReleaseRequest, + dict, +]) +def test_create_release(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateReleaseRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_create_release_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_release), + '__call__') as call: + client.create_release() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateReleaseRequest() + +@pytest.mark.asyncio +async def test_create_release_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateReleaseRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateReleaseRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_release_async_from_dict(): + await test_create_release_async(request_type=dict) + + +def test_create_release_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateReleaseRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_release), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_release_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateReleaseRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_release), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_release_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_release( + parent='parent_value', + release=cloud_deploy.Release(name='name_value'), + release_id='release_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].release + mock_val = cloud_deploy.Release(name='name_value') + assert arg == mock_val + arg = args[0].release_id + mock_val = 'release_id_value' + assert arg == mock_val + + +def test_create_release_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_release( + cloud_deploy.CreateReleaseRequest(), + parent='parent_value', + release=cloud_deploy.Release(name='name_value'), + release_id='release_id_value', + ) + +@pytest.mark.asyncio +async def test_create_release_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_release( + parent='parent_value', + release=cloud_deploy.Release(name='name_value'), + release_id='release_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].release + mock_val = cloud_deploy.Release(name='name_value') + assert arg == mock_val + arg = args[0].release_id + mock_val = 'release_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_release_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_release( + cloud_deploy.CreateReleaseRequest(), + parent='parent_value', + release=cloud_deploy.Release(name='name_value'), + release_id='release_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.AbandonReleaseRequest, + dict, +]) +def test_abandon_release(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.abandon_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.AbandonReleaseResponse( + ) + response = client.abandon_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.AbandonReleaseRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.AbandonReleaseResponse) + + +def test_abandon_release_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.abandon_release), + '__call__') as call: + client.abandon_release() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.AbandonReleaseRequest() + +@pytest.mark.asyncio +async def test_abandon_release_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.AbandonReleaseRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.abandon_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.AbandonReleaseResponse( + )) + response = await client.abandon_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.AbandonReleaseRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.AbandonReleaseResponse) + + +@pytest.mark.asyncio +async def test_abandon_release_async_from_dict(): + await test_abandon_release_async(request_type=dict) + + +def test_abandon_release_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.AbandonReleaseRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.abandon_release), + '__call__') as call: + call.return_value = cloud_deploy.AbandonReleaseResponse() + client.abandon_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_abandon_release_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.AbandonReleaseRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.abandon_release), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.AbandonReleaseResponse()) + await client.abandon_release(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_abandon_release_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.abandon_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.AbandonReleaseResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.abandon_release( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_abandon_release_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.abandon_release( + cloud_deploy.AbandonReleaseRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_abandon_release_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.abandon_release), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.AbandonReleaseResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.AbandonReleaseResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.abandon_release( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_abandon_release_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.abandon_release( + cloud_deploy.AbandonReleaseRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.ApproveRolloutRequest, + dict, +]) +def test_approve_rollout(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ApproveRolloutResponse( + ) + response = client.approve_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ApproveRolloutRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.ApproveRolloutResponse) + + +def test_approve_rollout_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_rollout), + '__call__') as call: + client.approve_rollout() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ApproveRolloutRequest() + +@pytest.mark.asyncio +async def test_approve_rollout_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ApproveRolloutRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ApproveRolloutResponse( + )) + response = await client.approve_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ApproveRolloutRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.ApproveRolloutResponse) + + +@pytest.mark.asyncio +async def test_approve_rollout_async_from_dict(): + await test_approve_rollout_async(request_type=dict) + + +def test_approve_rollout_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ApproveRolloutRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_rollout), + '__call__') as call: + call.return_value = cloud_deploy.ApproveRolloutResponse() + client.approve_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_approve_rollout_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ApproveRolloutRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_rollout), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ApproveRolloutResponse()) + await client.approve_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_approve_rollout_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ApproveRolloutResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.approve_rollout( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_approve_rollout_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.approve_rollout( + cloud_deploy.ApproveRolloutRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_approve_rollout_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ApproveRolloutResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ApproveRolloutResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.approve_rollout( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_approve_rollout_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.approve_rollout( + cloud_deploy.ApproveRolloutRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.ListRolloutsRequest, + dict, +]) +def test_list_rollouts(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListRolloutsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + ) + response = client.list_rollouts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListRolloutsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRolloutsPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +def test_list_rollouts_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + client.list_rollouts() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListRolloutsRequest() + +@pytest.mark.asyncio +async def test_list_rollouts_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListRolloutsRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListRolloutsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_rollouts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListRolloutsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRolloutsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_rollouts_async_from_dict(): + await test_list_rollouts_async(request_type=dict) + + +def test_list_rollouts_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListRolloutsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + call.return_value = cloud_deploy.ListRolloutsResponse() + client.list_rollouts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_rollouts_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListRolloutsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListRolloutsResponse()) + await client.list_rollouts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_rollouts_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListRolloutsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_rollouts( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_rollouts_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_rollouts( + cloud_deploy.ListRolloutsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_rollouts_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListRolloutsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListRolloutsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_rollouts( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_rollouts_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_rollouts( + cloud_deploy.ListRolloutsRequest(), + parent='parent_value', + ) + + +def test_list_rollouts_pager(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + next_page_token='abc', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[], + next_page_token='def', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_rollouts(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cloud_deploy.Rollout) + for i in results) +def test_list_rollouts_pages(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + next_page_token='abc', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[], + next_page_token='def', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + ), + RuntimeError, + ) + pages = list(client.list_rollouts(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_rollouts_async_pager(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + next_page_token='abc', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[], + next_page_token='def', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_rollouts(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, cloud_deploy.Rollout) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_rollouts_async_pages(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollouts), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + next_page_token='abc', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[], + next_page_token='def', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListRolloutsResponse( + rollouts=[ + cloud_deploy.Rollout(), + cloud_deploy.Rollout(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_rollouts(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.GetRolloutRequest, + dict, +]) +def test_get_rollout(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Rollout( + name='name_value', + uid='uid_value', + description='description_value', + target_id='target_id_value', + approval_state=cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL, + state=cloud_deploy.Rollout.State.SUCCEEDED, + failure_reason='failure_reason_value', + deploying_build='deploying_build_value', + etag='etag_value', + deploy_failure_cause=cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE, + ) + response = client.get_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetRolloutRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Rollout) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.target_id == 'target_id_value' + assert response.approval_state == cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL + assert response.state == cloud_deploy.Rollout.State.SUCCEEDED + assert response.failure_reason == 'failure_reason_value' + assert response.deploying_build == 'deploying_build_value' + assert response.etag == 'etag_value' + assert response.deploy_failure_cause == cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE + + +def test_get_rollout_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_rollout), + '__call__') as call: + client.get_rollout() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetRolloutRequest() + +@pytest.mark.asyncio +async def test_get_rollout_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetRolloutRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Rollout( + name='name_value', + uid='uid_value', + description='description_value', + target_id='target_id_value', + approval_state=cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL, + state=cloud_deploy.Rollout.State.SUCCEEDED, + failure_reason='failure_reason_value', + deploying_build='deploying_build_value', + etag='etag_value', + deploy_failure_cause=cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE, + )) + response = await client.get_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetRolloutRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Rollout) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.description == 'description_value' + assert response.target_id == 'target_id_value' + assert response.approval_state == cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL + assert response.state == cloud_deploy.Rollout.State.SUCCEEDED + assert response.failure_reason == 'failure_reason_value' + assert response.deploying_build == 'deploying_build_value' + assert response.etag == 'etag_value' + assert response.deploy_failure_cause == cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE + + +@pytest.mark.asyncio +async def test_get_rollout_async_from_dict(): + await test_get_rollout_async(request_type=dict) + + +def test_get_rollout_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetRolloutRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_rollout), + '__call__') as call: + call.return_value = cloud_deploy.Rollout() + client.get_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_rollout_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetRolloutRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_rollout), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Rollout()) + await client.get_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_rollout_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Rollout() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_rollout( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_rollout_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_rollout( + cloud_deploy.GetRolloutRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_rollout_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Rollout() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Rollout()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_rollout( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_rollout_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_rollout( + cloud_deploy.GetRolloutRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.CreateRolloutRequest, + dict, +]) +def test_create_rollout(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateRolloutRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_create_rollout_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_rollout), + '__call__') as call: + client.create_rollout() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateRolloutRequest() + +@pytest.mark.asyncio +async def test_create_rollout_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateRolloutRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.CreateRolloutRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_rollout_async_from_dict(): + await test_create_rollout_async(request_type=dict) + + +def test_create_rollout_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateRolloutRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_rollout), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_rollout_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.CreateRolloutRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_rollout), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_rollout(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_rollout_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_rollout( + parent='parent_value', + rollout=cloud_deploy.Rollout(name='name_value'), + rollout_id='rollout_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].rollout + mock_val = cloud_deploy.Rollout(name='name_value') + assert arg == mock_val + arg = args[0].rollout_id + mock_val = 'rollout_id_value' + assert arg == mock_val + + +def test_create_rollout_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_rollout( + cloud_deploy.CreateRolloutRequest(), + parent='parent_value', + rollout=cloud_deploy.Rollout(name='name_value'), + rollout_id='rollout_id_value', + ) + +@pytest.mark.asyncio +async def test_create_rollout_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_rollout), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_rollout( + parent='parent_value', + rollout=cloud_deploy.Rollout(name='name_value'), + rollout_id='rollout_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].rollout + mock_val = cloud_deploy.Rollout(name='name_value') + assert arg == mock_val + arg = args[0].rollout_id + mock_val = 'rollout_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_rollout_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_rollout( + cloud_deploy.CreateRolloutRequest(), + parent='parent_value', + rollout=cloud_deploy.Rollout(name='name_value'), + rollout_id='rollout_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.RetryJobRequest, + dict, +]) +def test_retry_job(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.retry_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.RetryJobResponse( + ) + response = client.retry_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.RetryJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.RetryJobResponse) + + +def test_retry_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.retry_job), + '__call__') as call: + client.retry_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.RetryJobRequest() + +@pytest.mark.asyncio +async def test_retry_job_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.RetryJobRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.retry_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.RetryJobResponse( + )) + response = await client.retry_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.RetryJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.RetryJobResponse) + + +@pytest.mark.asyncio +async def test_retry_job_async_from_dict(): + await test_retry_job_async(request_type=dict) + + +def test_retry_job_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.RetryJobRequest() + + request.rollout = 'rollout_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.retry_job), + '__call__') as call: + call.return_value = cloud_deploy.RetryJobResponse() + client.retry_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'rollout=rollout_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_retry_job_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.RetryJobRequest() + + request.rollout = 'rollout_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.retry_job), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.RetryJobResponse()) + await client.retry_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'rollout=rollout_value', + ) in kw['metadata'] + + +def test_retry_job_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.retry_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.RetryJobResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.retry_job( + rollout='rollout_value', + phase_id='phase_id_value', + job_id='job_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].rollout + mock_val = 'rollout_value' + assert arg == mock_val + arg = args[0].phase_id + mock_val = 'phase_id_value' + assert arg == mock_val + arg = args[0].job_id + mock_val = 'job_id_value' + assert arg == mock_val + + +def test_retry_job_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.retry_job( + cloud_deploy.RetryJobRequest(), + rollout='rollout_value', + phase_id='phase_id_value', + job_id='job_id_value', + ) + +@pytest.mark.asyncio +async def test_retry_job_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.retry_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.RetryJobResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.RetryJobResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.retry_job( + rollout='rollout_value', + phase_id='phase_id_value', + job_id='job_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].rollout + mock_val = 'rollout_value' + assert arg == mock_val + arg = args[0].phase_id + mock_val = 'phase_id_value' + assert arg == mock_val + arg = args[0].job_id + mock_val = 'job_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_retry_job_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.retry_job( + cloud_deploy.RetryJobRequest(), + rollout='rollout_value', + phase_id='phase_id_value', + job_id='job_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.ListJobRunsRequest, + dict, +]) +def test_list_job_runs(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListJobRunsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + ) + response = client.list_job_runs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListJobRunsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListJobRunsPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +def test_list_job_runs_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + client.list_job_runs() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListJobRunsRequest() + +@pytest.mark.asyncio +async def test_list_job_runs_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListJobRunsRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListJobRunsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_job_runs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.ListJobRunsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListJobRunsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_job_runs_async_from_dict(): + await test_list_job_runs_async(request_type=dict) + + +def test_list_job_runs_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListJobRunsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + call.return_value = cloud_deploy.ListJobRunsResponse() + client.list_job_runs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_job_runs_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.ListJobRunsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListJobRunsResponse()) + await client.list_job_runs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_job_runs_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListJobRunsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_job_runs( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_job_runs_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_job_runs( + cloud_deploy.ListJobRunsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_job_runs_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.ListJobRunsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListJobRunsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_job_runs( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_job_runs_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_job_runs( + cloud_deploy.ListJobRunsRequest(), + parent='parent_value', + ) + + +def test_list_job_runs_pager(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + next_page_token='abc', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[], + next_page_token='def', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_job_runs(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, cloud_deploy.JobRun) + for i in results) +def test_list_job_runs_pages(transport_name: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + next_page_token='abc', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[], + next_page_token='def', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + ), + RuntimeError, + ) + pages = list(client.list_job_runs(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_job_runs_async_pager(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + next_page_token='abc', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[], + next_page_token='def', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_job_runs(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, cloud_deploy.JobRun) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_job_runs_async_pages(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_job_runs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + next_page_token='abc', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[], + next_page_token='def', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + ], + next_page_token='ghi', + ), + cloud_deploy.ListJobRunsResponse( + job_runs=[ + cloud_deploy.JobRun(), + cloud_deploy.JobRun(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_job_runs(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.GetJobRunRequest, + dict, +]) +def test_get_job_run(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_job_run), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.JobRun( + name='name_value', + uid='uid_value', + phase_id='phase_id_value', + job_id='job_id_value', + state=cloud_deploy.JobRun.State.IN_PROGRESS, + etag='etag_value', + deploy_job_run=cloud_deploy.DeployJobRun(build='build_value'), + ) + response = client.get_job_run(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetJobRunRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.JobRun) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.phase_id == 'phase_id_value' + assert response.job_id == 'job_id_value' + assert response.state == cloud_deploy.JobRun.State.IN_PROGRESS + assert response.etag == 'etag_value' + + +def test_get_job_run_empty_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_job_run), + '__call__') as call: + client.get_job_run() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetJobRunRequest() + +@pytest.mark.asyncio +async def test_get_job_run_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetJobRunRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_job_run), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.JobRun( + name='name_value', + uid='uid_value', + phase_id='phase_id_value', + job_id='job_id_value', + state=cloud_deploy.JobRun.State.IN_PROGRESS, + etag='etag_value', + )) + response = await client.get_job_run(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetJobRunRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.JobRun) + assert response.name == 'name_value' + assert response.uid == 'uid_value' + assert response.phase_id == 'phase_id_value' + assert response.job_id == 'job_id_value' + assert response.state == cloud_deploy.JobRun.State.IN_PROGRESS + assert response.etag == 'etag_value' + + +@pytest.mark.asyncio +async def test_get_job_run_async_from_dict(): + await test_get_job_run_async(request_type=dict) + + +def test_get_job_run_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetJobRunRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_job_run), + '__call__') as call: + call.return_value = cloud_deploy.JobRun() + client.get_job_run(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_job_run_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetJobRunRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_job_run), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.JobRun()) + await client.get_job_run(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_job_run_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_job_run), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.JobRun() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_job_run( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_job_run_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_job_run( + cloud_deploy.GetJobRunRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_job_run_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_job_run), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.JobRun() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.JobRun()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_job_run( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_job_run_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_job_run( + cloud_deploy.GetJobRunRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + cloud_deploy.GetConfigRequest, + dict, +]) +def test_get_config(request_type, transport: str = 'grpc'): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Config( + name='name_value', + default_skaffold_version='default_skaffold_version_value', + ) + response = client.get_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] == cloud_deploy.GetConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Config) + assert response.name == 'name_value' + assert response.default_skaffold_version == 'default_skaffold_version_value' + + +def test_get_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 = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_config), + '__call__') as call: + client.get_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetConfigRequest() + +@pytest.mark.asyncio +async def test_get_config_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetConfigRequest): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Config( + name='name_value', + default_skaffold_version='default_skaffold_version_value', + )) + response = await client.get_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_deploy.GetConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, cloud_deploy.Config) + assert response.name == 'name_value' + assert response.default_skaffold_version == 'default_skaffold_version_value' + + +@pytest.mark.asyncio +async def test_get_config_async_from_dict(): + await test_get_config_async(request_type=dict) + + +def test_get_config_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_config), + '__call__') as call: + call.return_value = cloud_deploy.Config() + client.get_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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_config_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cloud_deploy.GetConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Config()) + await client.get_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_config_flattened(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Config() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_config_flattened_error(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_config( + cloud_deploy.GetConfigRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_config_flattened_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = cloud_deploy.Config() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Config()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_config_flattened_error_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_config( + cloud_deploy.GetConfigRequest(), + name='name_value', + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.CloudDeployGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CloudDeployGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudDeployClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.CloudDeployGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudDeployClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudDeployClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CloudDeployGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudDeployClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudDeployGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = CloudDeployClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudDeployGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CloudDeployGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.CloudDeployGrpcTransport, + transports.CloudDeployGrpcAsyncIOTransport, +]) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + +@pytest.mark.parametrize("transport_name", [ + "grpc", +]) +def test_transport_kind(transport_name): + transport = CloudDeployClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.CloudDeployGrpcTransport, + ) + +def test_cloud_deploy_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.CloudDeployTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_cloud_deploy_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.CloudDeployTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'list_delivery_pipelines', + 'get_delivery_pipeline', + 'create_delivery_pipeline', + 'update_delivery_pipeline', + 'delete_delivery_pipeline', + 'list_targets', + 'get_target', + 'create_target', + 'update_target', + 'delete_target', + 'list_releases', + 'get_release', + 'create_release', + 'abandon_release', + 'approve_rollout', + 'list_rollouts', + 'get_rollout', + 'create_rollout', + 'retry_job', + 'list_job_runs', + 'get_job_run', + 'get_config', + 'set_iam_policy', + 'get_iam_policy', + 'test_iam_permissions', + 'get_location', + 'list_locations', + 'get_operation', + 'cancel_operation', + 'delete_operation', + 'list_operations', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + # Catch all for all remaining methods and properties + remainder = [ + 'kind', + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + + +def test_cloud_deploy_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CloudDeployTransport( + 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", + ) + + +def test_cloud_deploy_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CloudDeployTransport() + adc.assert_called_once() + + +def test_cloud_deploy_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + CloudDeployClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudDeployGrpcTransport, + transports.CloudDeployGrpcAsyncIOTransport, + ], +) +def test_cloud_deploy_transport_auth_adc(transport_class): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + adc.assert_called_once_with( + scopes=["1", "2"], + default_scopes=( 'https://www.googleapis.com/auth/cloud-platform',), + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudDeployGrpcTransport, + transports.CloudDeployGrpcAsyncIOTransport, + ], +) +def test_cloud_deploy_transport_auth_gdch_credentials(transport_class): + host = 'https://language.com' + api_audience_tests = [None, 'https://language2.com'] + api_audience_expect = [host, 'https://language2.com'] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with( + e + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CloudDeployGrpcTransport, grpc_helpers), + (transports.CloudDeployGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +def test_cloud_deploy_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( + "clouddeploy.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="clouddeploy.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("transport_class", [transports.CloudDeployGrpcTransport, transports.CloudDeployGrpcAsyncIOTransport]) +def test_cloud_deploy_grpc_transport_client_cert_source_for_mtls( + transport_class +): + cred = ga_credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, + private_key=expected_key + ) + + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_cloud_deploy_host_no_port(transport_name): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='clouddeploy.googleapis.com'), + transport=transport_name, + ) + assert client.transport._host == ( + 'clouddeploy.googleapis.com:443' + ) + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_cloud_deploy_host_with_port(transport_name): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='clouddeploy.googleapis.com:8000'), + transport=transport_name, + ) + assert client.transport._host == ( + 'clouddeploy.googleapis.com:8000' + ) + +def test_cloud_deploy_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CloudDeployGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +def test_cloud_deploy_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CloudDeployGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CloudDeployGrpcTransport, transports.CloudDeployGrpcAsyncIOTransport]) +def test_cloud_deploy_transport_channel_mtls_with_client_cert_source( + transport_class +): + with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + cred = ga_credentials.AnonymousCredentials() + with pytest.warns(DeprecationWarning): + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (cred, None) + transport = transport_class( + host="squid.clam.whelk", + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + adc.assert_called_once() + + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CloudDeployGrpcTransport, transports.CloudDeployGrpcAsyncIOTransport]) +def test_cloud_deploy_transport_channel_mtls_with_adc( + transport_class +): + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + mock_cred = mock.Mock() + + with pytest.warns(DeprecationWarning): + transport = transport_class( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=None, + ) + + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_cloud_deploy_grpc_lro_client(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_cloud_deploy_grpc_lro_async_client(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_build_path(): + project = "squid" + location = "clam" + build = "whelk" + expected = "projects/{project}/locations/{location}/builds/{build}".format(project=project, location=location, build=build, ) + actual = CloudDeployClient.build_path(project, location, build) + assert expected == actual + + +def test_parse_build_path(): + expected = { + "project": "octopus", + "location": "oyster", + "build": "nudibranch", + } + path = CloudDeployClient.build_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_build_path(path) + assert expected == actual + +def test_cluster_path(): + project = "cuttlefish" + location = "mussel" + cluster = "winkle" + expected = "projects/{project}/locations/{location}/clusters/{cluster}".format(project=project, location=location, cluster=cluster, ) + actual = CloudDeployClient.cluster_path(project, location, cluster) + assert expected == actual + + +def test_parse_cluster_path(): + expected = { + "project": "nautilus", + "location": "scallop", + "cluster": "abalone", + } + path = CloudDeployClient.cluster_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_cluster_path(path) + assert expected == actual + +def test_config_path(): + project = "squid" + location = "clam" + expected = "projects/{project}/locations/{location}/config".format(project=project, location=location, ) + actual = CloudDeployClient.config_path(project, location) + assert expected == actual + + +def test_parse_config_path(): + expected = { + "project": "whelk", + "location": "octopus", + } + path = CloudDeployClient.config_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_config_path(path) + assert expected == actual + +def test_delivery_pipeline_path(): + project = "oyster" + location = "nudibranch" + delivery_pipeline = "cuttlefish" + expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, ) + actual = CloudDeployClient.delivery_pipeline_path(project, location, delivery_pipeline) + assert expected == actual + + +def test_parse_delivery_pipeline_path(): + expected = { + "project": "mussel", + "location": "winkle", + "delivery_pipeline": "nautilus", + } + path = CloudDeployClient.delivery_pipeline_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_delivery_pipeline_path(path) + assert expected == actual + +def test_job_run_path(): + project = "scallop" + location = "abalone" + delivery_pipeline = "squid" + release = "clam" + rollout = "whelk" + job_run = "octopus" + expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, job_run=job_run, ) + actual = CloudDeployClient.job_run_path(project, location, delivery_pipeline, release, rollout, job_run) + assert expected == actual + + +def test_parse_job_run_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + "delivery_pipeline": "cuttlefish", + "release": "mussel", + "rollout": "winkle", + "job_run": "nautilus", + } + path = CloudDeployClient.job_run_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_job_run_path(path) + assert expected == actual + +def test_membership_path(): + project = "scallop" + location = "abalone" + membership = "squid" + expected = "projects/{project}/locations/{location}/memberships/{membership}".format(project=project, location=location, membership=membership, ) + actual = CloudDeployClient.membership_path(project, location, membership) + assert expected == actual + + +def test_parse_membership_path(): + expected = { + "project": "clam", + "location": "whelk", + "membership": "octopus", + } + path = CloudDeployClient.membership_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_membership_path(path) + assert expected == actual + +def test_release_path(): + project = "oyster" + location = "nudibranch" + delivery_pipeline = "cuttlefish" + release = "mussel" + expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, ) + actual = CloudDeployClient.release_path(project, location, delivery_pipeline, release) + assert expected == actual + + +def test_parse_release_path(): + expected = { + "project": "winkle", + "location": "nautilus", + "delivery_pipeline": "scallop", + "release": "abalone", + } + path = CloudDeployClient.release_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_release_path(path) + assert expected == actual + +def test_rollout_path(): + project = "squid" + location = "clam" + delivery_pipeline = "whelk" + release = "octopus" + rollout = "oyster" + expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, ) + actual = CloudDeployClient.rollout_path(project, location, delivery_pipeline, release, rollout) + assert expected == actual + + +def test_parse_rollout_path(): + expected = { + "project": "nudibranch", + "location": "cuttlefish", + "delivery_pipeline": "mussel", + "release": "winkle", + "rollout": "nautilus", + } + path = CloudDeployClient.rollout_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_rollout_path(path) + assert expected == actual + +def test_target_path(): + project = "scallop" + location = "abalone" + target = "squid" + expected = "projects/{project}/locations/{location}/targets/{target}".format(project=project, location=location, target=target, ) + actual = CloudDeployClient.target_path(project, location, target) + assert expected == actual + + +def test_parse_target_path(): + expected = { + "project": "clam", + "location": "whelk", + "target": "octopus", + } + path = CloudDeployClient.target_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_target_path(path) + assert expected == actual + +def test_worker_pool_path(): + project = "oyster" + location = "nudibranch" + worker_pool = "cuttlefish" + expected = "projects/{project}/locations/{location}/workerPools/{worker_pool}".format(project=project, location=location, worker_pool=worker_pool, ) + actual = CloudDeployClient.worker_pool_path(project, location, worker_pool) + assert expected == actual + + +def test_parse_worker_pool_path(): + expected = { + "project": "mussel", + "location": "winkle", + "worker_pool": "nautilus", + } + path = CloudDeployClient.worker_pool_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_worker_pool_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "scallop" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = CloudDeployClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "abalone", + } + path = CloudDeployClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "squid" + expected = "folders/{folder}".format(folder=folder, ) + actual = CloudDeployClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "clam", + } + path = CloudDeployClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "whelk" + expected = "organizations/{organization}".format(organization=organization, ) + actual = CloudDeployClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "octopus", + } + path = CloudDeployClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "oyster" + expected = "projects/{project}".format(project=project, ) + actual = CloudDeployClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "nudibranch", + } + path = CloudDeployClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "cuttlefish" + location = "mussel" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = CloudDeployClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "winkle", + "location": "nautilus", + } + path = CloudDeployClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = CloudDeployClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object(transports.CloudDeployTransport, '_prep_wrapped_messages') as prep: + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.CloudDeployTransport, '_prep_wrapped_messages') as prep: + transport_class = CloudDeployClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_delete_operation(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_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] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_delete_operation_async(transport: str = "grpc"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_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] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_delete_operation_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = None + + client.delete_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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_delete_operation_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + await client.delete_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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_delete_operation_from_dict(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_delete_operation_from_dict_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_cancel_operation(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # 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 + 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] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_cancel_operation_async(transport: str = "grpc"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # 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 = 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) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_cancel_operation_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_cancel_operation_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_cancel_operation_from_dict(): + client = CloudDeployClient( + 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 + + response = client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_cancel_operation_from_dict_async(): + client = CloudDeployAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_get_operation(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # 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 = operations_pb2.Operation() + 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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) +@pytest.mark.asyncio +async def test_get_operation_async(transport: str = "grpc"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # 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 = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await 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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + +def test_get_operation_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.GetOperationRequest() + request.name = "locations" + + # 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 = operations_pb2.Operation() + + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_get_operation_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.GetOperationRequest() + request.name = "locations" + + # 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 = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_get_operation_from_dict(): + client = CloudDeployClient( + 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 = operations_pb2.Operation() + + response = client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_get_operation_from_dict_async(): + client = CloudDeployAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_list_operations(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # 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 = operations_pb2.ListOperationsResponse() + 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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) +@pytest.mark.asyncio +async def test_list_operations_async(transport: str = "grpc"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # 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 = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await 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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) + +def test_list_operations_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # 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 = operations_pb2.ListOperationsResponse() + + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_list_operations_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # 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 = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + await 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_list_operations_from_dict(): + client = CloudDeployClient( + 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 = operations_pb2.ListOperationsResponse() + + response = client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_list_operations_from_dict_async(): + client = CloudDeployAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_list_locations(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.ListLocationsRequest() + + # 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 = locations_pb2.ListLocationsResponse() + 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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.ListLocationsResponse) +@pytest.mark.asyncio +async def test_list_locations_async(transport: str = "grpc"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.ListLocationsRequest() + + # 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 = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.ListLocationsResponse() + ) + response = await 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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.ListLocationsResponse) + +def test_list_locations_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = locations_pb2.ListLocationsRequest() + request.name = "locations" + + # 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 = locations_pb2.ListLocationsResponse() + + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_list_locations_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = locations_pb2.ListLocationsRequest() + request.name = "locations" + + # 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 = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.ListLocationsResponse() + ) + await 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_list_locations_from_dict(): + client = CloudDeployClient( + 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 = locations_pb2.ListLocationsResponse() + + response = client.list_locations( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_list_locations_from_dict_async(): + client = CloudDeployAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.ListLocationsResponse() + ) + response = await client.list_locations( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_get_location(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.GetLocationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = locations_pb2.Location() + response = client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.Location) +@pytest.mark.asyncio +async def test_get_location_async(transport: str = "grpc_asyncio"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.GetLocationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.Location() + ) + response = await client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.Location) + +def test_get_location_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials()) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = locations_pb2.GetLocationRequest() + request.name = "locations/abc" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + call.return_value = locations_pb2.Location() + + client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] +@pytest.mark.asyncio +async def test_get_location_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials() + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = locations_pb2.GetLocationRequest() + request.name = "locations/abc" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.Location() + ) + await client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] + +def test_get_location_from_dict(): + client = CloudDeployClient( + 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 = locations_pb2.Location() + + response = client.get_location( + request={ + "name": "locations/abc", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_get_location_from_dict_async(): + client = CloudDeployAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.Location() + ) + response = await client.get_location( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_set_iam_policy(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = iam_policy_pb2.SetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + response = client.set_iam_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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" +@pytest.mark.asyncio +async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = iam_policy_pb2.SetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy(version=774, etag=b"etag_blob",) + ) + response = await client.set_iam_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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" + +def test_set_iam_policy_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.SetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + call.return_value = policy_pb2.Policy() + + client.set_iam_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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] +@pytest.mark.asyncio +async def test_set_iam_policy_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.SetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.set_iam_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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + +def test_set_iam_policy_from_dict(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + response = client.set_iam_policy( + request={ + "resource": "resource_value", + "policy": policy_pb2.Policy(version=774), + } + ) + call.assert_called() + + +@pytest.mark.asyncio +async def test_set_iam_policy_from_dict_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy() + ) + + response = await client.set_iam_policy( + request={ + "resource": "resource_value", + "policy": policy_pb2.Policy(version=774), + } + ) + call.assert_called() + +def test_get_iam_policy(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = iam_policy_pb2.GetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + + response = client.get_iam_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] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" + + +@pytest.mark.asyncio +async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = iam_policy_pb2.GetIamPolicyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_iam_policy), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy(version=774, etag=b"etag_blob",) + ) + + response = await client.get_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + + assert response.version == 774 + + assert response.etag == b"etag_blob" + + +def test_get_iam_policy_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.GetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + call.return_value = policy_pb2.Policy() + + client.get_iam_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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_iam_policy_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.GetIamPolicyRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_iam_policy), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + + await client.get_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + + +def test_get_iam_policy_from_dict(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + + response = client.get_iam_policy( + request={ + "resource": "resource_value", + "options": options_pb2.GetPolicyOptions(requested_policy_version=2598), + } + ) + call.assert_called() + +@pytest.mark.asyncio +async def test_get_iam_policy_from_dict_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy() + ) + + response = await client.get_iam_policy( + request={ + "resource": "resource_value", + "options": options_pb2.GetPolicyOptions(requested_policy_version=2598), + } + ) + call.assert_called() + +def test_test_iam_permissions(transport: str = "grpc"): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = iam_policy_pb2.TestIamPermissionsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse( + permissions=["permissions_value"], + ) + + response = client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) + + assert response.permissions == ["permissions_value"] + + +@pytest.mark.asyncio +async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = iam_policy_pb2.TestIamPermissionsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse(permissions=["permissions_value"],) + ) + + response = await client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) + + assert response.permissions == ["permissions_value"] + + +def test_test_iam_permissions_field_headers(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.TestIamPermissionsRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_test_iam_permissions_field_headers_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.TestIamPermissionsRequest() + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + await client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + + +def test_test_iam_permissions_from_dict(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + + response = client.test_iam_permissions( + request={ + "resource": "resource_value", + "permissions": ["permissions_value"], + } + ) + call.assert_called() + +@pytest.mark.asyncio +async def test_test_iam_permissions_from_dict_async(): + client = CloudDeployAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + + response = await client.test_iam_permissions( + request={ + "resource": "resource_value", + "permissions": ["permissions_value"], + } + ) + call.assert_called() + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + +def test_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = CloudDeployClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + +@pytest.mark.parametrize("client_class,transport_class", [ + (CloudDeployClient, transports.CloudDeployGrpcTransport), + (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport), +]) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) From d37264dbdeb876a395b8d7f73a51cb9591060bc8 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 27 Sep 2022 18:51:27 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../services/cloud_deploy/async_client.py | 2 - .../deploy_v1/services/cloud_deploy/client.py | 17 - owl-bot-staging/v1/.coveragerc | 17 - owl-bot-staging/v1/.flake8 | 33 - owl-bot-staging/v1/MANIFEST.in | 2 - owl-bot-staging/v1/README.rst | 49 - owl-bot-staging/v1/docs/conf.py | 376 - .../v1/docs/deploy_v1/cloud_deploy.rst | 10 - .../v1/docs/deploy_v1/services.rst | 6 - owl-bot-staging/v1/docs/deploy_v1/types.rst | 7 - owl-bot-staging/v1/docs/index.rst | 7 - .../v1/google/cloud/deploy/__init__.py | 163 - .../v1/google/cloud/deploy/py.typed | 2 - .../v1/google/cloud/deploy_v1/__init__.py | 164 - .../cloud/deploy_v1/gapic_metadata.json | 243 - .../v1/google/cloud/deploy_v1/py.typed | 2 - .../cloud/deploy_v1/services/__init__.py | 15 - .../services/cloud_deploy/__init__.py | 22 - .../services/cloud_deploy/async_client.py | 3471 ------- .../deploy_v1/services/cloud_deploy/client.py | 3681 ------- .../deploy_v1/services/cloud_deploy/pagers.py | 623 -- .../cloud_deploy/transports/__init__.py | 33 - .../services/cloud_deploy/transports/base.py | 607 -- .../services/cloud_deploy/transports/grpc.py | 1026 -- .../cloud_deploy/transports/grpc_asyncio.py | 1025 -- .../google/cloud/deploy_v1/types/__init__.py | 171 - .../cloud/deploy_v1/types/cloud_deploy.py | 2862 ------ .../deliverypipeline_notification_payload.py | 61 - .../types/jobrun_notification_payload.py | 84 - .../google/cloud/deploy_v1/types/log_enums.py | 36 - .../types/release_notification_payload.py | 60 - .../deploy_v1/types/release_render_payload.py | 50 - .../types/rollout_notification_payload.py | 78 - .../types/target_notification_payload.py | 60 - owl-bot-staging/v1/mypy.ini | 3 - owl-bot-staging/v1/noxfile.py | 179 - ...ated_cloud_deploy_abandon_release_async.py | 52 - ...rated_cloud_deploy_abandon_release_sync.py | 52 - ...ated_cloud_deploy_approve_rollout_async.py | 53 - ...rated_cloud_deploy_approve_rollout_sync.py | 53 - ...d_deploy_create_delivery_pipeline_async.py | 57 - ...ud_deploy_create_delivery_pipeline_sync.py | 57 - ...rated_cloud_deploy_create_release_async.py | 57 - ...erated_cloud_deploy_create_release_sync.py | 57 - ...rated_cloud_deploy_create_rollout_async.py | 61 - ...erated_cloud_deploy_create_rollout_sync.py | 61 - ...erated_cloud_deploy_create_target_async.py | 57 - ...nerated_cloud_deploy_create_target_sync.py | 57 - ...d_deploy_delete_delivery_pipeline_async.py | 56 - ...ud_deploy_delete_delivery_pipeline_sync.py | 56 - ...erated_cloud_deploy_delete_target_async.py | 56 - ...nerated_cloud_deploy_delete_target_sync.py | 56 - ...generated_cloud_deploy_get_config_async.py | 52 - ..._generated_cloud_deploy_get_config_sync.py | 52 - ...loud_deploy_get_delivery_pipeline_async.py | 52 - ...cloud_deploy_get_delivery_pipeline_sync.py | 52 - ...enerated_cloud_deploy_get_job_run_async.py | 52 - ...generated_cloud_deploy_get_job_run_sync.py | 52 - ...enerated_cloud_deploy_get_release_async.py | 52 - ...generated_cloud_deploy_get_release_sync.py | 52 - ...enerated_cloud_deploy_get_rollout_async.py | 52 - ...generated_cloud_deploy_get_rollout_sync.py | 52 - ...generated_cloud_deploy_get_target_async.py | 52 - ..._generated_cloud_deploy_get_target_sync.py | 52 - ...ud_deploy_list_delivery_pipelines_async.py | 53 - ...oud_deploy_list_delivery_pipelines_sync.py | 53 - ...erated_cloud_deploy_list_job_runs_async.py | 53 - ...nerated_cloud_deploy_list_job_runs_sync.py | 53 - ...erated_cloud_deploy_list_releases_async.py | 53 - ...nerated_cloud_deploy_list_releases_sync.py | 53 - ...erated_cloud_deploy_list_rollouts_async.py | 53 - ...nerated_cloud_deploy_list_rollouts_sync.py | 53 - ...nerated_cloud_deploy_list_targets_async.py | 53 - ...enerated_cloud_deploy_list_targets_sync.py | 53 - ..._generated_cloud_deploy_retry_job_async.py | 54 - ...1_generated_cloud_deploy_retry_job_sync.py | 54 - ...d_deploy_update_delivery_pipeline_async.py | 55 - ...ud_deploy_update_delivery_pipeline_sync.py | 55 - ...erated_cloud_deploy_update_target_async.py | 55 - ...nerated_cloud_deploy_update_target_sync.py | 55 - .../snippet_metadata_deploy_v1.json | 3652 ------- .../v1/scripts/fixup_deploy_v1_keywords.py | 197 - owl-bot-staging/v1/setup.py | 59 - owl-bot-staging/v1/tests/__init__.py | 16 - owl-bot-staging/v1/tests/unit/__init__.py | 16 - .../v1/tests/unit/gapic/__init__.py | 16 - .../v1/tests/unit/gapic/deploy_v1/__init__.py | 16 - .../unit/gapic/deploy_v1/test_cloud_deploy.py | 8966 ----------------- .../unit/gapic/deploy_v1/test_cloud_deploy.py | 117 +- 89 files changed, 47 insertions(+), 30635 deletions(-) delete mode 100644 owl-bot-staging/v1/.coveragerc delete mode 100644 owl-bot-staging/v1/.flake8 delete mode 100644 owl-bot-staging/v1/MANIFEST.in delete mode 100644 owl-bot-staging/v1/README.rst delete mode 100644 owl-bot-staging/v1/docs/conf.py delete mode 100644 owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst delete mode 100644 owl-bot-staging/v1/docs/deploy_v1/services.rst delete mode 100644 owl-bot-staging/v1/docs/deploy_v1/types.rst delete mode 100644 owl-bot-staging/v1/docs/index.rst delete mode 100644 owl-bot-staging/v1/google/cloud/deploy/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py delete mode 100644 owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py delete mode 100644 owl-bot-staging/v1/mypy.ini delete mode 100644 owl-bot-staging/v1/noxfile.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json delete mode 100644 owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py delete mode 100644 owl-bot-staging/v1/setup.py delete mode 100644 owl-bot-staging/v1/tests/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py diff --git a/google/cloud/deploy_v1/services/cloud_deploy/async_client.py b/google/cloud/deploy_v1/services/cloud_deploy/async_client.py index 13840e7..0192956 100644 --- a/google/cloud/deploy_v1/services/cloud_deploy/async_client.py +++ b/google/cloud/deploy_v1/services/cloud_deploy/async_client.py @@ -72,8 +72,6 @@ class CloudDeployAsyncClient: ) job_run_path = staticmethod(CloudDeployClient.job_run_path) parse_job_run_path = staticmethod(CloudDeployClient.parse_job_run_path) - location_path = staticmethod(CloudDeployClient.location_path) - parse_location_path = staticmethod(CloudDeployClient.parse_location_path) membership_path = staticmethod(CloudDeployClient.membership_path) parse_membership_path = staticmethod(CloudDeployClient.parse_membership_path) release_path = staticmethod(CloudDeployClient.release_path) diff --git a/google/cloud/deploy_v1/services/cloud_deploy/client.py b/google/cloud/deploy_v1/services/cloud_deploy/client.py index 8055c86..83dd0ea 100644 --- a/google/cloud/deploy_v1/services/cloud_deploy/client.py +++ b/google/cloud/deploy_v1/services/cloud_deploy/client.py @@ -287,23 +287,6 @@ def parse_job_run_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} - @staticmethod - def location_path( - project: str, - location: str, - ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - - @staticmethod - def parse_location_path(path: str) -> Dict[str, str]: - """Parses a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - @staticmethod def membership_path( project: str, diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc deleted file mode 100644 index c88d6f1..0000000 --- a/owl-bot-staging/v1/.coveragerc +++ /dev/null @@ -1,17 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/deploy/__init__.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 deleted file mode 100644 index 29227d4..0000000 --- a/owl-bot-staging/v1/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Generated by synthtool. DO NOT EDIT! -[flake8] -ignore = E203, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in deleted file mode 100644 index 20b11ef..0000000 --- a/owl-bot-staging/v1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/deploy *.py -recursive-include google/cloud/deploy_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst deleted file mode 100644 index d94adc9..0000000 --- a/owl-bot-staging/v1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Deploy API -================================================= - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. Enable the Google Cloud Deploy API. -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - python3 -m venv - source /bin/activate - /bin/pip install /path/to/library - - -Windows -^^^^^^^ - -.. code-block:: console - - python3 -m venv - \Scripts\activate - \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py deleted file mode 100644 index 0d255f3..0000000 --- a/owl-bot-staging/v1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# google-cloud-deploy documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -__version__ = "0.1.0" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "4.0.1" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_flags = ["members"] -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = u"google-cloud-deploy" -copyright = u"2022, Google, LLC" -author = u"Google APIs" # TODO: autogenerate this bit - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["_build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Client Libraries for Python", - "github_user": "googleapis", - "github_repo": "google-cloud-python", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-deploy-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-deploy.tex", - u"google-cloud-deploy Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-deploy", - u"Google Cloud Deploy Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-deploy", - u"google-cloud-deploy Documentation", - author, - "google-cloud-deploy", - "GAPIC library for Google Cloud Deploy API", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("http://python.readthedocs.org/en/latest/", None), - "gax": ("https://gax-python.readthedocs.org/en/latest/", None), - "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), - "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://requests.kennethreitz.org/en/stable/", None), - "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst b/owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst deleted file mode 100644 index be06f16..0000000 --- a/owl-bot-staging/v1/docs/deploy_v1/cloud_deploy.rst +++ /dev/null @@ -1,10 +0,0 @@ -CloudDeploy ------------------------------ - -.. automodule:: google.cloud.deploy_v1.services.cloud_deploy - :members: - :inherited-members: - -.. automodule:: google.cloud.deploy_v1.services.cloud_deploy.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/v1/docs/deploy_v1/services.rst b/owl-bot-staging/v1/docs/deploy_v1/services.rst deleted file mode 100644 index f6dc89a..0000000 --- a/owl-bot-staging/v1/docs/deploy_v1/services.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Deploy v1 API -======================================= -.. toctree:: - :maxdepth: 2 - - cloud_deploy diff --git a/owl-bot-staging/v1/docs/deploy_v1/types.rst b/owl-bot-staging/v1/docs/deploy_v1/types.rst deleted file mode 100644 index 82f8c0c..0000000 --- a/owl-bot-staging/v1/docs/deploy_v1/types.rst +++ /dev/null @@ -1,7 +0,0 @@ -Types for Google Cloud Deploy v1 API -==================================== - -.. automodule:: google.cloud.deploy_v1.types - :members: - :undoc-members: - :show-inheritance: diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst deleted file mode 100644 index 356c19e..0000000 --- a/owl-bot-staging/v1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - deploy_v1/services - deploy_v1/types diff --git a/owl-bot-staging/v1/google/cloud/deploy/__init__.py b/owl-bot-staging/v1/google/cloud/deploy/__init__.py deleted file mode 100644 index cffa5a3..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy/__init__.py +++ /dev/null @@ -1,163 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from google.cloud.deploy_v1.services.cloud_deploy.client import CloudDeployClient -from google.cloud.deploy_v1.services.cloud_deploy.async_client import CloudDeployAsyncClient - -from google.cloud.deploy_v1.types.cloud_deploy import AbandonReleaseRequest -from google.cloud.deploy_v1.types.cloud_deploy import AbandonReleaseResponse -from google.cloud.deploy_v1.types.cloud_deploy import AnthosCluster -from google.cloud.deploy_v1.types.cloud_deploy import ApproveRolloutRequest -from google.cloud.deploy_v1.types.cloud_deploy import ApproveRolloutResponse -from google.cloud.deploy_v1.types.cloud_deploy import BuildArtifact -from google.cloud.deploy_v1.types.cloud_deploy import CloudRunLocation -from google.cloud.deploy_v1.types.cloud_deploy import CloudRunMetadata -from google.cloud.deploy_v1.types.cloud_deploy import Config -from google.cloud.deploy_v1.types.cloud_deploy import CreateDeliveryPipelineRequest -from google.cloud.deploy_v1.types.cloud_deploy import CreateReleaseRequest -from google.cloud.deploy_v1.types.cloud_deploy import CreateRolloutRequest -from google.cloud.deploy_v1.types.cloud_deploy import CreateTargetRequest -from google.cloud.deploy_v1.types.cloud_deploy import DefaultPool -from google.cloud.deploy_v1.types.cloud_deploy import DeleteDeliveryPipelineRequest -from google.cloud.deploy_v1.types.cloud_deploy import DeleteTargetRequest -from google.cloud.deploy_v1.types.cloud_deploy import DeliveryPipeline -from google.cloud.deploy_v1.types.cloud_deploy import DeployJob -from google.cloud.deploy_v1.types.cloud_deploy import DeployJobRun -from google.cloud.deploy_v1.types.cloud_deploy import DeployJobRunMetadata -from google.cloud.deploy_v1.types.cloud_deploy import DeploymentJobs -from google.cloud.deploy_v1.types.cloud_deploy import ExecutionConfig -from google.cloud.deploy_v1.types.cloud_deploy import GetConfigRequest -from google.cloud.deploy_v1.types.cloud_deploy import GetDeliveryPipelineRequest -from google.cloud.deploy_v1.types.cloud_deploy import GetJobRunRequest -from google.cloud.deploy_v1.types.cloud_deploy import GetReleaseRequest -from google.cloud.deploy_v1.types.cloud_deploy import GetRolloutRequest -from google.cloud.deploy_v1.types.cloud_deploy import GetTargetRequest -from google.cloud.deploy_v1.types.cloud_deploy import GkeCluster -from google.cloud.deploy_v1.types.cloud_deploy import Job -from google.cloud.deploy_v1.types.cloud_deploy import JobRun -from google.cloud.deploy_v1.types.cloud_deploy import ListDeliveryPipelinesRequest -from google.cloud.deploy_v1.types.cloud_deploy import ListDeliveryPipelinesResponse -from google.cloud.deploy_v1.types.cloud_deploy import ListJobRunsRequest -from google.cloud.deploy_v1.types.cloud_deploy import ListJobRunsResponse -from google.cloud.deploy_v1.types.cloud_deploy import ListReleasesRequest -from google.cloud.deploy_v1.types.cloud_deploy import ListReleasesResponse -from google.cloud.deploy_v1.types.cloud_deploy import ListRolloutsRequest -from google.cloud.deploy_v1.types.cloud_deploy import ListRolloutsResponse -from google.cloud.deploy_v1.types.cloud_deploy import ListTargetsRequest -from google.cloud.deploy_v1.types.cloud_deploy import ListTargetsResponse -from google.cloud.deploy_v1.types.cloud_deploy import Metadata -from google.cloud.deploy_v1.types.cloud_deploy import OperationMetadata -from google.cloud.deploy_v1.types.cloud_deploy import Phase -from google.cloud.deploy_v1.types.cloud_deploy import PipelineCondition -from google.cloud.deploy_v1.types.cloud_deploy import PipelineReadyCondition -from google.cloud.deploy_v1.types.cloud_deploy import PrivatePool -from google.cloud.deploy_v1.types.cloud_deploy import Release -from google.cloud.deploy_v1.types.cloud_deploy import RetryJobRequest -from google.cloud.deploy_v1.types.cloud_deploy import RetryJobResponse -from google.cloud.deploy_v1.types.cloud_deploy import Rollout -from google.cloud.deploy_v1.types.cloud_deploy import SerialPipeline -from google.cloud.deploy_v1.types.cloud_deploy import SkaffoldVersion -from google.cloud.deploy_v1.types.cloud_deploy import Stage -from google.cloud.deploy_v1.types.cloud_deploy import Standard -from google.cloud.deploy_v1.types.cloud_deploy import Strategy -from google.cloud.deploy_v1.types.cloud_deploy import Target -from google.cloud.deploy_v1.types.cloud_deploy import TargetArtifact -from google.cloud.deploy_v1.types.cloud_deploy import TargetsPresentCondition -from google.cloud.deploy_v1.types.cloud_deploy import UpdateDeliveryPipelineRequest -from google.cloud.deploy_v1.types.cloud_deploy import UpdateTargetRequest -from google.cloud.deploy_v1.types.cloud_deploy import VerifyJob -from google.cloud.deploy_v1.types.cloud_deploy import VerifyJobRun -from google.cloud.deploy_v1.types.deliverypipeline_notification_payload import DeliveryPipelineNotificationEvent -from google.cloud.deploy_v1.types.jobrun_notification_payload import JobRunNotificationEvent -from google.cloud.deploy_v1.types.log_enums import Type -from google.cloud.deploy_v1.types.release_notification_payload import ReleaseNotificationEvent -from google.cloud.deploy_v1.types.release_render_payload import ReleaseRenderEvent -from google.cloud.deploy_v1.types.rollout_notification_payload import RolloutNotificationEvent -from google.cloud.deploy_v1.types.target_notification_payload import TargetNotificationEvent - -__all__ = ('CloudDeployClient', - 'CloudDeployAsyncClient', - 'AbandonReleaseRequest', - 'AbandonReleaseResponse', - 'AnthosCluster', - 'ApproveRolloutRequest', - 'ApproveRolloutResponse', - 'BuildArtifact', - 'CloudRunLocation', - 'CloudRunMetadata', - 'Config', - 'CreateDeliveryPipelineRequest', - 'CreateReleaseRequest', - 'CreateRolloutRequest', - 'CreateTargetRequest', - 'DefaultPool', - 'DeleteDeliveryPipelineRequest', - 'DeleteTargetRequest', - 'DeliveryPipeline', - 'DeployJob', - 'DeployJobRun', - 'DeployJobRunMetadata', - 'DeploymentJobs', - 'ExecutionConfig', - 'GetConfigRequest', - 'GetDeliveryPipelineRequest', - 'GetJobRunRequest', - 'GetReleaseRequest', - 'GetRolloutRequest', - 'GetTargetRequest', - 'GkeCluster', - 'Job', - 'JobRun', - 'ListDeliveryPipelinesRequest', - 'ListDeliveryPipelinesResponse', - 'ListJobRunsRequest', - 'ListJobRunsResponse', - 'ListReleasesRequest', - 'ListReleasesResponse', - 'ListRolloutsRequest', - 'ListRolloutsResponse', - 'ListTargetsRequest', - 'ListTargetsResponse', - 'Metadata', - 'OperationMetadata', - 'Phase', - 'PipelineCondition', - 'PipelineReadyCondition', - 'PrivatePool', - 'Release', - 'RetryJobRequest', - 'RetryJobResponse', - 'Rollout', - 'SerialPipeline', - 'SkaffoldVersion', - 'Stage', - 'Standard', - 'Strategy', - 'Target', - 'TargetArtifact', - 'TargetsPresentCondition', - 'UpdateDeliveryPipelineRequest', - 'UpdateTargetRequest', - 'VerifyJob', - 'VerifyJobRun', - 'DeliveryPipelineNotificationEvent', - 'JobRunNotificationEvent', - 'Type', - 'ReleaseNotificationEvent', - 'ReleaseRenderEvent', - 'RolloutNotificationEvent', - 'TargetNotificationEvent', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy/py.typed b/owl-bot-staging/v1/google/cloud/deploy/py.typed deleted file mode 100644 index 56a532f..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-deploy package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py deleted file mode 100644 index 4b22423..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/__init__.py +++ /dev/null @@ -1,164 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from .services.cloud_deploy import CloudDeployClient -from .services.cloud_deploy import CloudDeployAsyncClient - -from .types.cloud_deploy import AbandonReleaseRequest -from .types.cloud_deploy import AbandonReleaseResponse -from .types.cloud_deploy import AnthosCluster -from .types.cloud_deploy import ApproveRolloutRequest -from .types.cloud_deploy import ApproveRolloutResponse -from .types.cloud_deploy import BuildArtifact -from .types.cloud_deploy import CloudRunLocation -from .types.cloud_deploy import CloudRunMetadata -from .types.cloud_deploy import Config -from .types.cloud_deploy import CreateDeliveryPipelineRequest -from .types.cloud_deploy import CreateReleaseRequest -from .types.cloud_deploy import CreateRolloutRequest -from .types.cloud_deploy import CreateTargetRequest -from .types.cloud_deploy import DefaultPool -from .types.cloud_deploy import DeleteDeliveryPipelineRequest -from .types.cloud_deploy import DeleteTargetRequest -from .types.cloud_deploy import DeliveryPipeline -from .types.cloud_deploy import DeployJob -from .types.cloud_deploy import DeployJobRun -from .types.cloud_deploy import DeployJobRunMetadata -from .types.cloud_deploy import DeploymentJobs -from .types.cloud_deploy import ExecutionConfig -from .types.cloud_deploy import GetConfigRequest -from .types.cloud_deploy import GetDeliveryPipelineRequest -from .types.cloud_deploy import GetJobRunRequest -from .types.cloud_deploy import GetReleaseRequest -from .types.cloud_deploy import GetRolloutRequest -from .types.cloud_deploy import GetTargetRequest -from .types.cloud_deploy import GkeCluster -from .types.cloud_deploy import Job -from .types.cloud_deploy import JobRun -from .types.cloud_deploy import ListDeliveryPipelinesRequest -from .types.cloud_deploy import ListDeliveryPipelinesResponse -from .types.cloud_deploy import ListJobRunsRequest -from .types.cloud_deploy import ListJobRunsResponse -from .types.cloud_deploy import ListReleasesRequest -from .types.cloud_deploy import ListReleasesResponse -from .types.cloud_deploy import ListRolloutsRequest -from .types.cloud_deploy import ListRolloutsResponse -from .types.cloud_deploy import ListTargetsRequest -from .types.cloud_deploy import ListTargetsResponse -from .types.cloud_deploy import Metadata -from .types.cloud_deploy import OperationMetadata -from .types.cloud_deploy import Phase -from .types.cloud_deploy import PipelineCondition -from .types.cloud_deploy import PipelineReadyCondition -from .types.cloud_deploy import PrivatePool -from .types.cloud_deploy import Release -from .types.cloud_deploy import RetryJobRequest -from .types.cloud_deploy import RetryJobResponse -from .types.cloud_deploy import Rollout -from .types.cloud_deploy import SerialPipeline -from .types.cloud_deploy import SkaffoldVersion -from .types.cloud_deploy import Stage -from .types.cloud_deploy import Standard -from .types.cloud_deploy import Strategy -from .types.cloud_deploy import Target -from .types.cloud_deploy import TargetArtifact -from .types.cloud_deploy import TargetsPresentCondition -from .types.cloud_deploy import UpdateDeliveryPipelineRequest -from .types.cloud_deploy import UpdateTargetRequest -from .types.cloud_deploy import VerifyJob -from .types.cloud_deploy import VerifyJobRun -from .types.deliverypipeline_notification_payload import DeliveryPipelineNotificationEvent -from .types.jobrun_notification_payload import JobRunNotificationEvent -from .types.log_enums import Type -from .types.release_notification_payload import ReleaseNotificationEvent -from .types.release_render_payload import ReleaseRenderEvent -from .types.rollout_notification_payload import RolloutNotificationEvent -from .types.target_notification_payload import TargetNotificationEvent - -__all__ = ( - 'CloudDeployAsyncClient', -'AbandonReleaseRequest', -'AbandonReleaseResponse', -'AnthosCluster', -'ApproveRolloutRequest', -'ApproveRolloutResponse', -'BuildArtifact', -'CloudDeployClient', -'CloudRunLocation', -'CloudRunMetadata', -'Config', -'CreateDeliveryPipelineRequest', -'CreateReleaseRequest', -'CreateRolloutRequest', -'CreateTargetRequest', -'DefaultPool', -'DeleteDeliveryPipelineRequest', -'DeleteTargetRequest', -'DeliveryPipeline', -'DeliveryPipelineNotificationEvent', -'DeployJob', -'DeployJobRun', -'DeployJobRunMetadata', -'DeploymentJobs', -'ExecutionConfig', -'GetConfigRequest', -'GetDeliveryPipelineRequest', -'GetJobRunRequest', -'GetReleaseRequest', -'GetRolloutRequest', -'GetTargetRequest', -'GkeCluster', -'Job', -'JobRun', -'JobRunNotificationEvent', -'ListDeliveryPipelinesRequest', -'ListDeliveryPipelinesResponse', -'ListJobRunsRequest', -'ListJobRunsResponse', -'ListReleasesRequest', -'ListReleasesResponse', -'ListRolloutsRequest', -'ListRolloutsResponse', -'ListTargetsRequest', -'ListTargetsResponse', -'Metadata', -'OperationMetadata', -'Phase', -'PipelineCondition', -'PipelineReadyCondition', -'PrivatePool', -'Release', -'ReleaseNotificationEvent', -'ReleaseRenderEvent', -'RetryJobRequest', -'RetryJobResponse', -'Rollout', -'RolloutNotificationEvent', -'SerialPipeline', -'SkaffoldVersion', -'Stage', -'Standard', -'Strategy', -'Target', -'TargetArtifact', -'TargetNotificationEvent', -'TargetsPresentCondition', -'Type', -'UpdateDeliveryPipelineRequest', -'UpdateTargetRequest', -'VerifyJob', -'VerifyJobRun', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json deleted file mode 100644 index 92f86fe..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/gapic_metadata.json +++ /dev/null @@ -1,243 +0,0 @@ - { - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "python", - "libraryPackage": "google.cloud.deploy_v1", - "protoPackage": "google.cloud.deploy.v1", - "schema": "1.0", - "services": { - "CloudDeploy": { - "clients": { - "grpc": { - "libraryClient": "CloudDeployClient", - "rpcs": { - "AbandonRelease": { - "methods": [ - "abandon_release" - ] - }, - "ApproveRollout": { - "methods": [ - "approve_rollout" - ] - }, - "CreateDeliveryPipeline": { - "methods": [ - "create_delivery_pipeline" - ] - }, - "CreateRelease": { - "methods": [ - "create_release" - ] - }, - "CreateRollout": { - "methods": [ - "create_rollout" - ] - }, - "CreateTarget": { - "methods": [ - "create_target" - ] - }, - "DeleteDeliveryPipeline": { - "methods": [ - "delete_delivery_pipeline" - ] - }, - "DeleteTarget": { - "methods": [ - "delete_target" - ] - }, - "GetConfig": { - "methods": [ - "get_config" - ] - }, - "GetDeliveryPipeline": { - "methods": [ - "get_delivery_pipeline" - ] - }, - "GetJobRun": { - "methods": [ - "get_job_run" - ] - }, - "GetRelease": { - "methods": [ - "get_release" - ] - }, - "GetRollout": { - "methods": [ - "get_rollout" - ] - }, - "GetTarget": { - "methods": [ - "get_target" - ] - }, - "ListDeliveryPipelines": { - "methods": [ - "list_delivery_pipelines" - ] - }, - "ListJobRuns": { - "methods": [ - "list_job_runs" - ] - }, - "ListReleases": { - "methods": [ - "list_releases" - ] - }, - "ListRollouts": { - "methods": [ - "list_rollouts" - ] - }, - "ListTargets": { - "methods": [ - "list_targets" - ] - }, - "RetryJob": { - "methods": [ - "retry_job" - ] - }, - "UpdateDeliveryPipeline": { - "methods": [ - "update_delivery_pipeline" - ] - }, - "UpdateTarget": { - "methods": [ - "update_target" - ] - } - } - }, - "grpc-async": { - "libraryClient": "CloudDeployAsyncClient", - "rpcs": { - "AbandonRelease": { - "methods": [ - "abandon_release" - ] - }, - "ApproveRollout": { - "methods": [ - "approve_rollout" - ] - }, - "CreateDeliveryPipeline": { - "methods": [ - "create_delivery_pipeline" - ] - }, - "CreateRelease": { - "methods": [ - "create_release" - ] - }, - "CreateRollout": { - "methods": [ - "create_rollout" - ] - }, - "CreateTarget": { - "methods": [ - "create_target" - ] - }, - "DeleteDeliveryPipeline": { - "methods": [ - "delete_delivery_pipeline" - ] - }, - "DeleteTarget": { - "methods": [ - "delete_target" - ] - }, - "GetConfig": { - "methods": [ - "get_config" - ] - }, - "GetDeliveryPipeline": { - "methods": [ - "get_delivery_pipeline" - ] - }, - "GetJobRun": { - "methods": [ - "get_job_run" - ] - }, - "GetRelease": { - "methods": [ - "get_release" - ] - }, - "GetRollout": { - "methods": [ - "get_rollout" - ] - }, - "GetTarget": { - "methods": [ - "get_target" - ] - }, - "ListDeliveryPipelines": { - "methods": [ - "list_delivery_pipelines" - ] - }, - "ListJobRuns": { - "methods": [ - "list_job_runs" - ] - }, - "ListReleases": { - "methods": [ - "list_releases" - ] - }, - "ListRollouts": { - "methods": [ - "list_rollouts" - ] - }, - "ListTargets": { - "methods": [ - "list_targets" - ] - }, - "RetryJob": { - "methods": [ - "retry_job" - ] - }, - "UpdateDeliveryPipeline": { - "methods": [ - "update_delivery_pipeline" - ] - }, - "UpdateTarget": { - "methods": [ - "update_target" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/py.typed b/owl-bot-staging/v1/google/cloud/deploy_v1/py.typed deleted file mode 100644 index 56a532f..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-deploy package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py deleted file mode 100644 index e8e1c38..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py deleted file mode 100644 index f9ab42c..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .client import CloudDeployClient -from .async_client import CloudDeployAsyncClient - -__all__ = ( - 'CloudDeployClient', - 'CloudDeployAsyncClient', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py deleted file mode 100644 index 1a1e8f4..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/async_client.py +++ /dev/null @@ -1,3471 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import functools -import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources - -from google.api_core.client_options import ClientOptions -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.deploy_v1.services.cloud_deploy import pagers -from google.cloud.deploy_v1.types import cloud_deploy -from google.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import CloudDeployTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import CloudDeployGrpcAsyncIOTransport -from .client import CloudDeployClient - - -class CloudDeployAsyncClient: - """CloudDeploy service creates and manages Continuous Delivery - operations on Google Cloud Platform via Skaffold - (https://skaffold.dev). - """ - - _client: CloudDeployClient - - DEFAULT_ENDPOINT = CloudDeployClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = CloudDeployClient.DEFAULT_MTLS_ENDPOINT - - build_path = staticmethod(CloudDeployClient.build_path) - parse_build_path = staticmethod(CloudDeployClient.parse_build_path) - cluster_path = staticmethod(CloudDeployClient.cluster_path) - parse_cluster_path = staticmethod(CloudDeployClient.parse_cluster_path) - config_path = staticmethod(CloudDeployClient.config_path) - parse_config_path = staticmethod(CloudDeployClient.parse_config_path) - delivery_pipeline_path = staticmethod(CloudDeployClient.delivery_pipeline_path) - parse_delivery_pipeline_path = staticmethod(CloudDeployClient.parse_delivery_pipeline_path) - job_run_path = staticmethod(CloudDeployClient.job_run_path) - parse_job_run_path = staticmethod(CloudDeployClient.parse_job_run_path) - membership_path = staticmethod(CloudDeployClient.membership_path) - parse_membership_path = staticmethod(CloudDeployClient.parse_membership_path) - release_path = staticmethod(CloudDeployClient.release_path) - parse_release_path = staticmethod(CloudDeployClient.parse_release_path) - rollout_path = staticmethod(CloudDeployClient.rollout_path) - parse_rollout_path = staticmethod(CloudDeployClient.parse_rollout_path) - target_path = staticmethod(CloudDeployClient.target_path) - parse_target_path = staticmethod(CloudDeployClient.parse_target_path) - worker_pool_path = staticmethod(CloudDeployClient.worker_pool_path) - parse_worker_pool_path = staticmethod(CloudDeployClient.parse_worker_pool_path) - common_billing_account_path = staticmethod(CloudDeployClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(CloudDeployClient.parse_common_billing_account_path) - common_folder_path = staticmethod(CloudDeployClient.common_folder_path) - parse_common_folder_path = staticmethod(CloudDeployClient.parse_common_folder_path) - common_organization_path = staticmethod(CloudDeployClient.common_organization_path) - parse_common_organization_path = staticmethod(CloudDeployClient.parse_common_organization_path) - common_project_path = staticmethod(CloudDeployClient.common_project_path) - parse_common_project_path = staticmethod(CloudDeployClient.parse_common_project_path) - common_location_path = staticmethod(CloudDeployClient.common_location_path) - parse_common_location_path = staticmethod(CloudDeployClient.parse_common_location_path) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudDeployAsyncClient: The constructed client. - """ - return CloudDeployClient.from_service_account_info.__func__(CloudDeployAsyncClient, info, *args, **kwargs) # type: ignore - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudDeployAsyncClient: The constructed client. - """ - return CloudDeployClient.from_service_account_file.__func__(CloudDeployAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return CloudDeployClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> CloudDeployTransport: - """Returns the transport used by the client instance. - - Returns: - CloudDeployTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial(type(CloudDeployClient).get_transport_class, type(CloudDeployClient)) - - def __init__(self, *, - credentials: ga_credentials.Credentials = None, - transport: Union[str, CloudDeployTransport] = "grpc_asyncio", - client_options: ClientOptions = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cloud deploy client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CloudDeployTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (ClientOptions): Custom options for the client. It - won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = CloudDeployClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - async def list_delivery_pipelines(self, - request: Union[cloud_deploy.ListDeliveryPipelinesRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDeliveryPipelinesAsyncPager: - r"""Lists DeliveryPipelines in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_list_delivery_pipelines(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListDeliveryPipelinesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_delivery_pipelines(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest, dict]): - The request object. The request object for - `ListDeliveryPipelines`. - parent (:class:`str`): - Required. The parent, which owns this collection of - pipelines. Format must be - projects/{project_id}/locations/{location_name}. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesAsyncPager: - The response object from ListDeliveryPipelines. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.ListDeliveryPipelinesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_delivery_pipelines, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListDeliveryPipelinesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_delivery_pipeline(self, - request: Union[cloud_deploy.GetDeliveryPipelineRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.DeliveryPipeline: - r"""Gets details of a single DeliveryPipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_get_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - response = await client.get_delivery_pipeline(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetDeliveryPipelineRequest, dict]): - The request object. The request object for - `GetDeliveryPipeline` - name (:class:`str`): - Required. Name of the ``DeliveryPipeline``. Format must - be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.DeliveryPipeline: - A DeliveryPipeline resource in the Google Cloud Deploy - API. - - A DeliveryPipeline defines a pipeline through which a - Skaffold configuration can progress. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.GetDeliveryPipelineRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_delivery_pipeline, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_delivery_pipeline(self, - request: Union[cloud_deploy.CreateDeliveryPipelineRequest, dict] = None, - *, - parent: str = None, - delivery_pipeline: cloud_deploy.DeliveryPipeline = None, - delivery_pipeline_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Creates a new DeliveryPipeline in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_create_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.CreateDeliveryPipelineRequest( - parent="parent_value", - delivery_pipeline_id="delivery_pipeline_id_value", - ) - - # Make the request - operation = client.create_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest, dict]): - The request object. The request object for - `CreateDeliveryPipeline`. - parent (:class:`str`): - Required. The parent collection in which the - ``DeliveryPipeline`` should be created. Format should be - projects/{project_id}/locations/{location_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - delivery_pipeline (:class:`google.cloud.deploy_v1.types.DeliveryPipeline`): - Required. The ``DeliveryPipeline`` to create. - This corresponds to the ``delivery_pipeline`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - delivery_pipeline_id (:class:`str`): - Required. ID of the ``DeliveryPipeline``. - This corresponds to the ``delivery_pipeline_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A - DeliveryPipeline resource in the Google Cloud Deploy - API. - - A DeliveryPipeline defines a pipeline through which a - Skaffold configuration can progress. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, delivery_pipeline, delivery_pipeline_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.CreateDeliveryPipelineRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if delivery_pipeline is not None: - request.delivery_pipeline = delivery_pipeline - if delivery_pipeline_id is not None: - request.delivery_pipeline_id = delivery_pipeline_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_delivery_pipeline, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - cloud_deploy.DeliveryPipeline, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_delivery_pipeline(self, - request: Union[cloud_deploy.UpdateDeliveryPipelineRequest, dict] = None, - *, - delivery_pipeline: cloud_deploy.DeliveryPipeline = None, - update_mask: field_mask_pb2.FieldMask = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the parameters of a single DeliveryPipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_update_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateDeliveryPipelineRequest( - ) - - # Make the request - operation = client.update_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest, dict]): - The request object. The request object for - `UpdateDeliveryPipeline`. - delivery_pipeline (:class:`google.cloud.deploy_v1.types.DeliveryPipeline`): - Required. The ``DeliveryPipeline`` to update. - This corresponds to the ``delivery_pipeline`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. Field mask is used to specify the fields to be - overwritten in the ``DeliveryPipeline`` resource by the - update. The fields specified in the update_mask are - relative to the resource, not the full request. A field - will be overwritten if it is in the mask. If the user - does not provide a mask then all fields will be - overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A - DeliveryPipeline resource in the Google Cloud Deploy - API. - - A DeliveryPipeline defines a pipeline through which a - Skaffold configuration can progress. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([delivery_pipeline, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.UpdateDeliveryPipelineRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if delivery_pipeline is not None: - request.delivery_pipeline = delivery_pipeline - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_delivery_pipeline, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("delivery_pipeline.name", request.delivery_pipeline.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - cloud_deploy.DeliveryPipeline, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_delivery_pipeline(self, - request: Union[cloud_deploy.DeleteDeliveryPipelineRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Deletes a single DeliveryPipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_delete_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest, dict]): - The request object. The request object for - `DeleteDeliveryPipeline`. - name (:class:`str`): - Required. The name of the ``DeliveryPipeline`` to - delete. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.DeleteDeliveryPipelineRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_delivery_pipeline, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def list_targets(self, - request: Union[cloud_deploy.ListTargetsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListTargetsAsyncPager: - r"""Lists Targets in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_list_targets(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListTargetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_targets(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListTargetsRequest, dict]): - The request object. The request object for - `ListTargets`. - parent (:class:`str`): - Required. The parent, which owns this collection of - targets. Format must be - projects/{project_id}/locations/{location_name}. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsAsyncPager: - The response object from ListTargets. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.ListTargetsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_targets, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListTargetsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_target(self, - request: Union[cloud_deploy.GetTargetRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Target: - r"""Gets details of a single Target. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_get_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetTargetRequest( - name="name_value", - ) - - # Make the request - response = await client.get_target(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetTargetRequest, dict]): - The request object. The request object for `GetTarget`. - name (:class:`str`): - Required. Name of the ``Target``. Format must be - projects/{project_id}/locations/{location_name}/targets/{target_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Target: - A Target resource in the Google Cloud Deploy API. - - A Target defines a location to which a Skaffold - configuration can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.GetTargetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_target, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_target(self, - request: Union[cloud_deploy.CreateTargetRequest, dict] = None, - *, - parent: str = None, - target: cloud_deploy.Target = None, - target_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Creates a new Target in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_create_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.CreateTargetRequest( - parent="parent_value", - target_id="target_id_value", - ) - - # Make the request - operation = client.create_target(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateTargetRequest, dict]): - The request object. The request object for - `CreateTarget`. - parent (:class:`str`): - Required. The parent collection in which the ``Target`` - should be created. Format should be - projects/{project_id}/locations/{location_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - target (:class:`google.cloud.deploy_v1.types.Target`): - Required. The ``Target`` to create. - This corresponds to the ``target`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - target_id (:class:`str`): - Required. ID of the ``Target``. - This corresponds to the ``target_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Target` A Target - resource in the Google Cloud Deploy API. - - A Target defines a location to which a Skaffold - configuration can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, target, target_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.CreateTargetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if target is not None: - request.target = target - if target_id is not None: - request.target_id = target_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_target, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - cloud_deploy.Target, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_target(self, - request: Union[cloud_deploy.UpdateTargetRequest, dict] = None, - *, - target: cloud_deploy.Target = None, - update_mask: field_mask_pb2.FieldMask = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the parameters of a single Target. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_update_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateTargetRequest( - ) - - # Make the request - operation = client.update_target(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.UpdateTargetRequest, dict]): - The request object. The request object for - `UpdateTarget`. - target (:class:`google.cloud.deploy_v1.types.Target`): - Required. The ``Target`` to update. - This corresponds to the ``target`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. Field mask is used to specify the fields to be - overwritten in the Target resource by the update. The - fields specified in the update_mask are relative to the - resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Target` A Target - resource in the Google Cloud Deploy API. - - A Target defines a location to which a Skaffold - configuration can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([target, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.UpdateTargetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if target is not None: - request.target = target - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_target, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("target.name", request.target.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - cloud_deploy.Target, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_target(self, - request: Union[cloud_deploy.DeleteTargetRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Deletes a single Target. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_delete_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteTargetRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_target(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.DeleteTargetRequest, dict]): - The request object. The request object for - `DeleteTarget`. - name (:class:`str`): - Required. The name of the ``Target`` to delete. Format - should be - projects/{project_id}/locations/{location_name}/targets/{target_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.DeleteTargetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_target, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def list_releases(self, - request: Union[cloud_deploy.ListReleasesRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListReleasesAsyncPager: - r"""Lists Releases in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_list_releases(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListReleasesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_releases(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListReleasesRequest, dict]): - The request object. The request object for - `ListReleases`. - parent (:class:`str`): - Required. The ``DeliveryPipeline`` which owns this - collection of ``Release`` objects. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesAsyncPager: - The response object from ListReleases. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.ListReleasesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_releases, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListReleasesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_release(self, - request: Union[cloud_deploy.GetReleaseRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Release: - r"""Gets details of a single Release. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_get_release(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetReleaseRequest( - name="name_value", - ) - - # Make the request - response = await client.get_release(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetReleaseRequest, dict]): - The request object. The request object for `GetRelease`. - name (:class:`str`): - Required. Name of the ``Release``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Release: - A Release resource in the Google Cloud Deploy API. - - A Release defines a specific Skaffold configuration - instance that can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.GetReleaseRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_release, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_release(self, - request: Union[cloud_deploy.CreateReleaseRequest, dict] = None, - *, - parent: str = None, - release: cloud_deploy.Release = None, - release_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Creates a new Release in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_create_release(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.CreateReleaseRequest( - parent="parent_value", - release_id="release_id_value", - ) - - # Make the request - operation = client.create_release(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateReleaseRequest, dict]): - The request object. The request object for - `CreateRelease`, - parent (:class:`str`): - Required. The parent collection in which the ``Release`` - should be created. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - release (:class:`google.cloud.deploy_v1.types.Release`): - Required. The ``Release`` to create. - This corresponds to the ``release`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - release_id (:class:`str`): - Required. ID of the ``Release``. - This corresponds to the ``release_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Release` A Release - resource in the Google Cloud Deploy API. - - A Release defines a specific Skaffold configuration - instance that can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, release, release_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.CreateReleaseRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if release is not None: - request.release = release - if release_id is not None: - request.release_id = release_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_release, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - cloud_deploy.Release, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def abandon_release(self, - request: Union[cloud_deploy.AbandonReleaseRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.AbandonReleaseResponse: - r"""Abandons a Release in the Delivery Pipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_abandon_release(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.AbandonReleaseRequest( - name="name_value", - ) - - # Make the request - response = await client.abandon_release(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.AbandonReleaseRequest, dict]): - The request object. The request object used by - `AbandonRelease`. - name (:class:`str`): - Required. Name of the Release. Format - is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.AbandonReleaseResponse: - The response object for AbandonRelease. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.AbandonReleaseRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.abandon_release, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def approve_rollout(self, - request: Union[cloud_deploy.ApproveRolloutRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.ApproveRolloutResponse: - r"""Approves a Rollout. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_approve_rollout(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ApproveRolloutRequest( - name="name_value", - approved=True, - ) - - # Make the request - response = await client.approve_rollout(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ApproveRolloutRequest, dict]): - The request object. The request object used by - `ApproveRollout`. - name (:class:`str`): - Required. Name of the Rollout. Format - is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}/rollouts/{rollout}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.ApproveRolloutResponse: - The response object from ApproveRollout. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.ApproveRolloutRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.approve_rollout, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_rollouts(self, - request: Union[cloud_deploy.ListRolloutsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListRolloutsAsyncPager: - r"""Lists Rollouts in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_list_rollouts(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListRolloutsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_rollouts(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListRolloutsRequest, dict]): - The request object. ListRolloutsRequest is the request - object used by `ListRollouts`. - parent (:class:`str`): - Required. The ``Release`` which owns this collection of - ``Rollout`` objects. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsAsyncPager: - ListRolloutsResponse is the response object reutrned by - ListRollouts. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.ListRolloutsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_rollouts, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListRolloutsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_rollout(self, - request: Union[cloud_deploy.GetRolloutRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Rollout: - r"""Gets details of a single Rollout. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_get_rollout(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetRolloutRequest( - name="name_value", - ) - - # Make the request - response = await client.get_rollout(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetRolloutRequest, dict]): - The request object. GetRolloutRequest is the request - object used by `GetRollout`. - name (:class:`str`): - Required. Name of the ``Rollout``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Rollout: - A Rollout resource in the Google Cloud Deploy API. - - A Rollout contains information around a specific - deployment to a Target. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.GetRolloutRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_rollout, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_rollout(self, - request: Union[cloud_deploy.CreateRolloutRequest, dict] = None, - *, - parent: str = None, - rollout: cloud_deploy.Rollout = None, - rollout_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Creates a new Rollout in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_create_rollout(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - rollout = deploy_v1.Rollout() - rollout.target_id = "target_id_value" - - request = deploy_v1.CreateRolloutRequest( - parent="parent_value", - rollout_id="rollout_id_value", - rollout=rollout, - ) - - # Make the request - operation = client.create_rollout(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateRolloutRequest, dict]): - The request object. CreateRolloutRequest is the request - object used by `CreateRollout`. - parent (:class:`str`): - Required. The parent collection in which the ``Rollout`` - should be created. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - rollout (:class:`google.cloud.deploy_v1.types.Rollout`): - Required. The ``Rollout`` to create. - This corresponds to the ``rollout`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - rollout_id (:class:`str`): - Required. ID of the ``Rollout``. - This corresponds to the ``rollout_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Rollout` A Rollout - resource in the Google Cloud Deploy API. - - A Rollout contains information around a specific - deployment to a Target. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, rollout, rollout_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.CreateRolloutRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if rollout is not None: - request.rollout = rollout - if rollout_id is not None: - request.rollout_id = rollout_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_rollout, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - cloud_deploy.Rollout, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - async def retry_job(self, - request: Union[cloud_deploy.RetryJobRequest, dict] = None, - *, - rollout: str = None, - phase_id: str = None, - job_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.RetryJobResponse: - r"""Retries the specified Job in a Rollout. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_retry_job(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.RetryJobRequest( - rollout="rollout_value", - phase_id="phase_id_value", - job_id="job_id_value", - ) - - # Make the request - response = await client.retry_job(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.RetryJobRequest, dict]): - The request object. RetryJobRequest is the request - object used by `RetryJob`. - rollout (:class:`str`): - Required. Name of the Rollout. Format - is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}/rollouts/{rollout}. - - This corresponds to the ``rollout`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - phase_id (:class:`str`): - Required. The phase ID the Job to - retry belongs to. - - This corresponds to the ``phase_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - job_id (:class:`str`): - Required. The job ID for the Job to - retry. - - This corresponds to the ``job_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.RetryJobResponse: - The response object from 'RetryJob'. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([rollout, phase_id, job_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.RetryJobRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if rollout is not None: - request.rollout = rollout - if phase_id is not None: - request.phase_id = phase_id - if job_id is not None: - request.job_id = job_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.retry_job, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("rollout", request.rollout), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_job_runs(self, - request: Union[cloud_deploy.ListJobRunsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListJobRunsAsyncPager: - r"""Lists JobRuns in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_list_job_runs(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListJobRunsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_job_runs(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListJobRunsRequest, dict]): - The request object. ListJobRunsRequest is the request - object used by `ListJobRuns`. - parent (:class:`str`): - Required. The ``Rollout`` which owns this collection of - ``JobRun`` objects. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsAsyncPager: - ListJobRunsResponse is the response object returned by - ListJobRuns. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.ListJobRunsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_job_runs, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListJobRunsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_job_run(self, - request: Union[cloud_deploy.GetJobRunRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.JobRun: - r"""Gets details of a single JobRun. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_get_job_run(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetJobRunRequest( - name="name_value", - ) - - # Make the request - response = await client.get_job_run(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetJobRunRequest, dict]): - The request object. GetJobRunRequest is the request - object used by `GetJobRun`. - name (:class:`str`): - Required. Name of the ``JobRun``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.JobRun: - A JobRun resource in the Google Cloud Deploy API. - - A JobRun contains information of a single Rollout job - evaluation. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.GetJobRunRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_job_run, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_config(self, - request: Union[cloud_deploy.GetConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Config: - r"""Gets the configuration for a location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - async def sample_get_config(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetConfigRequest, dict]): - The request object. Request to get a configuration. - name (:class:`str`): - Required. Name of requested - configuration. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Config: - Service-wide configuration. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = cloud_deploy.GetConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_config, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_operations( - self, - request: operations_pb2.ListOperationsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.ListOperationsResponse: - r"""Lists operations that match the specified filter in the request. - - Args: - request (:class:`~.operations_pb2.ListOperationsRequest`): - The request object. Request message for - `ListOperations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.ListOperationsResponse: - Response message for ``ListOperations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.ListOperationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.list_operations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def get_operation( - self, - request: operations_pb2.GetOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Gets the latest state of a long-running operation. - - Args: - request (:class:`~.operations_pb2.GetOperationRequest`): - The request object. Request message for - `GetOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.Operation: - An ``Operation`` object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.GetOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.get_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def delete_operation( - self, - request: operations_pb2.DeleteOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a long-running operation. - - This method indicates that the client is no longer interested - in the operation result. It does not cancel the operation. - If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.DeleteOperationRequest`): - The request object. Request message for - `DeleteOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.DeleteOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.delete_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - async def cancel_operation( - self, - request: operations_pb2.CancelOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Starts asynchronous cancellation on a long-running operation. - - The server makes a best effort to cancel the operation, but success - is not guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.CancelOperationRequest`): - The request object. Request message for - `CancelOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.CancelOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.cancel_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - async def set_iam_policy( - self, - request: iam_policy_pb2.SetIamPolicyRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> policy_pb2.Policy: - r"""Sets the IAM access control policy on the specified function. - - Replaces any existing policy. - - Args: - request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`): - The request object. Request message for `SetIamPolicy` - method. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. - It is used to specify access control policies for Cloud - Platform resources. - A ``Policy`` is a collection of ``bindings``. A - ``binding`` binds one or more ``members`` to a single - ``role``. Members can be user accounts, service - accounts, Google groups, and domains (such as G Suite). - A ``role`` is a named list of permissions (defined by - IAM or configured by users). A ``binding`` can - optionally specify a ``condition``, which is a logic - expression that further constrains the role binding - based on attributes about the request and/or target - resource. - - **JSON Example** - - :: - - { - "bindings": [ - { - "role": "roles/resourcemanager.organizationAdmin", - "members": [ - "user:mike@example.com", - "group:admins@example.com", - "domain:google.com", - "serviceAccount:my-project-id@appspot.gserviceaccount.com" - ] - }, - { - "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], - "condition": { - "title": "expirable access", - "description": "Does not grant access after Sep 2020", - "expression": "request.time < - timestamp('2020-10-01T00:00:00.000Z')", - } - } - ] - } - - **YAML Example** - - :: - - bindings: - - members: - - user:mike@example.com - - group:admins@example.com - - domain:google.com - - serviceAccount:my-project-id@appspot.gserviceaccount.com - role: roles/resourcemanager.organizationAdmin - - members: - - user:eve@example.com - role: roles/resourcemanager.organizationViewer - condition: - title: expirable access - description: Does not grant access after Sep 2020 - expression: request.time < timestamp('2020-10-01T00:00:00.000Z') - - For a description of IAM and its features, see the `IAM - developer's - guide `__. - """ - # Create or coerce a protobuf request object. - - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.set_iam_policy, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource", request.resource),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def get_iam_policy( - self, - request: iam_policy_pb2.GetIamPolicyRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> policy_pb2.Policy: - r"""Gets the IAM access control policy for a function. - - Returns an empty policy if the function exists and does not have a - policy set. - - Args: - request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`): - The request object. Request message for `GetIamPolicy` - method. - retry (google.api_core.retry.Retry): Designation of what errors, if - any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. - It is used to specify access control policies for Cloud - Platform resources. - A ``Policy`` is a collection of ``bindings``. A - ``binding`` binds one or more ``members`` to a single - ``role``. Members can be user accounts, service - accounts, Google groups, and domains (such as G Suite). - A ``role`` is a named list of permissions (defined by - IAM or configured by users). A ``binding`` can - optionally specify a ``condition``, which is a logic - expression that further constrains the role binding - based on attributes about the request and/or target - resource. - - **JSON Example** - - :: - - { - "bindings": [ - { - "role": "roles/resourcemanager.organizationAdmin", - "members": [ - "user:mike@example.com", - "group:admins@example.com", - "domain:google.com", - "serviceAccount:my-project-id@appspot.gserviceaccount.com" - ] - }, - { - "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], - "condition": { - "title": "expirable access", - "description": "Does not grant access after Sep 2020", - "expression": "request.time < - timestamp('2020-10-01T00:00:00.000Z')", - } - } - ] - } - - **YAML Example** - - :: - - bindings: - - members: - - user:mike@example.com - - group:admins@example.com - - domain:google.com - - serviceAccount:my-project-id@appspot.gserviceaccount.com - role: roles/resourcemanager.organizationAdmin - - members: - - user:eve@example.com - role: roles/resourcemanager.organizationViewer - condition: - title: expirable access - description: Does not grant access after Sep 2020 - expression: request.time < timestamp('2020-10-01T00:00:00.000Z') - - For a description of IAM and its features, see the `IAM - developer's - guide `__. - """ - # Create or coerce a protobuf request object. - - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.get_iam_policy, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource", request.resource),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def test_iam_permissions( - self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> iam_policy_pb2.TestIamPermissionsResponse: - r"""Tests the specified IAM permissions against the IAM access control - policy for a function. - - If the function does not exist, this will return an empty set - of permissions, not a NOT_FOUND error. - - Args: - request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`): - The request object. Request message for - `TestIamPermissions` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.iam_policy_pb2.TestIamPermissionsResponse: - Response message for ``TestIamPermissions`` method. - """ - # Create or coerce a protobuf request object. - - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.test_iam_permissions, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource", request.resource),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def get_location( - self, - request: locations_pb2.GetLocationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.Location: - r"""Gets information about a location. - - Args: - request (:class:`~.location_pb2.GetLocationRequest`): - The request object. Request message for - `GetLocation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.Location: - Location object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.GetLocationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.get_location, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def list_locations( - self, - request: locations_pb2.ListLocationsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.ListLocationsResponse: - r"""Lists information about the supported locations for this service. - - Args: - request (:class:`~.location_pb2.ListLocationsRequest`): - The request object. Request message for - `ListLocations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.ListLocationsResponse: - Response message for ``ListLocations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.ListLocationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.list_locations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-deploy", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -__all__ = ( - "CloudDeployAsyncClient", -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py deleted file mode 100644 index 90eb766..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/client.py +++ /dev/null @@ -1,3681 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import os -import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.deploy_v1.services.cloud_deploy import pagers -from google.cloud.deploy_v1.types import cloud_deploy -from google.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import CloudDeployTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CloudDeployGrpcTransport -from .transports.grpc_asyncio import CloudDeployGrpcAsyncIOTransport - - -class CloudDeployClientMeta(type): - """Metaclass for the CloudDeploy client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - _transport_registry = OrderedDict() # type: Dict[str, Type[CloudDeployTransport]] - _transport_registry["grpc"] = CloudDeployGrpcTransport - _transport_registry["grpc_asyncio"] = CloudDeployGrpcAsyncIOTransport - - def get_transport_class(cls, - label: str = None, - ) -> Type[CloudDeployTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CloudDeployClient(metaclass=CloudDeployClientMeta): - """CloudDeploy service creates and manages Continuous Delivery - operations on Google Cloud Platform via Skaffold - (https://skaffold.dev). - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "clouddeploy.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudDeployClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudDeployClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CloudDeployTransport: - """Returns the transport used by the client instance. - - Returns: - CloudDeployTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def build_path(project: str,location: str,build: str,) -> str: - """Returns a fully-qualified build string.""" - return "projects/{project}/locations/{location}/builds/{build}".format(project=project, location=location, build=build, ) - - @staticmethod - def parse_build_path(path: str) -> Dict[str,str]: - """Parses a build path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/builds/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def cluster_path(project: str,location: str,cluster: str,) -> str: - """Returns a fully-qualified cluster string.""" - return "projects/{project}/locations/{location}/clusters/{cluster}".format(project=project, location=location, cluster=cluster, ) - - @staticmethod - def parse_cluster_path(path: str) -> Dict[str,str]: - """Parses a cluster path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/clusters/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def config_path(project: str,location: str,) -> str: - """Returns a fully-qualified config string.""" - return "projects/{project}/locations/{location}/config".format(project=project, location=location, ) - - @staticmethod - def parse_config_path(path: str) -> Dict[str,str]: - """Parses a config path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/config$", path) - return m.groupdict() if m else {} - - @staticmethod - def delivery_pipeline_path(project: str,location: str,delivery_pipeline: str,) -> str: - """Returns a fully-qualified delivery_pipeline string.""" - return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, ) - - @staticmethod - def parse_delivery_pipeline_path(path: str) -> Dict[str,str]: - """Parses a delivery_pipeline path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def job_run_path(project: str,location: str,delivery_pipeline: str,release: str,rollout: str,job_run: str,) -> str: - """Returns a fully-qualified job_run string.""" - return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, job_run=job_run, ) - - @staticmethod - def parse_job_run_path(path: str) -> Dict[str,str]: - """Parses a job_run path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)/releases/(?P.+?)/rollouts/(?P.+?)/jobRuns/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def membership_path(project: str,location: str,membership: str,) -> str: - """Returns a fully-qualified membership string.""" - return "projects/{project}/locations/{location}/memberships/{membership}".format(project=project, location=location, membership=membership, ) - - @staticmethod - def parse_membership_path(path: str) -> Dict[str,str]: - """Parses a membership path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/memberships/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def release_path(project: str,location: str,delivery_pipeline: str,release: str,) -> str: - """Returns a fully-qualified release string.""" - return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, ) - - @staticmethod - def parse_release_path(path: str) -> Dict[str,str]: - """Parses a release path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)/releases/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def rollout_path(project: str,location: str,delivery_pipeline: str,release: str,rollout: str,) -> str: - """Returns a fully-qualified rollout string.""" - return "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, ) - - @staticmethod - def parse_rollout_path(path: str) -> Dict[str,str]: - """Parses a rollout path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/deliveryPipelines/(?P.+?)/releases/(?P.+?)/rollouts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def target_path(project: str,location: str,target: str,) -> str: - """Returns a fully-qualified target string.""" - return "projects/{project}/locations/{location}/targets/{target}".format(project=project, location=location, target=target, ) - - @staticmethod - def parse_target_path(path: str) -> Dict[str,str]: - """Parses a target path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/targets/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def worker_pool_path(project: str,location: str,worker_pool: str,) -> str: - """Returns a fully-qualified worker_pool string.""" - return "projects/{project}/locations/{location}/workerPools/{worker_pool}".format(project=project, location=location, worker_pool=worker_pool, ) - - @staticmethod - def parse_worker_pool_path(path: str) -> Dict[str,str]: - """Parses a worker_pool path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/workerPools/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str, ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str,str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str, ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder, ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str,str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str, ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization, ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str,str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str, ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project, ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str,str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str, ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format(project=project, location=location, ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str,str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CloudDeployTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cloud deploy client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, CloudDeployTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError("client_options.api_key and credentials are mutually exclusive") - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CloudDeployTransport): - # transport is a CloudDeployTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): - credentials = google.auth._default.get_api_key_credentials(api_key_value) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_delivery_pipelines(self, - request: Union[cloud_deploy.ListDeliveryPipelinesRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDeliveryPipelinesPager: - r"""Lists DeliveryPipelines in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_list_delivery_pipelines(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListDeliveryPipelinesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_delivery_pipelines(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest, dict]): - The request object. The request object for - `ListDeliveryPipelines`. - parent (str): - Required. The parent, which owns this collection of - pipelines. Format must be - projects/{project_id}/locations/{location_name}. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesPager: - The response object from ListDeliveryPipelines. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.ListDeliveryPipelinesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.ListDeliveryPipelinesRequest): - request = cloud_deploy.ListDeliveryPipelinesRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_delivery_pipelines] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListDeliveryPipelinesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_delivery_pipeline(self, - request: Union[cloud_deploy.GetDeliveryPipelineRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.DeliveryPipeline: - r"""Gets details of a single DeliveryPipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_get_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - response = client.get_delivery_pipeline(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetDeliveryPipelineRequest, dict]): - The request object. The request object for - `GetDeliveryPipeline` - name (str): - Required. Name of the ``DeliveryPipeline``. Format must - be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.DeliveryPipeline: - A DeliveryPipeline resource in the Google Cloud Deploy - API. - - A DeliveryPipeline defines a pipeline through which a - Skaffold configuration can progress. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.GetDeliveryPipelineRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.GetDeliveryPipelineRequest): - request = cloud_deploy.GetDeliveryPipelineRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_delivery_pipeline] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_delivery_pipeline(self, - request: Union[cloud_deploy.CreateDeliveryPipelineRequest, dict] = None, - *, - parent: str = None, - delivery_pipeline: cloud_deploy.DeliveryPipeline = None, - delivery_pipeline_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Creates a new DeliveryPipeline in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_create_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.CreateDeliveryPipelineRequest( - parent="parent_value", - delivery_pipeline_id="delivery_pipeline_id_value", - ) - - # Make the request - operation = client.create_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest, dict]): - The request object. The request object for - `CreateDeliveryPipeline`. - parent (str): - Required. The parent collection in which the - ``DeliveryPipeline`` should be created. Format should be - projects/{project_id}/locations/{location_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): - Required. The ``DeliveryPipeline`` to create. - This corresponds to the ``delivery_pipeline`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - delivery_pipeline_id (str): - Required. ID of the ``DeliveryPipeline``. - This corresponds to the ``delivery_pipeline_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A - DeliveryPipeline resource in the Google Cloud Deploy - API. - - A DeliveryPipeline defines a pipeline through which a - Skaffold configuration can progress. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, delivery_pipeline, delivery_pipeline_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.CreateDeliveryPipelineRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.CreateDeliveryPipelineRequest): - request = cloud_deploy.CreateDeliveryPipelineRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if delivery_pipeline is not None: - request.delivery_pipeline = delivery_pipeline - if delivery_pipeline_id is not None: - request.delivery_pipeline_id = delivery_pipeline_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_delivery_pipeline] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - cloud_deploy.DeliveryPipeline, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_delivery_pipeline(self, - request: Union[cloud_deploy.UpdateDeliveryPipelineRequest, dict] = None, - *, - delivery_pipeline: cloud_deploy.DeliveryPipeline = None, - update_mask: field_mask_pb2.FieldMask = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Updates the parameters of a single DeliveryPipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_update_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateDeliveryPipelineRequest( - ) - - # Make the request - operation = client.update_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest, dict]): - The request object. The request object for - `UpdateDeliveryPipeline`. - delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): - Required. The ``DeliveryPipeline`` to update. - This corresponds to the ``delivery_pipeline`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. Field mask is used to specify the fields to be - overwritten in the ``DeliveryPipeline`` resource by the - update. The fields specified in the update_mask are - relative to the resource, not the full request. A field - will be overwritten if it is in the mask. If the user - does not provide a mask then all fields will be - overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.DeliveryPipeline` A - DeliveryPipeline resource in the Google Cloud Deploy - API. - - A DeliveryPipeline defines a pipeline through which a - Skaffold configuration can progress. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([delivery_pipeline, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.UpdateDeliveryPipelineRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.UpdateDeliveryPipelineRequest): - request = cloud_deploy.UpdateDeliveryPipelineRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if delivery_pipeline is not None: - request.delivery_pipeline = delivery_pipeline - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_delivery_pipeline] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("delivery_pipeline.name", request.delivery_pipeline.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - cloud_deploy.DeliveryPipeline, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_delivery_pipeline(self, - request: Union[cloud_deploy.DeleteDeliveryPipelineRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Deletes a single DeliveryPipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_delete_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest, dict]): - The request object. The request object for - `DeleteDeliveryPipeline`. - name (str): - Required. The name of the ``DeliveryPipeline`` to - delete. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.DeleteDeliveryPipelineRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.DeleteDeliveryPipelineRequest): - request = cloud_deploy.DeleteDeliveryPipelineRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_delivery_pipeline] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def list_targets(self, - request: Union[cloud_deploy.ListTargetsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListTargetsPager: - r"""Lists Targets in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_list_targets(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListTargetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_targets(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListTargetsRequest, dict]): - The request object. The request object for - `ListTargets`. - parent (str): - Required. The parent, which owns this collection of - targets. Format must be - projects/{project_id}/locations/{location_name}. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsPager: - The response object from ListTargets. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.ListTargetsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.ListTargetsRequest): - request = cloud_deploy.ListTargetsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_targets] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListTargetsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_target(self, - request: Union[cloud_deploy.GetTargetRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Target: - r"""Gets details of a single Target. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_get_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetTargetRequest( - name="name_value", - ) - - # Make the request - response = client.get_target(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetTargetRequest, dict]): - The request object. The request object for `GetTarget`. - name (str): - Required. Name of the ``Target``. Format must be - projects/{project_id}/locations/{location_name}/targets/{target_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Target: - A Target resource in the Google Cloud Deploy API. - - A Target defines a location to which a Skaffold - configuration can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.GetTargetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.GetTargetRequest): - request = cloud_deploy.GetTargetRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_target] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_target(self, - request: Union[cloud_deploy.CreateTargetRequest, dict] = None, - *, - parent: str = None, - target: cloud_deploy.Target = None, - target_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Creates a new Target in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_create_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.CreateTargetRequest( - parent="parent_value", - target_id="target_id_value", - ) - - # Make the request - operation = client.create_target(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateTargetRequest, dict]): - The request object. The request object for - `CreateTarget`. - parent (str): - Required. The parent collection in which the ``Target`` - should be created. Format should be - projects/{project_id}/locations/{location_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - target (google.cloud.deploy_v1.types.Target): - Required. The ``Target`` to create. - This corresponds to the ``target`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - target_id (str): - Required. ID of the ``Target``. - This corresponds to the ``target_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Target` A Target - resource in the Google Cloud Deploy API. - - A Target defines a location to which a Skaffold - configuration can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, target, target_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.CreateTargetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.CreateTargetRequest): - request = cloud_deploy.CreateTargetRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if target is not None: - request.target = target - if target_id is not None: - request.target_id = target_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_target] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - cloud_deploy.Target, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_target(self, - request: Union[cloud_deploy.UpdateTargetRequest, dict] = None, - *, - target: cloud_deploy.Target = None, - update_mask: field_mask_pb2.FieldMask = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Updates the parameters of a single Target. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_update_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateTargetRequest( - ) - - # Make the request - operation = client.update_target(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.UpdateTargetRequest, dict]): - The request object. The request object for - `UpdateTarget`. - target (google.cloud.deploy_v1.types.Target): - Required. The ``Target`` to update. - This corresponds to the ``target`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. Field mask is used to specify the fields to be - overwritten in the Target resource by the update. The - fields specified in the update_mask are relative to the - resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Target` A Target - resource in the Google Cloud Deploy API. - - A Target defines a location to which a Skaffold - configuration can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([target, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.UpdateTargetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.UpdateTargetRequest): - request = cloud_deploy.UpdateTargetRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if target is not None: - request.target = target - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_target] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("target.name", request.target.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - cloud_deploy.Target, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_target(self, - request: Union[cloud_deploy.DeleteTargetRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Deletes a single Target. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_delete_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteTargetRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_target(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.DeleteTargetRequest, dict]): - The request object. The request object for - `DeleteTarget`. - name (str): - Required. The name of the ``Target`` to delete. Format - should be - projects/{project_id}/locations/{location_name}/targets/{target_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.DeleteTargetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.DeleteTargetRequest): - request = cloud_deploy.DeleteTargetRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_target] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def list_releases(self, - request: Union[cloud_deploy.ListReleasesRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListReleasesPager: - r"""Lists Releases in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_list_releases(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListReleasesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_releases(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListReleasesRequest, dict]): - The request object. The request object for - `ListReleases`. - parent (str): - Required. The ``DeliveryPipeline`` which owns this - collection of ``Release`` objects. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesPager: - The response object from ListReleases. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.ListReleasesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.ListReleasesRequest): - request = cloud_deploy.ListReleasesRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_releases] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListReleasesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_release(self, - request: Union[cloud_deploy.GetReleaseRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Release: - r"""Gets details of a single Release. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_get_release(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetReleaseRequest( - name="name_value", - ) - - # Make the request - response = client.get_release(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetReleaseRequest, dict]): - The request object. The request object for `GetRelease`. - name (str): - Required. Name of the ``Release``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Release: - A Release resource in the Google Cloud Deploy API. - - A Release defines a specific Skaffold configuration - instance that can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.GetReleaseRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.GetReleaseRequest): - request = cloud_deploy.GetReleaseRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_release] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_release(self, - request: Union[cloud_deploy.CreateReleaseRequest, dict] = None, - *, - parent: str = None, - release: cloud_deploy.Release = None, - release_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Creates a new Release in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_create_release(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.CreateReleaseRequest( - parent="parent_value", - release_id="release_id_value", - ) - - # Make the request - operation = client.create_release(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateReleaseRequest, dict]): - The request object. The request object for - `CreateRelease`, - parent (str): - Required. The parent collection in which the ``Release`` - should be created. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - release (google.cloud.deploy_v1.types.Release): - Required. The ``Release`` to create. - This corresponds to the ``release`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - release_id (str): - Required. ID of the ``Release``. - This corresponds to the ``release_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Release` A Release - resource in the Google Cloud Deploy API. - - A Release defines a specific Skaffold configuration - instance that can be deployed. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, release, release_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.CreateReleaseRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.CreateReleaseRequest): - request = cloud_deploy.CreateReleaseRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if release is not None: - request.release = release - if release_id is not None: - request.release_id = release_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_release] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - cloud_deploy.Release, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def abandon_release(self, - request: Union[cloud_deploy.AbandonReleaseRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.AbandonReleaseResponse: - r"""Abandons a Release in the Delivery Pipeline. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_abandon_release(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.AbandonReleaseRequest( - name="name_value", - ) - - # Make the request - response = client.abandon_release(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.AbandonReleaseRequest, dict]): - The request object. The request object used by - `AbandonRelease`. - name (str): - Required. Name of the Release. Format - is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.AbandonReleaseResponse: - The response object for AbandonRelease. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.AbandonReleaseRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.AbandonReleaseRequest): - request = cloud_deploy.AbandonReleaseRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.abandon_release] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def approve_rollout(self, - request: Union[cloud_deploy.ApproveRolloutRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.ApproveRolloutResponse: - r"""Approves a Rollout. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_approve_rollout(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ApproveRolloutRequest( - name="name_value", - approved=True, - ) - - # Make the request - response = client.approve_rollout(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ApproveRolloutRequest, dict]): - The request object. The request object used by - `ApproveRollout`. - name (str): - Required. Name of the Rollout. Format - is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}/rollouts/{rollout}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.ApproveRolloutResponse: - The response object from ApproveRollout. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.ApproveRolloutRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.ApproveRolloutRequest): - request = cloud_deploy.ApproveRolloutRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.approve_rollout] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_rollouts(self, - request: Union[cloud_deploy.ListRolloutsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListRolloutsPager: - r"""Lists Rollouts in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_list_rollouts(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListRolloutsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_rollouts(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListRolloutsRequest, dict]): - The request object. ListRolloutsRequest is the request - object used by `ListRollouts`. - parent (str): - Required. The ``Release`` which owns this collection of - ``Rollout`` objects. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsPager: - ListRolloutsResponse is the response object reutrned by - ListRollouts. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.ListRolloutsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.ListRolloutsRequest): - request = cloud_deploy.ListRolloutsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_rollouts] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListRolloutsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_rollout(self, - request: Union[cloud_deploy.GetRolloutRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Rollout: - r"""Gets details of a single Rollout. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_get_rollout(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetRolloutRequest( - name="name_value", - ) - - # Make the request - response = client.get_rollout(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetRolloutRequest, dict]): - The request object. GetRolloutRequest is the request - object used by `GetRollout`. - name (str): - Required. Name of the ``Rollout``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Rollout: - A Rollout resource in the Google Cloud Deploy API. - - A Rollout contains information around a specific - deployment to a Target. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.GetRolloutRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.GetRolloutRequest): - request = cloud_deploy.GetRolloutRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_rollout] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_rollout(self, - request: Union[cloud_deploy.CreateRolloutRequest, dict] = None, - *, - parent: str = None, - rollout: cloud_deploy.Rollout = None, - rollout_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Creates a new Rollout in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_create_rollout(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - rollout = deploy_v1.Rollout() - rollout.target_id = "target_id_value" - - request = deploy_v1.CreateRolloutRequest( - parent="parent_value", - rollout_id="rollout_id_value", - rollout=rollout, - ) - - # Make the request - operation = client.create_rollout(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.CreateRolloutRequest, dict]): - The request object. CreateRolloutRequest is the request - object used by `CreateRollout`. - parent (str): - Required. The parent collection in which the ``Rollout`` - should be created. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - rollout (google.cloud.deploy_v1.types.Rollout): - Required. The ``Rollout`` to create. - This corresponds to the ``rollout`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - rollout_id (str): - Required. ID of the ``Rollout``. - This corresponds to the ``rollout_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.deploy_v1.types.Rollout` A Rollout - resource in the Google Cloud Deploy API. - - A Rollout contains information around a specific - deployment to a Target. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, rollout, rollout_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.CreateRolloutRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.CreateRolloutRequest): - request = cloud_deploy.CreateRolloutRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if rollout is not None: - request.rollout = rollout - if rollout_id is not None: - request.rollout_id = rollout_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_rollout] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - cloud_deploy.Rollout, - metadata_type=cloud_deploy.OperationMetadata, - ) - - # Done; return the response. - return response - - def retry_job(self, - request: Union[cloud_deploy.RetryJobRequest, dict] = None, - *, - rollout: str = None, - phase_id: str = None, - job_id: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.RetryJobResponse: - r"""Retries the specified Job in a Rollout. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_retry_job(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.RetryJobRequest( - rollout="rollout_value", - phase_id="phase_id_value", - job_id="job_id_value", - ) - - # Make the request - response = client.retry_job(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.RetryJobRequest, dict]): - The request object. RetryJobRequest is the request - object used by `RetryJob`. - rollout (str): - Required. Name of the Rollout. Format - is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}/rollouts/{rollout}. - - This corresponds to the ``rollout`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - phase_id (str): - Required. The phase ID the Job to - retry belongs to. - - This corresponds to the ``phase_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - job_id (str): - Required. The job ID for the Job to - retry. - - This corresponds to the ``job_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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.RetryJobResponse: - The response object from 'RetryJob'. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([rollout, phase_id, job_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.RetryJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.RetryJobRequest): - request = cloud_deploy.RetryJobRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if rollout is not None: - request.rollout = rollout - if phase_id is not None: - request.phase_id = phase_id - if job_id is not None: - request.job_id = job_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.retry_job] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("rollout", request.rollout), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_job_runs(self, - request: Union[cloud_deploy.ListJobRunsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListJobRunsPager: - r"""Lists JobRuns in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_list_job_runs(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListJobRunsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_job_runs(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.ListJobRunsRequest, dict]): - The request object. ListJobRunsRequest is the request - object used by `ListJobRuns`. - parent (str): - Required. The ``Rollout`` which owns this collection of - ``JobRun`` objects. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsPager: - ListJobRunsResponse is the response object returned by - ListJobRuns. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.ListJobRunsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.ListJobRunsRequest): - request = cloud_deploy.ListJobRunsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_job_runs] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListJobRunsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_job_run(self, - request: Union[cloud_deploy.GetJobRunRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.JobRun: - r"""Gets details of a single JobRun. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_get_job_run(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetJobRunRequest( - name="name_value", - ) - - # Make the request - response = client.get_job_run(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetJobRunRequest, dict]): - The request object. GetJobRunRequest is the request - object used by `GetJobRun`. - name (str): - Required. Name of the ``JobRun``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.JobRun: - A JobRun resource in the Google Cloud Deploy API. - - A JobRun contains information of a single Rollout job - evaluation. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.GetJobRunRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.GetJobRunRequest): - request = cloud_deploy.GetJobRunRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_job_run] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_config(self, - request: Union[cloud_deploy.GetConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> cloud_deploy.Config: - r"""Gets the configuration for a location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import deploy_v1 - - def sample_get_config(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.deploy_v1.types.GetConfigRequest, dict]): - The request object. Request to get a configuration. - name (str): - Required. Name of requested - configuration. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.deploy_v1.types.Config: - Service-wide configuration. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a cloud_deploy.GetConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, cloud_deploy.GetConfigRequest): - request = cloud_deploy.GetConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def __enter__(self): - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - def list_operations( - self, - request: operations_pb2.ListOperationsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.ListOperationsResponse: - r"""Lists operations that match the specified filter in the request. - - Args: - request (:class:`~.operations_pb2.ListOperationsRequest`): - The request object. Request message for - `ListOperations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.ListOperationsResponse: - Response message for ``ListOperations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.ListOperationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.list_operations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def get_operation( - self, - request: operations_pb2.GetOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Gets the latest state of a long-running operation. - - Args: - request (:class:`~.operations_pb2.GetOperationRequest`): - The request object. Request message for - `GetOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.Operation: - An ``Operation`` object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.GetOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.get_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def delete_operation( - self, - request: operations_pb2.DeleteOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a long-running operation. - - This method indicates that the client is no longer interested - in the operation result. It does not cancel the operation. - If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.DeleteOperationRequest`): - The request object. Request message for - `DeleteOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.DeleteOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.delete_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - def cancel_operation( - self, - request: operations_pb2.CancelOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Starts asynchronous cancellation on a long-running operation. - - The server makes a best effort to cancel the operation, but success - is not guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.CancelOperationRequest`): - The request object. Request message for - `CancelOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.CancelOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.cancel_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - def set_iam_policy( - self, - request: iam_policy_pb2.SetIamPolicyRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> policy_pb2.Policy: - r"""Sets the IAM access control policy on the specified function. - - Replaces any existing policy. - - Args: - request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`): - The request object. Request message for `SetIamPolicy` - method. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. - It is used to specify access control policies for Cloud - Platform resources. - A ``Policy`` is a collection of ``bindings``. A - ``binding`` binds one or more ``members`` to a single - ``role``. Members can be user accounts, service - accounts, Google groups, and domains (such as G Suite). - A ``role`` is a named list of permissions (defined by - IAM or configured by users). A ``binding`` can - optionally specify a ``condition``, which is a logic - expression that further constrains the role binding - based on attributes about the request and/or target - resource. - - **JSON Example** - - :: - - { - "bindings": [ - { - "role": "roles/resourcemanager.organizationAdmin", - "members": [ - "user:mike@example.com", - "group:admins@example.com", - "domain:google.com", - "serviceAccount:my-project-id@appspot.gserviceaccount.com" - ] - }, - { - "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], - "condition": { - "title": "expirable access", - "description": "Does not grant access after Sep 2020", - "expression": "request.time < - timestamp('2020-10-01T00:00:00.000Z')", - } - } - ] - } - - **YAML Example** - - :: - - bindings: - - members: - - user:mike@example.com - - group:admins@example.com - - domain:google.com - - serviceAccount:my-project-id@appspot.gserviceaccount.com - role: roles/resourcemanager.organizationAdmin - - members: - - user:eve@example.com - role: roles/resourcemanager.organizationViewer - condition: - title: expirable access - description: Does not grant access after Sep 2020 - expression: request.time < timestamp('2020-10-01T00:00:00.000Z') - - For a description of IAM and its features, see the `IAM - developer's - guide `__. - """ - # Create or coerce a protobuf request object. - - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.SetIamPolicyRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.set_iam_policy, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource", request.resource),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def get_iam_policy( - self, - request: iam_policy_pb2.GetIamPolicyRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> policy_pb2.Policy: - r"""Gets the IAM access control policy for a function. - - Returns an empty policy if the function exists and does not have a - policy set. - - Args: - request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`): - The request object. Request message for `GetIamPolicy` - method. - retry (google.api_core.retry.Retry): Designation of what errors, if - any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. - It is used to specify access control policies for Cloud - Platform resources. - A ``Policy`` is a collection of ``bindings``. A - ``binding`` binds one or more ``members`` to a single - ``role``. Members can be user accounts, service - accounts, Google groups, and domains (such as G Suite). - A ``role`` is a named list of permissions (defined by - IAM or configured by users). A ``binding`` can - optionally specify a ``condition``, which is a logic - expression that further constrains the role binding - based on attributes about the request and/or target - resource. - - **JSON Example** - - :: - - { - "bindings": [ - { - "role": "roles/resourcemanager.organizationAdmin", - "members": [ - "user:mike@example.com", - "group:admins@example.com", - "domain:google.com", - "serviceAccount:my-project-id@appspot.gserviceaccount.com" - ] - }, - { - "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], - "condition": { - "title": "expirable access", - "description": "Does not grant access after Sep 2020", - "expression": "request.time < - timestamp('2020-10-01T00:00:00.000Z')", - } - } - ] - } - - **YAML Example** - - :: - - bindings: - - members: - - user:mike@example.com - - group:admins@example.com - - domain:google.com - - serviceAccount:my-project-id@appspot.gserviceaccount.com - role: roles/resourcemanager.organizationAdmin - - members: - - user:eve@example.com - role: roles/resourcemanager.organizationViewer - condition: - title: expirable access - description: Does not grant access after Sep 2020 - expression: request.time < timestamp('2020-10-01T00:00:00.000Z') - - For a description of IAM and its features, see the `IAM - developer's - guide `__. - """ - # Create or coerce a protobuf request object. - - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.GetIamPolicyRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.get_iam_policy, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource", request.resource),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def test_iam_permissions( - self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> iam_policy_pb2.TestIamPermissionsResponse: - r"""Tests the specified IAM permissions against the IAM access control - policy for a function. - - If the function does not exist, this will return an empty set - of permissions, not a NOT_FOUND error. - - Args: - request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`): - The request object. Request message for - `TestIamPermissions` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.iam_policy_pb2.TestIamPermissionsResponse: - Response message for ``TestIamPermissions`` method. - """ - # Create or coerce a protobuf request object. - - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = iam_policy_pb2.TestIamPermissionsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.test_iam_permissions, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource", request.resource),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def get_location( - self, - request: locations_pb2.GetLocationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.Location: - r"""Gets information about a location. - - Args: - request (:class:`~.location_pb2.GetLocationRequest`): - The request object. Request message for - `GetLocation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.Location: - Location object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.GetLocationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.get_location, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def list_locations( - self, - request: locations_pb2.ListLocationsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.ListLocationsResponse: - r"""Lists information about the supported locations for this service. - - Args: - request (:class:`~.location_pb2.ListLocationsRequest`): - The request object. Request message for - `ListLocations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.ListLocationsResponse: - Response message for ``ListLocations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.ListLocationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.list_locations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-deploy", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -__all__ = ( - "CloudDeployClient", -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py deleted file mode 100644 index 2fe8519..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/pagers.py +++ /dev/null @@ -1,623 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator - -from google.cloud.deploy_v1.types import cloud_deploy - - -class ListDeliveryPipelinesPager: - """A pager for iterating through ``list_delivery_pipelines`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``delivery_pipelines`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListDeliveryPipelines`` requests and continue to iterate - through the ``delivery_pipelines`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., cloud_deploy.ListDeliveryPipelinesResponse], - request: cloud_deploy.ListDeliveryPipelinesRequest, - response: cloud_deploy.ListDeliveryPipelinesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListDeliveryPipelinesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[cloud_deploy.ListDeliveryPipelinesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[cloud_deploy.DeliveryPipeline]: - for page in self.pages: - yield from page.delivery_pipelines - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListDeliveryPipelinesAsyncPager: - """A pager for iterating through ``list_delivery_pipelines`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``delivery_pipelines`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListDeliveryPipelines`` requests and continue to iterate - through the ``delivery_pipelines`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[cloud_deploy.ListDeliveryPipelinesResponse]], - request: cloud_deploy.ListDeliveryPipelinesRequest, - response: cloud_deploy.ListDeliveryPipelinesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListDeliveryPipelinesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListDeliveryPipelinesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[cloud_deploy.ListDeliveryPipelinesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[cloud_deploy.DeliveryPipeline]: - async def async_generator(): - async for page in self.pages: - for response in page.delivery_pipelines: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListTargetsPager: - """A pager for iterating through ``list_targets`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListTargetsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``targets`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListTargets`` requests and continue to iterate - through the ``targets`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListTargetsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., cloud_deploy.ListTargetsResponse], - request: cloud_deploy.ListTargetsRequest, - response: cloud_deploy.ListTargetsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListTargetsRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListTargetsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListTargetsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[cloud_deploy.ListTargetsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[cloud_deploy.Target]: - for page in self.pages: - yield from page.targets - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListTargetsAsyncPager: - """A pager for iterating through ``list_targets`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListTargetsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``targets`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListTargets`` requests and continue to iterate - through the ``targets`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListTargetsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[cloud_deploy.ListTargetsResponse]], - request: cloud_deploy.ListTargetsRequest, - response: cloud_deploy.ListTargetsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListTargetsRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListTargetsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListTargetsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[cloud_deploy.ListTargetsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[cloud_deploy.Target]: - async def async_generator(): - async for page in self.pages: - for response in page.targets: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListReleasesPager: - """A pager for iterating through ``list_releases`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListReleasesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``releases`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListReleases`` requests and continue to iterate - through the ``releases`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListReleasesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., cloud_deploy.ListReleasesResponse], - request: cloud_deploy.ListReleasesRequest, - response: cloud_deploy.ListReleasesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListReleasesRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListReleasesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListReleasesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[cloud_deploy.ListReleasesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[cloud_deploy.Release]: - for page in self.pages: - yield from page.releases - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListReleasesAsyncPager: - """A pager for iterating through ``list_releases`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListReleasesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``releases`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListReleases`` requests and continue to iterate - through the ``releases`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListReleasesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[cloud_deploy.ListReleasesResponse]], - request: cloud_deploy.ListReleasesRequest, - response: cloud_deploy.ListReleasesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListReleasesRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListReleasesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListReleasesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[cloud_deploy.ListReleasesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[cloud_deploy.Release]: - async def async_generator(): - async for page in self.pages: - for response in page.releases: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListRolloutsPager: - """A pager for iterating through ``list_rollouts`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``rollouts`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListRollouts`` requests and continue to iterate - through the ``rollouts`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., cloud_deploy.ListRolloutsResponse], - request: cloud_deploy.ListRolloutsRequest, - response: cloud_deploy.ListRolloutsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListRolloutsRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListRolloutsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListRolloutsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[cloud_deploy.ListRolloutsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[cloud_deploy.Rollout]: - for page in self.pages: - yield from page.rollouts - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListRolloutsAsyncPager: - """A pager for iterating through ``list_rollouts`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``rollouts`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListRollouts`` requests and continue to iterate - through the ``rollouts`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListRolloutsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[cloud_deploy.ListRolloutsResponse]], - request: cloud_deploy.ListRolloutsRequest, - response: cloud_deploy.ListRolloutsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListRolloutsRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListRolloutsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListRolloutsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[cloud_deploy.ListRolloutsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[cloud_deploy.Rollout]: - async def async_generator(): - async for page in self.pages: - for response in page.rollouts: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListJobRunsPager: - """A pager for iterating through ``list_job_runs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``job_runs`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListJobRuns`` requests and continue to iterate - through the ``job_runs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., cloud_deploy.ListJobRunsResponse], - request: cloud_deploy.ListJobRunsRequest, - response: cloud_deploy.ListJobRunsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListJobRunsRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListJobRunsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListJobRunsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[cloud_deploy.ListJobRunsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[cloud_deploy.JobRun]: - for page in self.pages: - yield from page.job_runs - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListJobRunsAsyncPager: - """A pager for iterating through ``list_job_runs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``job_runs`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListJobRuns`` requests and continue to iterate - through the ``job_runs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.deploy_v1.types.ListJobRunsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[cloud_deploy.ListJobRunsResponse]], - request: cloud_deploy.ListJobRunsRequest, - response: cloud_deploy.ListJobRunsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.deploy_v1.types.ListJobRunsRequest): - The initial request object. - response (google.cloud.deploy_v1.types.ListJobRunsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = cloud_deploy.ListJobRunsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[cloud_deploy.ListJobRunsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[cloud_deploy.JobRun]: - async def async_generator(): - async for page in self.pages: - for response in page.job_runs: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py deleted file mode 100644 index 0f4bac6..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import CloudDeployTransport -from .grpc import CloudDeployGrpcTransport -from .grpc_asyncio import CloudDeployGrpcAsyncIOTransport - - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[CloudDeployTransport]] -_transport_registry['grpc'] = CloudDeployGrpcTransport -_transport_registry['grpc_asyncio'] = CloudDeployGrpcAsyncIOTransport - -__all__ = ( - 'CloudDeployTransport', - 'CloudDeployGrpcTransport', - 'CloudDeployGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py deleted file mode 100644 index e0c3f9b..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/base.py +++ /dev/null @@ -1,607 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources - -import google.auth # type: ignore -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.deploy_v1.types import cloud_deploy -from google.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - 'google-cloud-deploy', - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CloudDeployTransport(abc.ABC): - """Abstract transport class for CloudDeploy.""" - - AUTH_SCOPES = ( - 'https://www.googleapis.com/auth/cloud-platform', - ) - - DEFAULT_HOST: str = 'clouddeploy.googleapis.com' - def __init__( - self, *, - 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, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A list of scopes. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, - **scopes_kwargs, - quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience(api_audience if api_audience else host) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ':' not in host: - host += ':443' - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_delivery_pipelines: gapic_v1.method.wrap_method( - self.list_delivery_pipelines, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.get_delivery_pipeline: gapic_v1.method.wrap_method( - self.get_delivery_pipeline, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.create_delivery_pipeline: gapic_v1.method.wrap_method( - self.create_delivery_pipeline, - default_timeout=60.0, - client_info=client_info, - ), - self.update_delivery_pipeline: gapic_v1.method.wrap_method( - self.update_delivery_pipeline, - default_timeout=60.0, - client_info=client_info, - ), - self.delete_delivery_pipeline: gapic_v1.method.wrap_method( - self.delete_delivery_pipeline, - default_timeout=60.0, - client_info=client_info, - ), - self.list_targets: gapic_v1.method.wrap_method( - self.list_targets, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.get_target: gapic_v1.method.wrap_method( - self.get_target, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.create_target: gapic_v1.method.wrap_method( - self.create_target, - default_timeout=60.0, - client_info=client_info, - ), - self.update_target: gapic_v1.method.wrap_method( - self.update_target, - default_timeout=60.0, - client_info=client_info, - ), - self.delete_target: gapic_v1.method.wrap_method( - self.delete_target, - default_timeout=60.0, - client_info=client_info, - ), - self.list_releases: gapic_v1.method.wrap_method( - self.list_releases, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.get_release: gapic_v1.method.wrap_method( - self.get_release, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.create_release: gapic_v1.method.wrap_method( - self.create_release, - default_timeout=60.0, - client_info=client_info, - ), - self.abandon_release: gapic_v1.method.wrap_method( - self.abandon_release, - default_timeout=60.0, - client_info=client_info, - ), - self.approve_rollout: gapic_v1.method.wrap_method( - self.approve_rollout, - default_timeout=60.0, - client_info=client_info, - ), - self.list_rollouts: gapic_v1.method.wrap_method( - self.list_rollouts, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.get_rollout: gapic_v1.method.wrap_method( - self.get_rollout, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.create_rollout: gapic_v1.method.wrap_method( - self.create_rollout, - default_timeout=60.0, - client_info=client_info, - ), - self.retry_job: gapic_v1.method.wrap_method( - self.retry_job, - default_timeout=60.0, - client_info=client_info, - ), - self.list_job_runs: gapic_v1.method.wrap_method( - self.list_job_runs, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.get_job_run: gapic_v1.method.wrap_method( - self.get_job_run, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - self.get_config: gapic_v1.method.wrap_method( - self.get_config, - default_retry=retries.Retry( -initial=1.0,maximum=60.0,multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - ), - deadline=60.0, - ), - default_timeout=60.0, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_delivery_pipelines(self) -> Callable[ - [cloud_deploy.ListDeliveryPipelinesRequest], - Union[ - cloud_deploy.ListDeliveryPipelinesResponse, - Awaitable[cloud_deploy.ListDeliveryPipelinesResponse] - ]]: - raise NotImplementedError() - - @property - def get_delivery_pipeline(self) -> Callable[ - [cloud_deploy.GetDeliveryPipelineRequest], - Union[ - cloud_deploy.DeliveryPipeline, - Awaitable[cloud_deploy.DeliveryPipeline] - ]]: - raise NotImplementedError() - - @property - def create_delivery_pipeline(self) -> Callable[ - [cloud_deploy.CreateDeliveryPipelineRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_delivery_pipeline(self) -> Callable[ - [cloud_deploy.UpdateDeliveryPipelineRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_delivery_pipeline(self) -> Callable[ - [cloud_deploy.DeleteDeliveryPipelineRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def list_targets(self) -> Callable[ - [cloud_deploy.ListTargetsRequest], - Union[ - cloud_deploy.ListTargetsResponse, - Awaitable[cloud_deploy.ListTargetsResponse] - ]]: - raise NotImplementedError() - - @property - def get_target(self) -> Callable[ - [cloud_deploy.GetTargetRequest], - Union[ - cloud_deploy.Target, - Awaitable[cloud_deploy.Target] - ]]: - raise NotImplementedError() - - @property - def create_target(self) -> Callable[ - [cloud_deploy.CreateTargetRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_target(self) -> Callable[ - [cloud_deploy.UpdateTargetRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_target(self) -> Callable[ - [cloud_deploy.DeleteTargetRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def list_releases(self) -> Callable[ - [cloud_deploy.ListReleasesRequest], - Union[ - cloud_deploy.ListReleasesResponse, - Awaitable[cloud_deploy.ListReleasesResponse] - ]]: - raise NotImplementedError() - - @property - def get_release(self) -> Callable[ - [cloud_deploy.GetReleaseRequest], - Union[ - cloud_deploy.Release, - Awaitable[cloud_deploy.Release] - ]]: - raise NotImplementedError() - - @property - def create_release(self) -> Callable[ - [cloud_deploy.CreateReleaseRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def abandon_release(self) -> Callable[ - [cloud_deploy.AbandonReleaseRequest], - Union[ - cloud_deploy.AbandonReleaseResponse, - Awaitable[cloud_deploy.AbandonReleaseResponse] - ]]: - raise NotImplementedError() - - @property - def approve_rollout(self) -> Callable[ - [cloud_deploy.ApproveRolloutRequest], - Union[ - cloud_deploy.ApproveRolloutResponse, - Awaitable[cloud_deploy.ApproveRolloutResponse] - ]]: - raise NotImplementedError() - - @property - def list_rollouts(self) -> Callable[ - [cloud_deploy.ListRolloutsRequest], - Union[ - cloud_deploy.ListRolloutsResponse, - Awaitable[cloud_deploy.ListRolloutsResponse] - ]]: - raise NotImplementedError() - - @property - def get_rollout(self) -> Callable[ - [cloud_deploy.GetRolloutRequest], - Union[ - cloud_deploy.Rollout, - Awaitable[cloud_deploy.Rollout] - ]]: - raise NotImplementedError() - - @property - def create_rollout(self) -> Callable[ - [cloud_deploy.CreateRolloutRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def retry_job(self) -> Callable[ - [cloud_deploy.RetryJobRequest], - Union[ - cloud_deploy.RetryJobResponse, - Awaitable[cloud_deploy.RetryJobResponse] - ]]: - raise NotImplementedError() - - @property - def list_job_runs(self) -> Callable[ - [cloud_deploy.ListJobRunsRequest], - Union[ - cloud_deploy.ListJobRunsResponse, - Awaitable[cloud_deploy.ListJobRunsResponse] - ]]: - raise NotImplementedError() - - @property - def get_job_run(self) -> Callable[ - [cloud_deploy.GetJobRunRequest], - Union[ - cloud_deploy.JobRun, - Awaitable[cloud_deploy.JobRun] - ]]: - raise NotImplementedError() - - @property - def get_config(self) -> Callable[ - [cloud_deploy.GetConfigRequest], - Union[ - cloud_deploy.Config, - Awaitable[cloud_deploy.Config] - ]]: - raise NotImplementedError() - - @property - def list_operations( - self, - ) -> Callable[ - [operations_pb2.ListOperationsRequest], - Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], - ]: - raise NotImplementedError() - - @property - def get_operation( - self, - ) -> Callable[ - [operations_pb2.GetOperationRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def cancel_operation( - self, - ) -> Callable[ - [operations_pb2.CancelOperationRequest], - None, - ]: - raise NotImplementedError() - - @property - def delete_operation( - self, - ) -> Callable[ - [operations_pb2.DeleteOperationRequest], - None, - ]: - raise NotImplementedError() - - @property - def set_iam_policy( - self, - ) -> Callable[ - [iam_policy_pb2.SetIamPolicyRequest], - Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], - ]: - raise NotImplementedError() - - @property - def get_iam_policy( - self, - ) -> Callable[ - [iam_policy_pb2.GetIamPolicyRequest], - Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], - ]: - raise NotImplementedError() - - @property - def test_iam_permissions( - self, - ) -> Callable[ - [iam_policy_pb2.TestIamPermissionsRequest], - Union[ - iam_policy_pb2.TestIamPermissionsResponse, - Awaitable[iam_policy_pb2.TestIamPermissionsResponse], - ], - ]: - raise NotImplementedError() - - @property - def get_location(self, - ) -> Callable[ - [locations_pb2.GetLocationRequest], - Union[locations_pb2.Location, Awaitable[locations_pb2.Location]], - ]: - raise NotImplementedError() - - @property - def list_locations(self, - ) -> Callable[ - [locations_pb2.ListLocationsRequest], - Union[locations_pb2.ListLocationsResponse, Awaitable[locations_pb2.ListLocationsResponse]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'CloudDeployTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py deleted file mode 100644 index 386fb61..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc.py +++ /dev/null @@ -1,1026 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.cloud.deploy_v1.types import cloud_deploy -from google.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from .base import CloudDeployTransport, DEFAULT_CLIENT_INFO - - -class CloudDeployGrpcTransport(CloudDeployTransport): - """gRPC backend transport for CloudDeploy. - - CloudDeploy service creates and manages Continuous Delivery - operations on Google Cloud Platform via Skaffold - (https://skaffold.dev). - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - _stubs: Dict[str, Callable] - - def __init__(self, *, - host: str = 'clouddeploy.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'clouddeploy.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_delivery_pipelines(self) -> Callable[ - [cloud_deploy.ListDeliveryPipelinesRequest], - cloud_deploy.ListDeliveryPipelinesResponse]: - r"""Return a callable for the list delivery pipelines method over gRPC. - - Lists DeliveryPipelines in a given project and - location. - - Returns: - Callable[[~.ListDeliveryPipelinesRequest], - ~.ListDeliveryPipelinesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_delivery_pipelines' not in self._stubs: - self._stubs['list_delivery_pipelines'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines', - request_serializer=cloud_deploy.ListDeliveryPipelinesRequest.serialize, - response_deserializer=cloud_deploy.ListDeliveryPipelinesResponse.deserialize, - ) - return self._stubs['list_delivery_pipelines'] - - @property - def get_delivery_pipeline(self) -> Callable[ - [cloud_deploy.GetDeliveryPipelineRequest], - cloud_deploy.DeliveryPipeline]: - r"""Return a callable for the get delivery pipeline method over gRPC. - - Gets details of a single DeliveryPipeline. - - Returns: - Callable[[~.GetDeliveryPipelineRequest], - ~.DeliveryPipeline]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_delivery_pipeline' not in self._stubs: - self._stubs['get_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline', - request_serializer=cloud_deploy.GetDeliveryPipelineRequest.serialize, - response_deserializer=cloud_deploy.DeliveryPipeline.deserialize, - ) - return self._stubs['get_delivery_pipeline'] - - @property - def create_delivery_pipeline(self) -> Callable[ - [cloud_deploy.CreateDeliveryPipelineRequest], - operations_pb2.Operation]: - r"""Return a callable for the create delivery pipeline method over gRPC. - - Creates a new DeliveryPipeline in a given project and - location. - - Returns: - Callable[[~.CreateDeliveryPipelineRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_delivery_pipeline' not in self._stubs: - self._stubs['create_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline', - request_serializer=cloud_deploy.CreateDeliveryPipelineRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_delivery_pipeline'] - - @property - def update_delivery_pipeline(self) -> Callable[ - [cloud_deploy.UpdateDeliveryPipelineRequest], - operations_pb2.Operation]: - r"""Return a callable for the update delivery pipeline method over gRPC. - - Updates the parameters of a single DeliveryPipeline. - - Returns: - Callable[[~.UpdateDeliveryPipelineRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_delivery_pipeline' not in self._stubs: - self._stubs['update_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline', - request_serializer=cloud_deploy.UpdateDeliveryPipelineRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_delivery_pipeline'] - - @property - def delete_delivery_pipeline(self) -> Callable[ - [cloud_deploy.DeleteDeliveryPipelineRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete delivery pipeline method over gRPC. - - Deletes a single DeliveryPipeline. - - Returns: - Callable[[~.DeleteDeliveryPipelineRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_delivery_pipeline' not in self._stubs: - self._stubs['delete_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline', - request_serializer=cloud_deploy.DeleteDeliveryPipelineRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_delivery_pipeline'] - - @property - def list_targets(self) -> Callable[ - [cloud_deploy.ListTargetsRequest], - cloud_deploy.ListTargetsResponse]: - r"""Return a callable for the list targets method over gRPC. - - Lists Targets in a given project and location. - - Returns: - Callable[[~.ListTargetsRequest], - ~.ListTargetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_targets' not in self._stubs: - self._stubs['list_targets'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListTargets', - request_serializer=cloud_deploy.ListTargetsRequest.serialize, - response_deserializer=cloud_deploy.ListTargetsResponse.deserialize, - ) - return self._stubs['list_targets'] - - @property - def get_target(self) -> Callable[ - [cloud_deploy.GetTargetRequest], - cloud_deploy.Target]: - r"""Return a callable for the get target method over gRPC. - - Gets details of a single Target. - - Returns: - Callable[[~.GetTargetRequest], - ~.Target]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_target' not in self._stubs: - self._stubs['get_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetTarget', - request_serializer=cloud_deploy.GetTargetRequest.serialize, - response_deserializer=cloud_deploy.Target.deserialize, - ) - return self._stubs['get_target'] - - @property - def create_target(self) -> Callable[ - [cloud_deploy.CreateTargetRequest], - operations_pb2.Operation]: - r"""Return a callable for the create target method over gRPC. - - Creates a new Target in a given project and location. - - Returns: - Callable[[~.CreateTargetRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_target' not in self._stubs: - self._stubs['create_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateTarget', - request_serializer=cloud_deploy.CreateTargetRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_target'] - - @property - def update_target(self) -> Callable[ - [cloud_deploy.UpdateTargetRequest], - operations_pb2.Operation]: - r"""Return a callable for the update target method over gRPC. - - Updates the parameters of a single Target. - - Returns: - Callable[[~.UpdateTargetRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_target' not in self._stubs: - self._stubs['update_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/UpdateTarget', - request_serializer=cloud_deploy.UpdateTargetRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_target'] - - @property - def delete_target(self) -> Callable[ - [cloud_deploy.DeleteTargetRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete target method over gRPC. - - Deletes a single Target. - - Returns: - Callable[[~.DeleteTargetRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_target' not in self._stubs: - self._stubs['delete_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/DeleteTarget', - request_serializer=cloud_deploy.DeleteTargetRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_target'] - - @property - def list_releases(self) -> Callable[ - [cloud_deploy.ListReleasesRequest], - cloud_deploy.ListReleasesResponse]: - r"""Return a callable for the list releases method over gRPC. - - Lists Releases in a given project and location. - - Returns: - Callable[[~.ListReleasesRequest], - ~.ListReleasesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_releases' not in self._stubs: - self._stubs['list_releases'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListReleases', - request_serializer=cloud_deploy.ListReleasesRequest.serialize, - response_deserializer=cloud_deploy.ListReleasesResponse.deserialize, - ) - return self._stubs['list_releases'] - - @property - def get_release(self) -> Callable[ - [cloud_deploy.GetReleaseRequest], - cloud_deploy.Release]: - r"""Return a callable for the get release method over gRPC. - - Gets details of a single Release. - - Returns: - Callable[[~.GetReleaseRequest], - ~.Release]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_release' not in self._stubs: - self._stubs['get_release'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetRelease', - request_serializer=cloud_deploy.GetReleaseRequest.serialize, - response_deserializer=cloud_deploy.Release.deserialize, - ) - return self._stubs['get_release'] - - @property - def create_release(self) -> Callable[ - [cloud_deploy.CreateReleaseRequest], - operations_pb2.Operation]: - r"""Return a callable for the create release method over gRPC. - - Creates a new Release in a given project and - location. - - Returns: - Callable[[~.CreateReleaseRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_release' not in self._stubs: - self._stubs['create_release'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateRelease', - request_serializer=cloud_deploy.CreateReleaseRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_release'] - - @property - def abandon_release(self) -> Callable[ - [cloud_deploy.AbandonReleaseRequest], - cloud_deploy.AbandonReleaseResponse]: - r"""Return a callable for the abandon release method over gRPC. - - Abandons a Release in the Delivery Pipeline. - - Returns: - Callable[[~.AbandonReleaseRequest], - ~.AbandonReleaseResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'abandon_release' not in self._stubs: - self._stubs['abandon_release'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/AbandonRelease', - request_serializer=cloud_deploy.AbandonReleaseRequest.serialize, - response_deserializer=cloud_deploy.AbandonReleaseResponse.deserialize, - ) - return self._stubs['abandon_release'] - - @property - def approve_rollout(self) -> Callable[ - [cloud_deploy.ApproveRolloutRequest], - cloud_deploy.ApproveRolloutResponse]: - r"""Return a callable for the approve rollout method over gRPC. - - Approves a Rollout. - - Returns: - Callable[[~.ApproveRolloutRequest], - ~.ApproveRolloutResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'approve_rollout' not in self._stubs: - self._stubs['approve_rollout'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ApproveRollout', - request_serializer=cloud_deploy.ApproveRolloutRequest.serialize, - response_deserializer=cloud_deploy.ApproveRolloutResponse.deserialize, - ) - return self._stubs['approve_rollout'] - - @property - def list_rollouts(self) -> Callable[ - [cloud_deploy.ListRolloutsRequest], - cloud_deploy.ListRolloutsResponse]: - r"""Return a callable for the list rollouts method over gRPC. - - Lists Rollouts in a given project and location. - - Returns: - Callable[[~.ListRolloutsRequest], - ~.ListRolloutsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_rollouts' not in self._stubs: - self._stubs['list_rollouts'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListRollouts', - request_serializer=cloud_deploy.ListRolloutsRequest.serialize, - response_deserializer=cloud_deploy.ListRolloutsResponse.deserialize, - ) - return self._stubs['list_rollouts'] - - @property - def get_rollout(self) -> Callable[ - [cloud_deploy.GetRolloutRequest], - cloud_deploy.Rollout]: - r"""Return a callable for the get rollout method over gRPC. - - Gets details of a single Rollout. - - Returns: - Callable[[~.GetRolloutRequest], - ~.Rollout]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_rollout' not in self._stubs: - self._stubs['get_rollout'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetRollout', - request_serializer=cloud_deploy.GetRolloutRequest.serialize, - response_deserializer=cloud_deploy.Rollout.deserialize, - ) - return self._stubs['get_rollout'] - - @property - def create_rollout(self) -> Callable[ - [cloud_deploy.CreateRolloutRequest], - operations_pb2.Operation]: - r"""Return a callable for the create rollout method over gRPC. - - Creates a new Rollout in a given project and - location. - - Returns: - Callable[[~.CreateRolloutRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_rollout' not in self._stubs: - self._stubs['create_rollout'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateRollout', - request_serializer=cloud_deploy.CreateRolloutRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_rollout'] - - @property - def retry_job(self) -> Callable[ - [cloud_deploy.RetryJobRequest], - cloud_deploy.RetryJobResponse]: - r"""Return a callable for the retry job method over gRPC. - - Retries the specified Job in a Rollout. - - Returns: - Callable[[~.RetryJobRequest], - ~.RetryJobResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'retry_job' not in self._stubs: - self._stubs['retry_job'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/RetryJob', - request_serializer=cloud_deploy.RetryJobRequest.serialize, - response_deserializer=cloud_deploy.RetryJobResponse.deserialize, - ) - return self._stubs['retry_job'] - - @property - def list_job_runs(self) -> Callable[ - [cloud_deploy.ListJobRunsRequest], - cloud_deploy.ListJobRunsResponse]: - r"""Return a callable for the list job runs method over gRPC. - - Lists JobRuns in a given project and location. - - Returns: - Callable[[~.ListJobRunsRequest], - ~.ListJobRunsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_job_runs' not in self._stubs: - self._stubs['list_job_runs'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListJobRuns', - request_serializer=cloud_deploy.ListJobRunsRequest.serialize, - response_deserializer=cloud_deploy.ListJobRunsResponse.deserialize, - ) - return self._stubs['list_job_runs'] - - @property - def get_job_run(self) -> Callable[ - [cloud_deploy.GetJobRunRequest], - cloud_deploy.JobRun]: - r"""Return a callable for the get job run method over gRPC. - - Gets details of a single JobRun. - - Returns: - Callable[[~.GetJobRunRequest], - ~.JobRun]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_job_run' not in self._stubs: - self._stubs['get_job_run'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetJobRun', - request_serializer=cloud_deploy.GetJobRunRequest.serialize, - response_deserializer=cloud_deploy.JobRun.deserialize, - ) - return self._stubs['get_job_run'] - - @property - def get_config(self) -> Callable[ - [cloud_deploy.GetConfigRequest], - cloud_deploy.Config]: - r"""Return a callable for the get config method over gRPC. - - Gets the configuration for a location. - - Returns: - Callable[[~.GetConfigRequest], - ~.Config]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_config' not in self._stubs: - self._stubs['get_config'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetConfig', - request_serializer=cloud_deploy.GetConfigRequest.serialize, - response_deserializer=cloud_deploy.Config.deserialize, - ) - return self._stubs['get_config'] - - def close(self): - self.grpc_channel.close() - - @property - def delete_operation( - self, - ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/DeleteOperation", - request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["delete_operation"] - - @property - def cancel_operation( - self, - ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/CancelOperation", - request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["cancel_operation"] - - @property - def get_operation( - self, - ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/GetOperation", - request_serializer=operations_pb2.GetOperationRequest.SerializeToString, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["get_operation"] - - @property - def list_operations( - self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/ListOperations", - request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, - response_deserializer=operations_pb2.ListOperationsResponse.FromString, - ) - return self._stubs["list_operations"] - - @property - def list_locations( - self, - ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/ListLocations", - request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, - response_deserializer=locations_pb2.ListLocationsResponse.FromString, - ) - return self._stubs["list_locations"] - - @property - def get_location( - self, - ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/GetLocation", - request_serializer=locations_pb2.GetLocationRequest.SerializeToString, - response_deserializer=locations_pb2.Location.FromString, - ) - return self._stubs["get_location"] - - @property - def set_iam_policy( - self, - ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]: - r"""Return a callable for the set iam policy method over gRPC. - Sets the IAM access control policy on the specified - function. Replaces any existing policy. - Returns: - Callable[[~.SetIamPolicyRequest], - ~.Policy]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( - "/google.iam.v1.IAMPolicy/SetIamPolicy", - request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, - response_deserializer=policy_pb2.Policy.FromString, - ) - return self._stubs["set_iam_policy"] - - @property - def get_iam_policy( - self, - ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]: - r"""Return a callable for the get iam policy method over gRPC. - Gets the IAM access control policy for a function. - Returns an empty policy if the function exists and does - not have a policy set. - Returns: - Callable[[~.GetIamPolicyRequest], - ~.Policy]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( - "/google.iam.v1.IAMPolicy/GetIamPolicy", - request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, - response_deserializer=policy_pb2.Policy.FromString, - ) - return self._stubs["get_iam_policy"] - - @property - def test_iam_permissions( - self, - ) -> Callable[ - [iam_policy_pb2.TestIamPermissionsRequest], iam_policy_pb2.TestIamPermissionsResponse - ]: - r"""Return a callable for the test iam permissions method over gRPC. - Tests the specified permissions against the IAM access control - policy for a function. If the function does not exist, this will - return an empty set of permissions, not a NOT_FOUND error. - Returns: - Callable[[~.TestIamPermissionsRequest], - ~.TestIamPermissionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( - "/google.iam.v1.IAMPolicy/TestIamPermissions", - request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, - response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, - ) - return self._stubs["test_iam_permissions"] - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'CloudDeployGrpcTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py deleted file mode 100644 index 11bd3c8..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/services/cloud_deploy/transports/grpc_asyncio.py +++ /dev/null @@ -1,1025 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.deploy_v1.types import cloud_deploy -from google.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from .base import CloudDeployTransport, DEFAULT_CLIENT_INFO -from .grpc import CloudDeployGrpcTransport - - -class CloudDeployGrpcAsyncIOTransport(CloudDeployTransport): - """gRPC AsyncIO backend transport for CloudDeploy. - - CloudDeploy service creates and manages Continuous Delivery - operations on Google Cloud Platform via Skaffold - (https://skaffold.dev). - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel(cls, - host: str = 'clouddeploy.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - def __init__(self, *, - host: str = 'clouddeploy.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_delivery_pipelines(self) -> Callable[ - [cloud_deploy.ListDeliveryPipelinesRequest], - Awaitable[cloud_deploy.ListDeliveryPipelinesResponse]]: - r"""Return a callable for the list delivery pipelines method over gRPC. - - Lists DeliveryPipelines in a given project and - location. - - Returns: - Callable[[~.ListDeliveryPipelinesRequest], - Awaitable[~.ListDeliveryPipelinesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_delivery_pipelines' not in self._stubs: - self._stubs['list_delivery_pipelines'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListDeliveryPipelines', - request_serializer=cloud_deploy.ListDeliveryPipelinesRequest.serialize, - response_deserializer=cloud_deploy.ListDeliveryPipelinesResponse.deserialize, - ) - return self._stubs['list_delivery_pipelines'] - - @property - def get_delivery_pipeline(self) -> Callable[ - [cloud_deploy.GetDeliveryPipelineRequest], - Awaitable[cloud_deploy.DeliveryPipeline]]: - r"""Return a callable for the get delivery pipeline method over gRPC. - - Gets details of a single DeliveryPipeline. - - Returns: - Callable[[~.GetDeliveryPipelineRequest], - Awaitable[~.DeliveryPipeline]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_delivery_pipeline' not in self._stubs: - self._stubs['get_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetDeliveryPipeline', - request_serializer=cloud_deploy.GetDeliveryPipelineRequest.serialize, - response_deserializer=cloud_deploy.DeliveryPipeline.deserialize, - ) - return self._stubs['get_delivery_pipeline'] - - @property - def create_delivery_pipeline(self) -> Callable[ - [cloud_deploy.CreateDeliveryPipelineRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create delivery pipeline method over gRPC. - - Creates a new DeliveryPipeline in a given project and - location. - - Returns: - Callable[[~.CreateDeliveryPipelineRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_delivery_pipeline' not in self._stubs: - self._stubs['create_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateDeliveryPipeline', - request_serializer=cloud_deploy.CreateDeliveryPipelineRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_delivery_pipeline'] - - @property - def update_delivery_pipeline(self) -> Callable[ - [cloud_deploy.UpdateDeliveryPipelineRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update delivery pipeline method over gRPC. - - Updates the parameters of a single DeliveryPipeline. - - Returns: - Callable[[~.UpdateDeliveryPipelineRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_delivery_pipeline' not in self._stubs: - self._stubs['update_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/UpdateDeliveryPipeline', - request_serializer=cloud_deploy.UpdateDeliveryPipelineRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_delivery_pipeline'] - - @property - def delete_delivery_pipeline(self) -> Callable[ - [cloud_deploy.DeleteDeliveryPipelineRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete delivery pipeline method over gRPC. - - Deletes a single DeliveryPipeline. - - Returns: - Callable[[~.DeleteDeliveryPipelineRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_delivery_pipeline' not in self._stubs: - self._stubs['delete_delivery_pipeline'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/DeleteDeliveryPipeline', - request_serializer=cloud_deploy.DeleteDeliveryPipelineRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_delivery_pipeline'] - - @property - def list_targets(self) -> Callable[ - [cloud_deploy.ListTargetsRequest], - Awaitable[cloud_deploy.ListTargetsResponse]]: - r"""Return a callable for the list targets method over gRPC. - - Lists Targets in a given project and location. - - Returns: - Callable[[~.ListTargetsRequest], - Awaitable[~.ListTargetsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_targets' not in self._stubs: - self._stubs['list_targets'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListTargets', - request_serializer=cloud_deploy.ListTargetsRequest.serialize, - response_deserializer=cloud_deploy.ListTargetsResponse.deserialize, - ) - return self._stubs['list_targets'] - - @property - def get_target(self) -> Callable[ - [cloud_deploy.GetTargetRequest], - Awaitable[cloud_deploy.Target]]: - r"""Return a callable for the get target method over gRPC. - - Gets details of a single Target. - - Returns: - Callable[[~.GetTargetRequest], - Awaitable[~.Target]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_target' not in self._stubs: - self._stubs['get_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetTarget', - request_serializer=cloud_deploy.GetTargetRequest.serialize, - response_deserializer=cloud_deploy.Target.deserialize, - ) - return self._stubs['get_target'] - - @property - def create_target(self) -> Callable[ - [cloud_deploy.CreateTargetRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create target method over gRPC. - - Creates a new Target in a given project and location. - - Returns: - Callable[[~.CreateTargetRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_target' not in self._stubs: - self._stubs['create_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateTarget', - request_serializer=cloud_deploy.CreateTargetRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_target'] - - @property - def update_target(self) -> Callable[ - [cloud_deploy.UpdateTargetRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update target method over gRPC. - - Updates the parameters of a single Target. - - Returns: - Callable[[~.UpdateTargetRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_target' not in self._stubs: - self._stubs['update_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/UpdateTarget', - request_serializer=cloud_deploy.UpdateTargetRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_target'] - - @property - def delete_target(self) -> Callable[ - [cloud_deploy.DeleteTargetRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete target method over gRPC. - - Deletes a single Target. - - Returns: - Callable[[~.DeleteTargetRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_target' not in self._stubs: - self._stubs['delete_target'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/DeleteTarget', - request_serializer=cloud_deploy.DeleteTargetRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_target'] - - @property - def list_releases(self) -> Callable[ - [cloud_deploy.ListReleasesRequest], - Awaitable[cloud_deploy.ListReleasesResponse]]: - r"""Return a callable for the list releases method over gRPC. - - Lists Releases in a given project and location. - - Returns: - Callable[[~.ListReleasesRequest], - Awaitable[~.ListReleasesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_releases' not in self._stubs: - self._stubs['list_releases'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListReleases', - request_serializer=cloud_deploy.ListReleasesRequest.serialize, - response_deserializer=cloud_deploy.ListReleasesResponse.deserialize, - ) - return self._stubs['list_releases'] - - @property - def get_release(self) -> Callable[ - [cloud_deploy.GetReleaseRequest], - Awaitable[cloud_deploy.Release]]: - r"""Return a callable for the get release method over gRPC. - - Gets details of a single Release. - - Returns: - Callable[[~.GetReleaseRequest], - Awaitable[~.Release]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_release' not in self._stubs: - self._stubs['get_release'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetRelease', - request_serializer=cloud_deploy.GetReleaseRequest.serialize, - response_deserializer=cloud_deploy.Release.deserialize, - ) - return self._stubs['get_release'] - - @property - def create_release(self) -> Callable[ - [cloud_deploy.CreateReleaseRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create release method over gRPC. - - Creates a new Release in a given project and - location. - - Returns: - Callable[[~.CreateReleaseRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_release' not in self._stubs: - self._stubs['create_release'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateRelease', - request_serializer=cloud_deploy.CreateReleaseRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_release'] - - @property - def abandon_release(self) -> Callable[ - [cloud_deploy.AbandonReleaseRequest], - Awaitable[cloud_deploy.AbandonReleaseResponse]]: - r"""Return a callable for the abandon release method over gRPC. - - Abandons a Release in the Delivery Pipeline. - - Returns: - Callable[[~.AbandonReleaseRequest], - Awaitable[~.AbandonReleaseResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'abandon_release' not in self._stubs: - self._stubs['abandon_release'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/AbandonRelease', - request_serializer=cloud_deploy.AbandonReleaseRequest.serialize, - response_deserializer=cloud_deploy.AbandonReleaseResponse.deserialize, - ) - return self._stubs['abandon_release'] - - @property - def approve_rollout(self) -> Callable[ - [cloud_deploy.ApproveRolloutRequest], - Awaitable[cloud_deploy.ApproveRolloutResponse]]: - r"""Return a callable for the approve rollout method over gRPC. - - Approves a Rollout. - - Returns: - Callable[[~.ApproveRolloutRequest], - Awaitable[~.ApproveRolloutResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'approve_rollout' not in self._stubs: - self._stubs['approve_rollout'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ApproveRollout', - request_serializer=cloud_deploy.ApproveRolloutRequest.serialize, - response_deserializer=cloud_deploy.ApproveRolloutResponse.deserialize, - ) - return self._stubs['approve_rollout'] - - @property - def list_rollouts(self) -> Callable[ - [cloud_deploy.ListRolloutsRequest], - Awaitable[cloud_deploy.ListRolloutsResponse]]: - r"""Return a callable for the list rollouts method over gRPC. - - Lists Rollouts in a given project and location. - - Returns: - Callable[[~.ListRolloutsRequest], - Awaitable[~.ListRolloutsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_rollouts' not in self._stubs: - self._stubs['list_rollouts'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListRollouts', - request_serializer=cloud_deploy.ListRolloutsRequest.serialize, - response_deserializer=cloud_deploy.ListRolloutsResponse.deserialize, - ) - return self._stubs['list_rollouts'] - - @property - def get_rollout(self) -> Callable[ - [cloud_deploy.GetRolloutRequest], - Awaitable[cloud_deploy.Rollout]]: - r"""Return a callable for the get rollout method over gRPC. - - Gets details of a single Rollout. - - Returns: - Callable[[~.GetRolloutRequest], - Awaitable[~.Rollout]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_rollout' not in self._stubs: - self._stubs['get_rollout'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetRollout', - request_serializer=cloud_deploy.GetRolloutRequest.serialize, - response_deserializer=cloud_deploy.Rollout.deserialize, - ) - return self._stubs['get_rollout'] - - @property - def create_rollout(self) -> Callable[ - [cloud_deploy.CreateRolloutRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create rollout method over gRPC. - - Creates a new Rollout in a given project and - location. - - Returns: - Callable[[~.CreateRolloutRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_rollout' not in self._stubs: - self._stubs['create_rollout'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/CreateRollout', - request_serializer=cloud_deploy.CreateRolloutRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_rollout'] - - @property - def retry_job(self) -> Callable[ - [cloud_deploy.RetryJobRequest], - Awaitable[cloud_deploy.RetryJobResponse]]: - r"""Return a callable for the retry job method over gRPC. - - Retries the specified Job in a Rollout. - - Returns: - Callable[[~.RetryJobRequest], - Awaitable[~.RetryJobResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'retry_job' not in self._stubs: - self._stubs['retry_job'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/RetryJob', - request_serializer=cloud_deploy.RetryJobRequest.serialize, - response_deserializer=cloud_deploy.RetryJobResponse.deserialize, - ) - return self._stubs['retry_job'] - - @property - def list_job_runs(self) -> Callable[ - [cloud_deploy.ListJobRunsRequest], - Awaitable[cloud_deploy.ListJobRunsResponse]]: - r"""Return a callable for the list job runs method over gRPC. - - Lists JobRuns in a given project and location. - - Returns: - Callable[[~.ListJobRunsRequest], - Awaitable[~.ListJobRunsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_job_runs' not in self._stubs: - self._stubs['list_job_runs'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/ListJobRuns', - request_serializer=cloud_deploy.ListJobRunsRequest.serialize, - response_deserializer=cloud_deploy.ListJobRunsResponse.deserialize, - ) - return self._stubs['list_job_runs'] - - @property - def get_job_run(self) -> Callable[ - [cloud_deploy.GetJobRunRequest], - Awaitable[cloud_deploy.JobRun]]: - r"""Return a callable for the get job run method over gRPC. - - Gets details of a single JobRun. - - Returns: - Callable[[~.GetJobRunRequest], - Awaitable[~.JobRun]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_job_run' not in self._stubs: - self._stubs['get_job_run'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetJobRun', - request_serializer=cloud_deploy.GetJobRunRequest.serialize, - response_deserializer=cloud_deploy.JobRun.deserialize, - ) - return self._stubs['get_job_run'] - - @property - def get_config(self) -> Callable[ - [cloud_deploy.GetConfigRequest], - Awaitable[cloud_deploy.Config]]: - r"""Return a callable for the get config method over gRPC. - - Gets the configuration for a location. - - Returns: - Callable[[~.GetConfigRequest], - Awaitable[~.Config]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_config' not in self._stubs: - self._stubs['get_config'] = self.grpc_channel.unary_unary( - '/google.cloud.deploy.v1.CloudDeploy/GetConfig', - request_serializer=cloud_deploy.GetConfigRequest.serialize, - response_deserializer=cloud_deploy.Config.deserialize, - ) - return self._stubs['get_config'] - - def close(self): - return self.grpc_channel.close() - - @property - def delete_operation( - self, - ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/DeleteOperation", - request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["delete_operation"] - - @property - def cancel_operation( - self, - ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/CancelOperation", - request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["cancel_operation"] - - @property - def get_operation( - self, - ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/GetOperation", - request_serializer=operations_pb2.GetOperationRequest.SerializeToString, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["get_operation"] - - @property - def list_operations( - self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/ListOperations", - request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, - response_deserializer=operations_pb2.ListOperationsResponse.FromString, - ) - return self._stubs["list_operations"] - - @property - def list_locations( - self, - ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/ListLocations", - request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, - response_deserializer=locations_pb2.ListLocationsResponse.FromString, - ) - return self._stubs["list_locations"] - - @property - def get_location( - self, - ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/GetLocation", - request_serializer=locations_pb2.GetLocationRequest.SerializeToString, - response_deserializer=locations_pb2.Location.FromString, - ) - return self._stubs["get_location"] - - @property - def set_iam_policy( - self, - ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]: - r"""Return a callable for the set iam policy method over gRPC. - Sets the IAM access control policy on the specified - function. Replaces any existing policy. - Returns: - Callable[[~.SetIamPolicyRequest], - ~.Policy]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( - "/google.iam.v1.IAMPolicy/SetIamPolicy", - request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, - response_deserializer=policy_pb2.Policy.FromString, - ) - return self._stubs["set_iam_policy"] - - @property - def get_iam_policy( - self, - ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]: - r"""Return a callable for the get iam policy method over gRPC. - Gets the IAM access control policy for a function. - Returns an empty policy if the function exists and does - not have a policy set. - Returns: - Callable[[~.GetIamPolicyRequest], - ~.Policy]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( - "/google.iam.v1.IAMPolicy/GetIamPolicy", - request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, - response_deserializer=policy_pb2.Policy.FromString, - ) - return self._stubs["get_iam_policy"] - - @property - def test_iam_permissions( - self, - ) -> Callable[ - [iam_policy_pb2.TestIamPermissionsRequest], iam_policy_pb2.TestIamPermissionsResponse - ]: - r"""Return a callable for the test iam permissions method over gRPC. - Tests the specified permissions against the IAM access control - policy for a function. If the function does not exist, this will - return an empty set of permissions, not a NOT_FOUND error. - Returns: - Callable[[~.TestIamPermissionsRequest], - ~.TestIamPermissionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( - "/google.iam.v1.IAMPolicy/TestIamPermissions", - request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, - response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, - ) - return self._stubs["test_iam_permissions"] - - -__all__ = ( - 'CloudDeployGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py deleted file mode 100644 index 7b13af7..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/__init__.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .cloud_deploy import ( - AbandonReleaseRequest, - AbandonReleaseResponse, - AnthosCluster, - ApproveRolloutRequest, - ApproveRolloutResponse, - BuildArtifact, - CloudRunLocation, - CloudRunMetadata, - Config, - CreateDeliveryPipelineRequest, - CreateReleaseRequest, - CreateRolloutRequest, - CreateTargetRequest, - DefaultPool, - DeleteDeliveryPipelineRequest, - DeleteTargetRequest, - DeliveryPipeline, - DeployJob, - DeployJobRun, - DeployJobRunMetadata, - DeploymentJobs, - ExecutionConfig, - GetConfigRequest, - GetDeliveryPipelineRequest, - GetJobRunRequest, - GetReleaseRequest, - GetRolloutRequest, - GetTargetRequest, - GkeCluster, - Job, - JobRun, - ListDeliveryPipelinesRequest, - ListDeliveryPipelinesResponse, - ListJobRunsRequest, - ListJobRunsResponse, - ListReleasesRequest, - ListReleasesResponse, - ListRolloutsRequest, - ListRolloutsResponse, - ListTargetsRequest, - ListTargetsResponse, - Metadata, - OperationMetadata, - Phase, - PipelineCondition, - PipelineReadyCondition, - PrivatePool, - Release, - RetryJobRequest, - RetryJobResponse, - Rollout, - SerialPipeline, - SkaffoldVersion, - Stage, - Standard, - Strategy, - Target, - TargetArtifact, - TargetsPresentCondition, - UpdateDeliveryPipelineRequest, - UpdateTargetRequest, - VerifyJob, - VerifyJobRun, -) -from .deliverypipeline_notification_payload import ( - DeliveryPipelineNotificationEvent, -) -from .jobrun_notification_payload import ( - JobRunNotificationEvent, -) -from .release_notification_payload import ( - ReleaseNotificationEvent, -) -from .release_render_payload import ( - ReleaseRenderEvent, -) -from .rollout_notification_payload import ( - RolloutNotificationEvent, -) -from .target_notification_payload import ( - TargetNotificationEvent, -) - -__all__ = ( - 'AbandonReleaseRequest', - 'AbandonReleaseResponse', - 'AnthosCluster', - 'ApproveRolloutRequest', - 'ApproveRolloutResponse', - 'BuildArtifact', - 'CloudRunLocation', - 'CloudRunMetadata', - 'Config', - 'CreateDeliveryPipelineRequest', - 'CreateReleaseRequest', - 'CreateRolloutRequest', - 'CreateTargetRequest', - 'DefaultPool', - 'DeleteDeliveryPipelineRequest', - 'DeleteTargetRequest', - 'DeliveryPipeline', - 'DeployJob', - 'DeployJobRun', - 'DeployJobRunMetadata', - 'DeploymentJobs', - 'ExecutionConfig', - 'GetConfigRequest', - 'GetDeliveryPipelineRequest', - 'GetJobRunRequest', - 'GetReleaseRequest', - 'GetRolloutRequest', - 'GetTargetRequest', - 'GkeCluster', - 'Job', - 'JobRun', - 'ListDeliveryPipelinesRequest', - 'ListDeliveryPipelinesResponse', - 'ListJobRunsRequest', - 'ListJobRunsResponse', - 'ListReleasesRequest', - 'ListReleasesResponse', - 'ListRolloutsRequest', - 'ListRolloutsResponse', - 'ListTargetsRequest', - 'ListTargetsResponse', - 'Metadata', - 'OperationMetadata', - 'Phase', - 'PipelineCondition', - 'PipelineReadyCondition', - 'PrivatePool', - 'Release', - 'RetryJobRequest', - 'RetryJobResponse', - 'Rollout', - 'SerialPipeline', - 'SkaffoldVersion', - 'Stage', - 'Standard', - 'Strategy', - 'Target', - 'TargetArtifact', - 'TargetsPresentCondition', - 'UpdateDeliveryPipelineRequest', - 'UpdateTargetRequest', - 'VerifyJob', - 'VerifyJobRun', - 'DeliveryPipelineNotificationEvent', - 'JobRunNotificationEvent', - 'Type', - 'ReleaseNotificationEvent', - 'ReleaseRenderEvent', - 'RolloutNotificationEvent', - 'TargetNotificationEvent', -) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py deleted file mode 100644 index 2ff5e30..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/cloud_deploy.py +++ /dev/null @@ -1,2862 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from google.type import date_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'DeliveryPipeline', - 'SerialPipeline', - 'Stage', - 'Strategy', - 'Standard', - 'PipelineReadyCondition', - 'TargetsPresentCondition', - 'PipelineCondition', - 'ListDeliveryPipelinesRequest', - 'ListDeliveryPipelinesResponse', - 'GetDeliveryPipelineRequest', - 'CreateDeliveryPipelineRequest', - 'UpdateDeliveryPipelineRequest', - 'DeleteDeliveryPipelineRequest', - 'Target', - 'ExecutionConfig', - 'DefaultPool', - 'PrivatePool', - 'GkeCluster', - 'AnthosCluster', - 'CloudRunLocation', - 'ListTargetsRequest', - 'ListTargetsResponse', - 'GetTargetRequest', - 'CreateTargetRequest', - 'UpdateTargetRequest', - 'DeleteTargetRequest', - 'Release', - 'BuildArtifact', - 'TargetArtifact', - 'ListReleasesRequest', - 'ListReleasesResponse', - 'GetReleaseRequest', - 'CreateReleaseRequest', - 'Rollout', - 'Metadata', - 'DeployJobRunMetadata', - 'CloudRunMetadata', - 'Phase', - 'DeploymentJobs', - 'Job', - 'DeployJob', - 'VerifyJob', - 'ListRolloutsRequest', - 'ListRolloutsResponse', - 'GetRolloutRequest', - 'CreateRolloutRequest', - 'OperationMetadata', - 'ApproveRolloutRequest', - 'ApproveRolloutResponse', - 'RetryJobRequest', - 'RetryJobResponse', - 'AbandonReleaseRequest', - 'AbandonReleaseResponse', - 'JobRun', - 'DeployJobRun', - 'VerifyJobRun', - 'ListJobRunsRequest', - 'ListJobRunsResponse', - 'GetJobRunRequest', - 'Config', - 'SkaffoldVersion', - 'GetConfigRequest', - }, -) - - -class DeliveryPipeline(proto.Message): - r"""A ``DeliveryPipeline`` resource in the Google Cloud Deploy API. - - A ``DeliveryPipeline`` defines a pipeline through which a Skaffold - configuration can progress. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Optional. Name of the ``DeliveryPipeline``. Format is - projects/{project}/ - locations/{location}/deliveryPipelines/[a-z][a-z0-9-]{0,62}. - uid (str): - Output only. Unique identifier of the ``DeliveryPipeline``. - description (str): - Description of the ``DeliveryPipeline``. Max length is 255 - characters. - annotations (Mapping[str, str]): - User annotations. These attributes can only - be set and used by the user, and not by Google - Cloud Deploy. - labels (Mapping[str, str]): - Labels are attributes that can be set and used by both the - user and by Google Cloud Deploy. Labels must meet the - following constraints: - - - Keys and values can contain only lowercase letters, - numeric characters, underscores, and dashes. - - All characters must use UTF-8 encoding, and international - characters are allowed. - - Keys must start with a lowercase letter or international - character. - - Each resource is limited to a maximum of 64 labels. - - Both keys and values are additionally constrained to be <= - 128 bytes. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the pipeline was - created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Most recent time at which the - pipeline was updated. - serial_pipeline (google.cloud.deploy_v1.types.SerialPipeline): - SerialPipeline defines a sequential set of stages for a - ``DeliveryPipeline``. - - This field is a member of `oneof`_ ``pipeline``. - condition (google.cloud.deploy_v1.types.PipelineCondition): - Output only. Information around the state of - the Delivery Pipeline. - etag (str): - This checksum is computed by the server based - on the value of other fields, and may be sent on - update and delete requests to ensure the client - has an up-to-date value before proceeding. - suspended (bool): - When suspended, no new releases or rollouts - can be created, but in-progress ones will - complete. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - uid = proto.Field( - proto.STRING, - number=2, - ) - description = proto.Field( - proto.STRING, - number=3, - ) - annotations = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - labels = proto.MapField( - proto.STRING, - proto.STRING, - number=5, - ) - create_time = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - update_time = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - serial_pipeline = proto.Field( - proto.MESSAGE, - number=8, - oneof='pipeline', - message='SerialPipeline', - ) - condition = proto.Field( - proto.MESSAGE, - number=11, - message='PipelineCondition', - ) - etag = proto.Field( - proto.STRING, - number=10, - ) - suspended = proto.Field( - proto.BOOL, - number=12, - ) - - -class SerialPipeline(proto.Message): - r"""SerialPipeline defines a sequential set of stages for a - ``DeliveryPipeline``. - - Attributes: - stages (Sequence[google.cloud.deploy_v1.types.Stage]): - Each stage specifies configuration for a ``Target``. The - ordering of this list defines the promotion flow. - """ - - stages = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Stage', - ) - - -class Stage(proto.Message): - r"""Stage specifies a location to which to deploy. - - Attributes: - target_id (str): - The target_id to which this stage points. This field refers - exclusively to the last segment of a target name. For - example, this field would just be ``my-target`` (rather than - ``projects/project/locations/location/targets/my-target``). - The location of the ``Target`` is inferred to be the same as - the location of the ``DeliveryPipeline`` that contains this - ``Stage``. - profiles (Sequence[str]): - Skaffold profiles to use when rendering the manifest for - this stage's ``Target``. - strategy (google.cloud.deploy_v1.types.Strategy): - Optional. The strategy to use for a ``Rollout`` to this - stage. - """ - - target_id = proto.Field( - proto.STRING, - number=1, - ) - profiles = proto.RepeatedField( - proto.STRING, - number=2, - ) - strategy = proto.Field( - proto.MESSAGE, - number=5, - message='Strategy', - ) - - -class Strategy(proto.Message): - r"""Strategy contains deployment strategy information. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - standard (google.cloud.deploy_v1.types.Standard): - Standard deployment strategy executes a - single deploy and allows verifying the - deployment. - - This field is a member of `oneof`_ ``deployment_strategy``. - """ - - standard = proto.Field( - proto.MESSAGE, - number=1, - oneof='deployment_strategy', - message='Standard', - ) - - -class Standard(proto.Message): - r"""Standard represents the standard deployment strategy. - - Attributes: - verify (bool): - Whether to verify a deployment. - """ - - verify = proto.Field( - proto.BOOL, - number=1, - ) - - -class PipelineReadyCondition(proto.Message): - r"""PipelineReadyCondition contains information around the status - of the Pipeline. - - Attributes: - status (bool): - True if the Pipeline is in a valid state. Otherwise at least - one condition in ``PipelineCondition`` is in an invalid - state. Iterate over those conditions and see which - condition(s) has status = false to find out what is wrong - with the Pipeline. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Last time the condition was updated. - """ - - status = proto.Field( - proto.BOOL, - number=3, - ) - update_time = proto.Field( - proto.MESSAGE, - number=4, - message=timestamp_pb2.Timestamp, - ) - - -class TargetsPresentCondition(proto.Message): - r"""TargetsPresentCondition contains information on any Targets - defined in the Delivery Pipeline that do not actually exist. - - Attributes: - status (bool): - True if there aren't any missing Targets. - missing_targets (Sequence[str]): - The list of Target names that are missing. For example, - projects/{project_id}/locations/{location_name}/targets/{target_name}. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Last time the condition was updated. - """ - - status = proto.Field( - proto.BOOL, - number=1, - ) - missing_targets = proto.RepeatedField( - proto.STRING, - number=2, - ) - update_time = proto.Field( - proto.MESSAGE, - number=4, - message=timestamp_pb2.Timestamp, - ) - - -class PipelineCondition(proto.Message): - r"""PipelineCondition contains all conditions relevant to a - Delivery Pipeline. - - Attributes: - pipeline_ready_condition (google.cloud.deploy_v1.types.PipelineReadyCondition): - Details around the Pipeline's overall status. - targets_present_condition (google.cloud.deploy_v1.types.TargetsPresentCondition): - Detalis around targets enumerated in the - pipeline. - """ - - pipeline_ready_condition = proto.Field( - proto.MESSAGE, - number=1, - message='PipelineReadyCondition', - ) - targets_present_condition = proto.Field( - proto.MESSAGE, - number=3, - message='TargetsPresentCondition', - ) - - -class ListDeliveryPipelinesRequest(proto.Message): - r"""The request object for ``ListDeliveryPipelines``. - - Attributes: - parent (str): - Required. The parent, which owns this collection of - pipelines. Format must be - projects/{project_id}/locations/{location_name}. - page_size (int): - The maximum number of pipelines to return. - The service may return fewer than this value. If - unspecified, at most 50 pipelines will be - returned. The maximum value is 1000; values - above 1000 will be set to 1000. - page_token (str): - A page token, received from a previous - ``ListDeliveryPipelines`` call. Provide this to retrieve the - subsequent page. - - When paginating, all other provided parameters match the - call that provided the page token. - filter (str): - Filter pipelines to be returned. See - https://google.aip.dev/160 for more details. - order_by (str): - Field to sort by. See - https://google.aip.dev/132#ordering for more - details. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - order_by = proto.Field( - proto.STRING, - number=5, - ) - - -class ListDeliveryPipelinesResponse(proto.Message): - r"""The response object from ``ListDeliveryPipelines``. - - Attributes: - delivery_pipelines (Sequence[google.cloud.deploy_v1.types.DeliveryPipeline]): - The ``DeliveryPipeline`` objects. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (Sequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - delivery_pipelines = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='DeliveryPipeline', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - unreachable = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetDeliveryPipelineRequest(proto.Message): - r"""The request object for ``GetDeliveryPipeline`` - - Attributes: - name (str): - Required. Name of the ``DeliveryPipeline``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateDeliveryPipelineRequest(proto.Message): - r"""The request object for ``CreateDeliveryPipeline``. - - Attributes: - parent (str): - Required. The parent collection in which the - ``DeliveryPipeline`` should be created. Format should be - projects/{project_id}/locations/{location_name}. - delivery_pipeline_id (str): - Required. ID of the ``DeliveryPipeline``. - delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): - Required. The ``DeliveryPipeline`` to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. If set to true, the request is - validated and the user is provided with an - expected result, but no actual change is made. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - delivery_pipeline_id = proto.Field( - proto.STRING, - number=2, - ) - delivery_pipeline = proto.Field( - proto.MESSAGE, - number=3, - message='DeliveryPipeline', - ) - request_id = proto.Field( - proto.STRING, - number=4, - ) - validate_only = proto.Field( - proto.BOOL, - number=5, - ) - - -class UpdateDeliveryPipelineRequest(proto.Message): - r"""The request object for ``UpdateDeliveryPipeline``. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. Field mask is used to specify the fields to be - overwritten in the ``DeliveryPipeline`` resource by the - update. The fields specified in the update_mask are relative - to the resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - delivery_pipeline (google.cloud.deploy_v1.types.DeliveryPipeline): - Required. The ``DeliveryPipeline`` to update. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - allow_missing (bool): - Optional. If set to true, updating a ``DeliveryPipeline`` - that does not exist will result in the creation of a new - ``DeliveryPipeline``. - validate_only (bool): - Optional. If set to true, the request is - validated and the user is provided with an - expected result, but no actual change is made. - """ - - update_mask = proto.Field( - proto.MESSAGE, - number=1, - message=field_mask_pb2.FieldMask, - ) - delivery_pipeline = proto.Field( - proto.MESSAGE, - number=2, - message='DeliveryPipeline', - ) - request_id = proto.Field( - proto.STRING, - number=3, - ) - allow_missing = proto.Field( - proto.BOOL, - number=4, - ) - validate_only = proto.Field( - proto.BOOL, - number=5, - ) - - -class DeleteDeliveryPipelineRequest(proto.Message): - r"""The request object for ``DeleteDeliveryPipeline``. - - Attributes: - name (str): - Required. The name of the ``DeliveryPipeline`` to delete. - Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - allow_missing (bool): - Optional. If set to true, then deleting an already deleted - or non-existing ``DeliveryPipeline`` will succeed. - validate_only (bool): - Optional. If set, validate the request and - preview the review, but do not actually post it. - force (bool): - Optional. If set to true, all child resources - under this pipeline will also be deleted. - Otherwise, the request will only work if the - pipeline has no child resources. - etag (str): - Optional. This checksum is computed by the - server based on the value of other fields, and - may be sent on update and delete requests to - ensure the client has an up-to-date value before - proceeding. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - request_id = proto.Field( - proto.STRING, - number=2, - ) - allow_missing = proto.Field( - proto.BOOL, - number=3, - ) - validate_only = proto.Field( - proto.BOOL, - number=4, - ) - force = proto.Field( - proto.BOOL, - number=6, - ) - etag = proto.Field( - proto.STRING, - number=5, - ) - - -class Target(proto.Message): - r"""A ``Target`` resource in the Google Cloud Deploy API. - - A ``Target`` defines a location to which a Skaffold configuration - can be deployed. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Optional. Name of the ``Target``. Format is - projects/{project}/locations/{location}/targets/[a-z][a-z0-9-]{0,62}. - target_id (str): - Output only. Resource id of the ``Target``. - uid (str): - Output only. Unique identifier of the ``Target``. - description (str): - Optional. Description of the ``Target``. Max length is 255 - characters. - annotations (Mapping[str, str]): - Optional. User annotations. These attributes - can only be set and used by the user, and not by - Google Cloud Deploy. See - https://google.aip.dev/128#annotations for more - details such as format and size limitations. - labels (Mapping[str, str]): - Optional. Labels are attributes that can be set and used by - both the user and by Google Cloud Deploy. Labels must meet - the following constraints: - - - Keys and values can contain only lowercase letters, - numeric characters, underscores, and dashes. - - All characters must use UTF-8 encoding, and international - characters are allowed. - - Keys must start with a lowercase letter or international - character. - - Each resource is limited to a maximum of 64 labels. - - Both keys and values are additionally constrained to be <= - 128 bytes. - require_approval (bool): - Optional. Whether or not the ``Target`` requires approval. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``Target`` was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Most recent time at which the ``Target`` was - updated. - gke (google.cloud.deploy_v1.types.GkeCluster): - Information specifying a GKE Cluster. - - This field is a member of `oneof`_ ``deployment_target``. - anthos_cluster (google.cloud.deploy_v1.types.AnthosCluster): - Information specifying an Anthos Cluster. - - This field is a member of `oneof`_ ``deployment_target``. - run (google.cloud.deploy_v1.types.CloudRunLocation): - Information specifying a Cloud Run deployment - target. - - This field is a member of `oneof`_ ``deployment_target``. - etag (str): - Optional. This checksum is computed by the - server based on the value of other fields, and - may be sent on update and delete requests to - ensure the client has an up-to-date value before - proceeding. - execution_configs (Sequence[google.cloud.deploy_v1.types.ExecutionConfig]): - Configurations for all execution that relates to this - ``Target``. Each ``ExecutionEnvironmentUsage`` value may - only be used in a single configuration; using the same value - multiple times is an error. When one or more configurations - are specified, they must include the ``RENDER`` and - ``DEPLOY`` ``ExecutionEnvironmentUsage`` values. When no - configurations are specified, execution will use the default - specified in ``DefaultPool``. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - target_id = proto.Field( - proto.STRING, - number=2, - ) - uid = proto.Field( - proto.STRING, - number=3, - ) - description = proto.Field( - proto.STRING, - number=4, - ) - annotations = proto.MapField( - proto.STRING, - proto.STRING, - number=5, - ) - labels = proto.MapField( - proto.STRING, - proto.STRING, - number=6, - ) - require_approval = proto.Field( - proto.BOOL, - number=13, - ) - create_time = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - update_time = proto.Field( - proto.MESSAGE, - number=9, - message=timestamp_pb2.Timestamp, - ) - gke = proto.Field( - proto.MESSAGE, - number=15, - oneof='deployment_target', - message='GkeCluster', - ) - anthos_cluster = proto.Field( - proto.MESSAGE, - number=17, - oneof='deployment_target', - message='AnthosCluster', - ) - run = proto.Field( - proto.MESSAGE, - number=18, - oneof='deployment_target', - message='CloudRunLocation', - ) - etag = proto.Field( - proto.STRING, - number=12, - ) - execution_configs = proto.RepeatedField( - proto.MESSAGE, - number=16, - message='ExecutionConfig', - ) - - -class ExecutionConfig(proto.Message): - r"""Configuration of the environment to use when calling - Skaffold. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - usages (Sequence[google.cloud.deploy_v1.types.ExecutionConfig.ExecutionEnvironmentUsage]): - Required. Usages when this configuration - should be applied. - default_pool (google.cloud.deploy_v1.types.DefaultPool): - Optional. Use default Cloud Build pool. - - This field is a member of `oneof`_ ``execution_environment``. - private_pool (google.cloud.deploy_v1.types.PrivatePool): - Optional. Use private Cloud Build pool. - - This field is a member of `oneof`_ ``execution_environment``. - worker_pool (str): - Optional. The resource name of the ``WorkerPool``, with the - format - ``projects/{project}/locations/{location}/workerPools/{worker_pool}``. - If this optional field is unspecified, the default Cloud - Build pool will be used. - service_account (str): - Optional. Google service account to use for execution. If - unspecified, the project execution service account - (-compute@developer.gserviceaccount.com) is - used. - artifact_storage (str): - Optional. Cloud Storage location in which to - store execution outputs. This can either be a - bucket ("gs://my-bucket") or a path within a - bucket ("gs://my-bucket/my-dir"). - If unspecified, a default bucket located in the - same region will be used. - execution_timeout (google.protobuf.duration_pb2.Duration): - Optional. Execution timeout for a Cloud Build - Execution. This must be between 10m and 24h in - seconds format. If unspecified, a default - timeout of 1h is used. - """ - class ExecutionEnvironmentUsage(proto.Enum): - r"""Possible usages of this configuration.""" - EXECUTION_ENVIRONMENT_USAGE_UNSPECIFIED = 0 - RENDER = 1 - DEPLOY = 2 - VERIFY = 3 - - usages = proto.RepeatedField( - proto.ENUM, - number=1, - enum=ExecutionEnvironmentUsage, - ) - default_pool = proto.Field( - proto.MESSAGE, - number=2, - oneof='execution_environment', - message='DefaultPool', - ) - private_pool = proto.Field( - proto.MESSAGE, - number=3, - oneof='execution_environment', - message='PrivatePool', - ) - worker_pool = proto.Field( - proto.STRING, - number=4, - ) - service_account = proto.Field( - proto.STRING, - number=5, - ) - artifact_storage = proto.Field( - proto.STRING, - number=6, - ) - execution_timeout = proto.Field( - proto.MESSAGE, - number=7, - message=duration_pb2.Duration, - ) - - -class DefaultPool(proto.Message): - r"""Execution using the default Cloud Build pool. - - Attributes: - service_account (str): - Optional. Google service account to use for execution. If - unspecified, the project execution service account - (-compute@developer.gserviceaccount.com) - will be used. - artifact_storage (str): - Optional. Cloud Storage location where - execution outputs should be stored. This can - either be a bucket ("gs://my-bucket") or a path - within a bucket ("gs://my-bucket/my-dir"). - If unspecified, a default bucket located in the - same region will be used. - """ - - service_account = proto.Field( - proto.STRING, - number=1, - ) - artifact_storage = proto.Field( - proto.STRING, - number=2, - ) - - -class PrivatePool(proto.Message): - r"""Execution using a private Cloud Build pool. - - Attributes: - worker_pool (str): - Required. Resource name of the Cloud Build worker pool to - use. The format is - ``projects/{project}/locations/{location}/workerPools/{pool}``. - service_account (str): - Optional. Google service account to use for execution. If - unspecified, the project execution service account - (-compute@developer.gserviceaccount.com) - will be used. - artifact_storage (str): - Optional. Cloud Storage location where - execution outputs should be stored. This can - either be a bucket ("gs://my-bucket") or a path - within a bucket ("gs://my-bucket/my-dir"). - If unspecified, a default bucket located in the - same region will be used. - """ - - worker_pool = proto.Field( - proto.STRING, - number=1, - ) - service_account = proto.Field( - proto.STRING, - number=2, - ) - artifact_storage = proto.Field( - proto.STRING, - number=3, - ) - - -class GkeCluster(proto.Message): - r"""Information specifying a GKE Cluster. - - Attributes: - cluster (str): - Information specifying a GKE Cluster. Format is - \`projects/{project_id}/locations/{location_id}/clusters/{cluster_id}. - internal_ip (bool): - Optional. If true, ``cluster`` is accessed using the private - IP address of the control plane endpoint. Otherwise, the - default IP address of the control plane endpoint is used. - The default IP address is the private IP address for - clusters with private control-plane endpoints and the public - IP address otherwise. - - Only specify this option when ``cluster`` is a `private GKE - cluster `__. - """ - - cluster = proto.Field( - proto.STRING, - number=1, - ) - internal_ip = proto.Field( - proto.BOOL, - number=2, - ) - - -class AnthosCluster(proto.Message): - r"""Information specifying an Anthos Cluster. - - Attributes: - membership (str): - Membership of the GKE Hub-registered cluster to which to - apply the Skaffold configuration. Format is - ``projects/{project}/locations/{location}/memberships/{membership_name}``. - """ - - membership = proto.Field( - proto.STRING, - number=1, - ) - - -class CloudRunLocation(proto.Message): - r"""Information specifying where to deploy a Cloud Run Service. - - Attributes: - location (str): - Required. The location for the Cloud Run Service. Format - must be ``projects/{project}/locations/{location}``. - """ - - location = proto.Field( - proto.STRING, - number=1, - ) - - -class ListTargetsRequest(proto.Message): - r"""The request object for ``ListTargets``. - - Attributes: - parent (str): - Required. The parent, which owns this collection of targets. - Format must be - projects/{project_id}/locations/{location_name}. - page_size (int): - Optional. The maximum number of ``Target`` objects to - return. The service may return fewer than this value. If - unspecified, at most 50 ``Target`` objects will be returned. - The maximum value is 1000; values above 1000 will be set to - 1000. - page_token (str): - Optional. A page token, received from a previous - ``ListTargets`` call. Provide this to retrieve the - subsequent page. - - When paginating, all other provided parameters match the - call that provided the page token. - filter (str): - Optional. Filter targets to be returned. See - https://google.aip.dev/160 for more details. - order_by (str): - Optional. Field to sort by. See - https://google.aip.dev/132#ordering for more - details. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - order_by = proto.Field( - proto.STRING, - number=5, - ) - - -class ListTargetsResponse(proto.Message): - r"""The response object from ``ListTargets``. - - Attributes: - targets (Sequence[google.cloud.deploy_v1.types.Target]): - The ``Target`` objects. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (Sequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - targets = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Target', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - unreachable = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetTargetRequest(proto.Message): - r"""The request object for ``GetTarget``. - - Attributes: - name (str): - Required. Name of the ``Target``. Format must be - projects/{project_id}/locations/{location_name}/targets/{target_name}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateTargetRequest(proto.Message): - r"""The request object for ``CreateTarget``. - - Attributes: - parent (str): - Required. The parent collection in which the ``Target`` - should be created. Format should be - projects/{project_id}/locations/{location_name}. - target_id (str): - Required. ID of the ``Target``. - target (google.cloud.deploy_v1.types.Target): - Required. The ``Target`` to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. If set to true, the request is - validated and the user is provided with an - expected result, but no actual change is made. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - target_id = proto.Field( - proto.STRING, - number=2, - ) - target = proto.Field( - proto.MESSAGE, - number=3, - message='Target', - ) - request_id = proto.Field( - proto.STRING, - number=4, - ) - validate_only = proto.Field( - proto.BOOL, - number=5, - ) - - -class UpdateTargetRequest(proto.Message): - r"""The request object for ``UpdateTarget``. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. Field mask is used to specify the fields to be - overwritten in the Target resource by the update. The fields - specified in the update_mask are relative to the resource, - not the full request. A field will be overwritten if it is - in the mask. If the user does not provide a mask then all - fields will be overwritten. - target (google.cloud.deploy_v1.types.Target): - Required. The ``Target`` to update. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - allow_missing (bool): - Optional. If set to true, updating a ``Target`` that does - not exist will result in the creation of a new ``Target``. - validate_only (bool): - Optional. If set to true, the request is - validated and the user is provided with an - expected result, but no actual change is made. - """ - - update_mask = proto.Field( - proto.MESSAGE, - number=1, - message=field_mask_pb2.FieldMask, - ) - target = proto.Field( - proto.MESSAGE, - number=2, - message='Target', - ) - request_id = proto.Field( - proto.STRING, - number=3, - ) - allow_missing = proto.Field( - proto.BOOL, - number=4, - ) - validate_only = proto.Field( - proto.BOOL, - number=5, - ) - - -class DeleteTargetRequest(proto.Message): - r"""The request object for ``DeleteTarget``. - - Attributes: - name (str): - Required. The name of the ``Target`` to delete. Format - should be - projects/{project_id}/locations/{location_name}/targets/{target_name}. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - allow_missing (bool): - Optional. If set to true, then deleting an - already deleted or non-existing DeliveryPipeline - will succeed. - validate_only (bool): - Optional. If set, validate the request and - preview the review, but do not actually post it. - etag (str): - Optional. This checksum is computed by the - server based on the value of other fields, and - may be sent on update and delete requests to - ensure the client has an up-to-date value before - proceeding. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - request_id = proto.Field( - proto.STRING, - number=2, - ) - allow_missing = proto.Field( - proto.BOOL, - number=3, - ) - validate_only = proto.Field( - proto.BOOL, - number=4, - ) - etag = proto.Field( - proto.STRING, - number=5, - ) - - -class Release(proto.Message): - r"""A ``Release`` resource in the Google Cloud Deploy API. - - A ``Release`` defines a specific Skaffold configuration instance - that can be deployed. - - Attributes: - name (str): - Optional. Name of the ``Release``. Format is - projects/{project}/ - locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/[a-z][a-z0-9-]{0,62}. - uid (str): - Output only. Unique identifier of the ``Release``. - description (str): - Description of the ``Release``. Max length is 255 - characters. - annotations (Mapping[str, str]): - User annotations. These attributes can only - be set and used by the user, and not by Google - Cloud Deploy. See - https://google.aip.dev/128#annotations for more - details such as format and size limitations. - labels (Mapping[str, str]): - Labels are attributes that can be set and used by both the - user and by Google Cloud Deploy. Labels must meet the - following constraints: - - - Keys and values can contain only lowercase letters, - numeric characters, underscores, and dashes. - - All characters must use UTF-8 encoding, and international - characters are allowed. - - Keys must start with a lowercase letter or international - character. - - Each resource is limited to a maximum of 64 labels. - - Both keys and values are additionally constrained to be <= - 128 bytes. - abandoned (bool): - Output only. Indicates whether this is an - abandoned release. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``Release`` was created. - render_start_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the render began. - render_end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the render - completed. - skaffold_config_uri (str): - Cloud Storage URI of tar.gz archive - containing Skaffold configuration. - skaffold_config_path (str): - Filepath of the Skaffold config inside of the - config URI. - build_artifacts (Sequence[google.cloud.deploy_v1.types.BuildArtifact]): - List of artifacts to pass through to Skaffold - command. - delivery_pipeline_snapshot (google.cloud.deploy_v1.types.DeliveryPipeline): - Output only. Snapshot of the parent pipeline - taken at release creation time. - target_snapshots (Sequence[google.cloud.deploy_v1.types.Target]): - Output only. Snapshot of the targets taken at - release creation time. - render_state (google.cloud.deploy_v1.types.Release.RenderState): - Output only. Current state of the render - operation. - etag (str): - This checksum is computed by the server based - on the value of other fields, and may be sent on - update and delete requests to ensure the client - has an up-to-date value before proceeding. - skaffold_version (str): - The Skaffold version to use when operating on - this release, such as "1.20.0". Not all versions - are valid; Google Cloud Deploy supports a - specific set of versions. - - If unset, the most recent supported Skaffold - version will be used. - target_artifacts (Mapping[str, google.cloud.deploy_v1.types.TargetArtifact]): - Output only. Map from target ID to the target - artifacts created during the render operation. - target_renders (Mapping[str, google.cloud.deploy_v1.types.Release.TargetRender]): - Output only. Map from target ID to details of - the render operation for that target. - """ - class RenderState(proto.Enum): - r"""Valid states of the render operation.""" - RENDER_STATE_UNSPECIFIED = 0 - SUCCEEDED = 1 - FAILED = 2 - IN_PROGRESS = 3 - - class TargetRender(proto.Message): - r"""Details of rendering for a single target. - - Attributes: - rendering_build (str): - Output only. The resource name of the Cloud Build ``Build`` - object that is used to render the manifest for this target. - Format is - ``projects/{project}/locations/{location}/builds/{build}``. - rendering_state (google.cloud.deploy_v1.types.Release.TargetRender.TargetRenderState): - Output only. Current state of the render - operation for this Target. - failure_cause (google.cloud.deploy_v1.types.Release.TargetRender.FailureCause): - Output only. Reason this render failed. This - will always be unspecified while the render in - progress. - failure_message (str): - Output only. Additional information about the - render failure, if available. - """ - class TargetRenderState(proto.Enum): - r"""Valid states of the render operation.""" - TARGET_RENDER_STATE_UNSPECIFIED = 0 - SUCCEEDED = 1 - FAILED = 2 - IN_PROGRESS = 3 - - class FailureCause(proto.Enum): - r"""Well-known rendering failures.""" - FAILURE_CAUSE_UNSPECIFIED = 0 - CLOUD_BUILD_UNAVAILABLE = 1 - EXECUTION_FAILED = 2 - - rendering_build = proto.Field( - proto.STRING, - number=1, - ) - rendering_state = proto.Field( - proto.ENUM, - number=2, - enum='Release.TargetRender.TargetRenderState', - ) - failure_cause = proto.Field( - proto.ENUM, - number=4, - enum='Release.TargetRender.FailureCause', - ) - failure_message = proto.Field( - proto.STRING, - number=5, - ) - - name = proto.Field( - proto.STRING, - number=1, - ) - uid = proto.Field( - proto.STRING, - number=2, - ) - description = proto.Field( - proto.STRING, - number=3, - ) - annotations = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - labels = proto.MapField( - proto.STRING, - proto.STRING, - number=5, - ) - abandoned = proto.Field( - proto.BOOL, - number=23, - ) - create_time = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - render_start_time = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - render_end_time = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - skaffold_config_uri = proto.Field( - proto.STRING, - number=17, - ) - skaffold_config_path = proto.Field( - proto.STRING, - number=9, - ) - build_artifacts = proto.RepeatedField( - proto.MESSAGE, - number=10, - message='BuildArtifact', - ) - delivery_pipeline_snapshot = proto.Field( - proto.MESSAGE, - number=11, - message='DeliveryPipeline', - ) - target_snapshots = proto.RepeatedField( - proto.MESSAGE, - number=12, - message='Target', - ) - render_state = proto.Field( - proto.ENUM, - number=13, - enum=RenderState, - ) - etag = proto.Field( - proto.STRING, - number=16, - ) - skaffold_version = proto.Field( - proto.STRING, - number=19, - ) - target_artifacts = proto.MapField( - proto.STRING, - proto.MESSAGE, - number=20, - message='TargetArtifact', - ) - target_renders = proto.MapField( - proto.STRING, - proto.MESSAGE, - number=22, - message=TargetRender, - ) - - -class BuildArtifact(proto.Message): - r"""Description of an a image to use during Skaffold rendering. - - Attributes: - image (str): - Image name in Skaffold configuration. - tag (str): - Image tag to use. This will generally be the - full path to an image, such as - "gcr.io/my-project/busybox:1.2.3" or - "gcr.io/my-project/busybox@sha256:abc123". - """ - - image = proto.Field( - proto.STRING, - number=3, - ) - tag = proto.Field( - proto.STRING, - number=2, - ) - - -class TargetArtifact(proto.Message): - r"""The artifacts produced by a target render operation. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - artifact_uri (str): - Output only. URI of a directory containing - the artifacts. This contains deployment - configuration used by Skaffold during a rollout, - and all paths are relative to this location. - - This field is a member of `oneof`_ ``uri``. - skaffold_config_path (str): - Output only. File path of the resolved - Skaffold configuration relative to the URI. - manifest_path (str): - Output only. File path of the rendered - manifest relative to the URI. - """ - - artifact_uri = proto.Field( - proto.STRING, - number=4, - oneof='uri', - ) - skaffold_config_path = proto.Field( - proto.STRING, - number=2, - ) - manifest_path = proto.Field( - proto.STRING, - number=3, - ) - - -class ListReleasesRequest(proto.Message): - r"""The request object for ``ListReleases``. - - Attributes: - parent (str): - Required. The ``DeliveryPipeline`` which owns this - collection of ``Release`` objects. - page_size (int): - Optional. The maximum number of ``Release`` objects to - return. The service may return fewer than this value. If - unspecified, at most 50 ``Release`` objects will be - returned. The maximum value is 1000; values above 1000 will - be set to 1000. - page_token (str): - Optional. A page token, received from a previous - ``ListReleases`` call. Provide this to retrieve the - subsequent page. - - When paginating, all other provided parameters match the - call that provided the page token. - filter (str): - Optional. Filter releases to be returned. See - https://google.aip.dev/160 for more details. - order_by (str): - Optional. Field to sort by. See - https://google.aip.dev/132#ordering for more - details. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - order_by = proto.Field( - proto.STRING, - number=5, - ) - - -class ListReleasesResponse(proto.Message): - r"""The response object from ``ListReleases``. - - Attributes: - releases (Sequence[google.cloud.deploy_v1.types.Release]): - The ``Release`` objects. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (Sequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - releases = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Release', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - unreachable = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetReleaseRequest(proto.Message): - r"""The request object for ``GetRelease``. - - Attributes: - name (str): - Required. Name of the ``Release``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateReleaseRequest(proto.Message): - r"""The request object for ``CreateRelease``, - - Attributes: - parent (str): - Required. The parent collection in which the ``Release`` - should be created. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}. - release_id (str): - Required. ID of the ``Release``. - release (google.cloud.deploy_v1.types.Release): - Required. The ``Release`` to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. If set to true, the request is - validated and the user is provided with an - expected result, but no actual change is made. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - release_id = proto.Field( - proto.STRING, - number=2, - ) - release = proto.Field( - proto.MESSAGE, - number=3, - message='Release', - ) - request_id = proto.Field( - proto.STRING, - number=4, - ) - validate_only = proto.Field( - proto.BOOL, - number=5, - ) - - -class Rollout(proto.Message): - r"""A ``Rollout`` resource in the Google Cloud Deploy API. - - A ``Rollout`` contains information around a specific deployment to a - ``Target``. - - Attributes: - name (str): - Optional. Name of the ``Rollout``. Format is - projects/{project}/ - locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}/rollouts/[a-z][a-z0-9-]{0,62}. - uid (str): - Output only. Unique identifier of the ``Rollout``. - description (str): - Description of the ``Rollout`` for user purposes. Max length - is 255 characters. - annotations (Mapping[str, str]): - User annotations. These attributes can only - be set and used by the user, and not by Google - Cloud Deploy. See - https://google.aip.dev/128#annotations for more - details such as format and size limitations. - labels (Mapping[str, str]): - Labels are attributes that can be set and used by both the - user and by Google Cloud Deploy. Labels must meet the - following constraints: - - - Keys and values can contain only lowercase letters, - numeric characters, underscores, and dashes. - - All characters must use UTF-8 encoding, and international - characters are allowed. - - Keys must start with a lowercase letter or international - character. - - Each resource is limited to a maximum of 64 labels. - - Both keys and values are additionally constrained to be <= - 128 bytes. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``Rollout`` was created. - approve_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``Rollout`` was approved. - enqueue_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``Rollout`` was enqueued. - deploy_start_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``Rollout`` started - deploying. - deploy_end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``Rollout`` finished - deploying. - target_id (str): - Required. The ID of Target to which this ``Rollout`` is - deploying. - approval_state (google.cloud.deploy_v1.types.Rollout.ApprovalState): - Output only. Approval state of the ``Rollout``. - state (google.cloud.deploy_v1.types.Rollout.State): - Output only. Current state of the ``Rollout``. - failure_reason (str): - Output only. Additional information about the - rollout failure, if available. - deploying_build (str): - Output only. The resource name of the Cloud Build ``Build`` - object that is used to deploy the Rollout. Format is - ``projects/{project}/locations/{location}/builds/{build}``. - etag (str): - This checksum is computed by the server based - on the value of other fields, and may be sent on - update and delete requests to ensure the client - has an up-to-date value before proceeding. - deploy_failure_cause (google.cloud.deploy_v1.types.Rollout.FailureCause): - Output only. The reason this rollout failed. - This will always be unspecified while the - rollout is in progress. - phases (Sequence[google.cloud.deploy_v1.types.Phase]): - Output only. The phases that represent the workflows of this - ``Rollout``. - metadata (google.cloud.deploy_v1.types.Metadata): - Output only. Metadata contains information - about the rollout. - """ - class ApprovalState(proto.Enum): - r"""Valid approval states of a ``Rollout``.""" - APPROVAL_STATE_UNSPECIFIED = 0 - NEEDS_APPROVAL = 1 - DOES_NOT_NEED_APPROVAL = 2 - APPROVED = 3 - REJECTED = 4 - - class State(proto.Enum): - r"""Valid states of a ``Rollout``.""" - STATE_UNSPECIFIED = 0 - SUCCEEDED = 1 - FAILED = 2 - IN_PROGRESS = 3 - PENDING_APPROVAL = 4 - APPROVAL_REJECTED = 5 - PENDING = 6 - PENDING_RELEASE = 7 - - class FailureCause(proto.Enum): - r"""Well-known rollout failures.""" - FAILURE_CAUSE_UNSPECIFIED = 0 - CLOUD_BUILD_UNAVAILABLE = 1 - EXECUTION_FAILED = 2 - DEADLINE_EXCEEDED = 3 - RELEASE_FAILED = 4 - RELEASE_ABANDONED = 5 - VERIFICATION_CONFIG_NOT_FOUND = 6 - - name = proto.Field( - proto.STRING, - number=1, - ) - uid = proto.Field( - proto.STRING, - number=2, - ) - description = proto.Field( - proto.STRING, - number=3, - ) - annotations = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - labels = proto.MapField( - proto.STRING, - proto.STRING, - number=5, - ) - create_time = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - approve_time = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - enqueue_time = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - deploy_start_time = proto.Field( - proto.MESSAGE, - number=9, - message=timestamp_pb2.Timestamp, - ) - deploy_end_time = proto.Field( - proto.MESSAGE, - number=10, - message=timestamp_pb2.Timestamp, - ) - target_id = proto.Field( - proto.STRING, - number=18, - ) - approval_state = proto.Field( - proto.ENUM, - number=12, - enum=ApprovalState, - ) - state = proto.Field( - proto.ENUM, - number=13, - enum=State, - ) - failure_reason = proto.Field( - proto.STRING, - number=14, - ) - deploying_build = proto.Field( - proto.STRING, - number=17, - ) - etag = proto.Field( - proto.STRING, - number=16, - ) - deploy_failure_cause = proto.Field( - proto.ENUM, - number=19, - enum=FailureCause, - ) - phases = proto.RepeatedField( - proto.MESSAGE, - number=23, - message='Phase', - ) - metadata = proto.Field( - proto.MESSAGE, - number=24, - message='Metadata', - ) - - -class Metadata(proto.Message): - r"""Metadata includes information associated with a ``Rollout``. - - Attributes: - cloud_run (google.cloud.deploy_v1.types.CloudRunMetadata): - Output only. The name of the Cloud Run Service that is - associated with a ``Rollout``. - """ - - cloud_run = proto.Field( - proto.MESSAGE, - number=1, - message='CloudRunMetadata', - ) - - -class DeployJobRunMetadata(proto.Message): - r"""DeployJobRunMetadata surfaces information associated with a - ``DeployJobRun`` to the user. - - Attributes: - cloud_run (google.cloud.deploy_v1.types.CloudRunMetadata): - Output only. The name of the Cloud Run Service that is - associated with a ``DeployJobRun``. - """ - - cloud_run = proto.Field( - proto.MESSAGE, - number=1, - message='CloudRunMetadata', - ) - - -class CloudRunMetadata(proto.Message): - r"""CloudRunMetadata contains information from a Cloud Run - deployment. - - Attributes: - service (str): - Output only. The name of the Cloud Run Service that is - associated with a ``Rollout``. Format is - projects/{project}/locations/{location}/services/{service}. - service_urls (Sequence[str]): - Output only. The Cloud Run Service urls that are associated - with a ``Rollout``. - revision (str): - Output only. The Cloud Run Revision id associated with a - ``Rollout``. - """ - - service = proto.Field( - proto.STRING, - number=1, - ) - service_urls = proto.RepeatedField( - proto.STRING, - number=2, - ) - revision = proto.Field( - proto.STRING, - number=3, - ) - - -class Phase(proto.Message): - r"""Phase represents a collection of jobs that are logically grouped - together for a ``Rollout``. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - id (str): - Output only. The ID of the Phase. - state (google.cloud.deploy_v1.types.Phase.State): - Output only. Current state of the Phase. - deployment_jobs (google.cloud.deploy_v1.types.DeploymentJobs): - Output only. Deployment job composition. - - This field is a member of `oneof`_ ``jobs``. - """ - class State(proto.Enum): - r"""Valid states of a Phase.""" - STATE_UNSPECIFIED = 0 - PENDING = 1 - IN_PROGRESS = 2 - SUCCEEDED = 3 - FAILED = 4 - ABORTED = 5 - - id = proto.Field( - proto.STRING, - number=1, - ) - state = proto.Field( - proto.ENUM, - number=3, - enum=State, - ) - deployment_jobs = proto.Field( - proto.MESSAGE, - number=4, - oneof='jobs', - message='DeploymentJobs', - ) - - -class DeploymentJobs(proto.Message): - r"""Deployment job composition. - - Attributes: - deploy_job (google.cloud.deploy_v1.types.Job): - Output only. The deploy Job. This is the - first job run in the phase. - verify_job (google.cloud.deploy_v1.types.Job): - Output only. The verify Job. Runs after a - deploy if the deploy succeeds. - """ - - deploy_job = proto.Field( - proto.MESSAGE, - number=1, - message='Job', - ) - verify_job = proto.Field( - proto.MESSAGE, - number=2, - message='Job', - ) - - -class Job(proto.Message): - r"""Job represents an operation for a ``Rollout``. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - id (str): - Output only. The ID of the Job. - state (google.cloud.deploy_v1.types.Job.State): - Output only. The current state of the Job. - job_run (str): - Output only. The name of the ``JobRun`` responsible for the - most recent invocation of this Job. - deploy_job (google.cloud.deploy_v1.types.DeployJob): - Output only. A deploy Job. - - This field is a member of `oneof`_ ``job_type``. - verify_job (google.cloud.deploy_v1.types.VerifyJob): - Output only. A verify Job. - - This field is a member of `oneof`_ ``job_type``. - """ - class State(proto.Enum): - r"""Valid states of a Job.""" - STATE_UNSPECIFIED = 0 - PENDING = 1 - DISABLED = 2 - IN_PROGRESS = 3 - SUCCEEDED = 4 - FAILED = 5 - ABORTED = 6 - - id = proto.Field( - proto.STRING, - number=1, - ) - state = proto.Field( - proto.ENUM, - number=2, - enum=State, - ) - job_run = proto.Field( - proto.STRING, - number=3, - ) - deploy_job = proto.Field( - proto.MESSAGE, - number=4, - oneof='job_type', - message='DeployJob', - ) - verify_job = proto.Field( - proto.MESSAGE, - number=5, - oneof='job_type', - message='VerifyJob', - ) - - -class DeployJob(proto.Message): - r"""A deploy Job. - """ - - -class VerifyJob(proto.Message): - r"""A verify Job. - """ - - -class ListRolloutsRequest(proto.Message): - r"""ListRolloutsRequest is the request object used by ``ListRollouts``. - - Attributes: - parent (str): - Required. The ``Release`` which owns this collection of - ``Rollout`` objects. - page_size (int): - Optional. The maximum number of ``Rollout`` objects to - return. The service may return fewer than this value. If - unspecified, at most 50 ``Rollout`` objects will be - returned. The maximum value is 1000; values above 1000 will - be set to 1000. - page_token (str): - Optional. A page token, received from a previous - ``ListRollouts`` call. Provide this to retrieve the - subsequent page. - - When paginating, all other provided parameters match the - call that provided the page token. - filter (str): - Optional. Filter rollouts to be returned. See - https://google.aip.dev/160 for more details. - order_by (str): - Optional. Field to sort by. See - https://google.aip.dev/132#ordering for more - details. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - order_by = proto.Field( - proto.STRING, - number=5, - ) - - -class ListRolloutsResponse(proto.Message): - r"""ListRolloutsResponse is the response object reutrned by - ``ListRollouts``. - - Attributes: - rollouts (Sequence[google.cloud.deploy_v1.types.Rollout]): - The ``Rollout`` objects. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (Sequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - rollouts = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Rollout', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - unreachable = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetRolloutRequest(proto.Message): - r"""GetRolloutRequest is the request object used by ``GetRollout``. - - Attributes: - name (str): - Required. Name of the ``Rollout``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateRolloutRequest(proto.Message): - r"""CreateRolloutRequest is the request object used by - ``CreateRollout``. - - Attributes: - parent (str): - Required. The parent collection in which the ``Rollout`` - should be created. Format should be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}. - rollout_id (str): - Required. ID of the ``Rollout``. - rollout (google.cloud.deploy_v1.types.Rollout): - Required. The ``Rollout`` to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. If set to true, the request is - validated and the user is provided with an - expected result, but no actual change is made. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - rollout_id = proto.Field( - proto.STRING, - number=2, - ) - rollout = proto.Field( - proto.MESSAGE, - number=3, - message='Rollout', - ) - request_id = proto.Field( - proto.STRING, - number=4, - ) - validate_only = proto.Field( - proto.BOOL, - number=5, - ) - - -class OperationMetadata(proto.Message): - r"""Represents the metadata of the long-running operation. - - Attributes: - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation was - created. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation finished - running. - target (str): - Output only. Server-defined resource path for - the target of the operation. - verb (str): - Output only. Name of the verb executed by the - operation. - status_message (str): - Output only. Human-readable status of the - operation, if any. - requested_cancellation (bool): - Output only. Identifies whether the user has requested - cancellation of the operation. Operations that have - successfully been cancelled have [Operation.error][] value - with a [google.rpc.Status.code][google.rpc.Status.code] of - 1, corresponding to ``Code.CANCELLED``. - api_version (str): - Output only. API version used to start the - operation. - """ - - create_time = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - end_time = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - target = proto.Field( - proto.STRING, - number=3, - ) - verb = proto.Field( - proto.STRING, - number=4, - ) - status_message = proto.Field( - proto.STRING, - number=5, - ) - requested_cancellation = proto.Field( - proto.BOOL, - number=6, - ) - api_version = proto.Field( - proto.STRING, - number=7, - ) - - -class ApproveRolloutRequest(proto.Message): - r"""The request object used by ``ApproveRollout``. - - Attributes: - name (str): - Required. Name of the Rollout. Format is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}/rollouts/{rollout}. - approved (bool): - Required. True = approve; false = reject - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - approved = proto.Field( - proto.BOOL, - number=2, - ) - - -class ApproveRolloutResponse(proto.Message): - r"""The response object from ``ApproveRollout``. - """ - - -class RetryJobRequest(proto.Message): - r"""RetryJobRequest is the request object used by ``RetryJob``. - - Attributes: - rollout (str): - Required. Name of the Rollout. Format is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}/rollouts/{rollout}. - phase_id (str): - Required. The phase ID the Job to retry - belongs to. - job_id (str): - Required. The job ID for the Job to retry. - """ - - rollout = proto.Field( - proto.STRING, - number=1, - ) - phase_id = proto.Field( - proto.STRING, - number=2, - ) - job_id = proto.Field( - proto.STRING, - number=3, - ) - - -class RetryJobResponse(proto.Message): - r"""The response object from 'RetryJob'. - """ - - -class AbandonReleaseRequest(proto.Message): - r"""The request object used by ``AbandonRelease``. - - Attributes: - name (str): - Required. Name of the Release. Format is - projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/ - releases/{release}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class AbandonReleaseResponse(proto.Message): - r"""The response object for ``AbandonRelease``. - """ - - -class JobRun(proto.Message): - r"""A ``JobRun`` resource in the Google Cloud Deploy API. - - A ``JobRun`` contains information of a single ``Rollout`` job - evaluation. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Optional. Name of the ``JobRun``. Format is - projects/{project}/locations/{location}/ - deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/ - {rollouts}/jobRuns/{uuid}. - uid (str): - Output only. Unique identifier of the ``JobRun``. - phase_id (str): - Output only. ID of the ``Rollout`` phase this ``JobRun`` - belongs in. - job_id (str): - Output only. ID of the ``Rollout`` job this ``JobRun`` - corresponds to. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``JobRun`` was created. - start_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``JobRun`` was started. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time at which the ``JobRun`` ended. - state (google.cloud.deploy_v1.types.JobRun.State): - Output only. The current state of the ``JobRun``. - deploy_job_run (google.cloud.deploy_v1.types.DeployJobRun): - Output only. Information specific to a deploy ``JobRun``. - - This field is a member of `oneof`_ ``job_run``. - verify_job_run (google.cloud.deploy_v1.types.VerifyJobRun): - Output only. Information specific to a verify ``JobRun``. - - This field is a member of `oneof`_ ``job_run``. - etag (str): - Output only. This checksum is computed by the - server based on the value of other fields, and - may be sent on update and delete requests to - ensure the client has an up-to-date value before - proceeding. - """ - class State(proto.Enum): - r"""Valid states of a ``JobRun``.""" - STATE_UNSPECIFIED = 0 - IN_PROGRESS = 1 - SUCCEEDED = 2 - FAILED = 3 - - name = proto.Field( - proto.STRING, - number=1, - ) - uid = proto.Field( - proto.STRING, - number=2, - ) - phase_id = proto.Field( - proto.STRING, - number=3, - ) - job_id = proto.Field( - proto.STRING, - number=4, - ) - create_time = proto.Field( - proto.MESSAGE, - number=5, - message=timestamp_pb2.Timestamp, - ) - start_time = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - end_time = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - state = proto.Field( - proto.ENUM, - number=8, - enum=State, - ) - deploy_job_run = proto.Field( - proto.MESSAGE, - number=9, - oneof='job_run', - message='DeployJobRun', - ) - verify_job_run = proto.Field( - proto.MESSAGE, - number=10, - oneof='job_run', - message='VerifyJobRun', - ) - etag = proto.Field( - proto.STRING, - number=11, - ) - - -class DeployJobRun(proto.Message): - r"""DeployJobRun contains information specific to a deploy ``JobRun``. - - Attributes: - build (str): - Output only. The resource name of the Cloud Build ``Build`` - object that is used to deploy. Format is - projects/{project}/locations/{location}/builds/{build}. - failure_cause (google.cloud.deploy_v1.types.DeployJobRun.FailureCause): - Output only. The reason the deploy failed. - This will always be unspecified while the deploy - is in progress or if it succeeded. - failure_message (str): - Output only. Additional information about the - deploy failure, if available. - metadata (google.cloud.deploy_v1.types.DeployJobRunMetadata): - Output only. Metadata containing information - about the deploy job run. - """ - class FailureCause(proto.Enum): - r"""Well-known deploy failures.""" - FAILURE_CAUSE_UNSPECIFIED = 0 - CLOUD_BUILD_UNAVAILABLE = 1 - EXECUTION_FAILED = 2 - DEADLINE_EXCEEDED = 3 - - build = proto.Field( - proto.STRING, - number=1, - ) - failure_cause = proto.Field( - proto.ENUM, - number=2, - enum=FailureCause, - ) - failure_message = proto.Field( - proto.STRING, - number=3, - ) - metadata = proto.Field( - proto.MESSAGE, - number=4, - message='DeployJobRunMetadata', - ) - - -class VerifyJobRun(proto.Message): - r"""VerifyJobRun contains information specific to a verify ``JobRun``. - - Attributes: - build (str): - Output only. The resource name of the Cloud Build ``Build`` - object that is used to verify. Format is - projects/{project}/locations/{location}/builds/{build}. - artifact_uri (str): - Output only. URI of a directory containing - the verify artifacts. This contains the Skaffold - event log. - event_log_path (str): - Output only. File path of the Skaffold event - log relative to the artifact URI. - failure_cause (google.cloud.deploy_v1.types.VerifyJobRun.FailureCause): - Output only. The reason the verify failed. - This will always be unspecified while the verify - is in progress or if it succeeded. - failure_message (str): - Output only. Additional information about the - verify failure, if available. - """ - class FailureCause(proto.Enum): - r"""Well-known verify failures.""" - FAILURE_CAUSE_UNSPECIFIED = 0 - CLOUD_BUILD_UNAVAILABLE = 1 - EXECUTION_FAILED = 2 - DEADLINE_EXCEEDED = 3 - VERIFICATION_CONFIG_NOT_FOUND = 4 - - build = proto.Field( - proto.STRING, - number=1, - ) - artifact_uri = proto.Field( - proto.STRING, - number=2, - ) - event_log_path = proto.Field( - proto.STRING, - number=3, - ) - failure_cause = proto.Field( - proto.ENUM, - number=4, - enum=FailureCause, - ) - failure_message = proto.Field( - proto.STRING, - number=5, - ) - - -class ListJobRunsRequest(proto.Message): - r"""ListJobRunsRequest is the request object used by ``ListJobRuns``. - - Attributes: - parent (str): - Required. The ``Rollout`` which owns this collection of - ``JobRun`` objects. - page_size (int): - Optional. The maximum number of ``JobRun`` objects to - return. The service may return fewer than this value. If - unspecified, at most 50 ``JobRun`` objects will be returned. - The maximum value is 1000; values above 1000 will be set to - 1000. - page_token (str): - Optional. A page token, received from a previous - ``ListJobRuns`` call. Provide this to retrieve the - subsequent page. - - When paginating, all other provided parameters match the - call that provided the page token. - filter (str): - Optional. Filter results to be returned. See - https://google.aip.dev/160 for more details. - order_by (str): - Optional. Field to sort by. See - https://google.aip.dev/132#ordering for more - details. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - order_by = proto.Field( - proto.STRING, - number=5, - ) - - -class ListJobRunsResponse(proto.Message): - r"""ListJobRunsResponse is the response object returned by - ``ListJobRuns``. - - Attributes: - job_runs (Sequence[google.cloud.deploy_v1.types.JobRun]): - The ``JobRun`` objects. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (Sequence[str]): - Locations that could not be reached - """ - - @property - def raw_page(self): - return self - - job_runs = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='JobRun', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - unreachable = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetJobRunRequest(proto.Message): - r"""GetJobRunRequest is the request object used by ``GetJobRun``. - - Attributes: - name (str): - Required. Name of the ``JobRun``. Format must be - projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class Config(proto.Message): - r"""Service-wide configuration. - - Attributes: - name (str): - Name of the configuration. - supported_versions (Sequence[google.cloud.deploy_v1.types.SkaffoldVersion]): - Output only. All supported versions of - Skaffold. - default_skaffold_version (str): - Output only. Default Skaffold version that is - assigned when a Release is created without - specifying a Skaffold version. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - supported_versions = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='SkaffoldVersion', - ) - default_skaffold_version = proto.Field( - proto.STRING, - number=3, - ) - - -class SkaffoldVersion(proto.Message): - r"""Details of a supported Skaffold version. - - Attributes: - version (str): - Release version number. For example, - "1.20.3". - support_end_date (google.type.date_pb2.Date): - Date when this version is expected to no - longer be supported. - """ - - version = proto.Field( - proto.STRING, - number=1, - ) - support_end_date = proto.Field( - proto.MESSAGE, - number=2, - message=date_pb2.Date, - ) - - -class GetConfigRequest(proto.Message): - r"""Request to get a configuration. - - Attributes: - name (str): - Required. Name of requested configuration. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py deleted file mode 100644 index f8ab52b..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/deliverypipeline_notification_payload.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.deploy_v1.types import log_enums - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'DeliveryPipelineNotificationEvent', - }, -) - - -class DeliveryPipelineNotificationEvent(proto.Message): - r"""Payload proto for - "clouddeploy.googleapis.com/deliverypipeline_notification" Platform - Log event that describes the failure to send delivery pipeline - status change Pub/Sub notification. - - Attributes: - message (str): - Debug message for when a notification fails - to send. - delivery_pipeline (str): - The name of the ``Delivery Pipeline``. - type_ (google.cloud.deploy_v1.types.Type): - Type of this notification, e.g. for a Pub/Sub - failure. - """ - - message = proto.Field( - proto.STRING, - number=1, - ) - delivery_pipeline = proto.Field( - proto.STRING, - number=2, - ) - type_ = proto.Field( - proto.ENUM, - number=3, - enum=log_enums.Type, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py deleted file mode 100644 index e645039..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/jobrun_notification_payload.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.deploy_v1.types import log_enums - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'JobRunNotificationEvent', - }, -) - - -class JobRunNotificationEvent(proto.Message): - r"""Payload proto for "clouddeploy.googleapis.com/jobrun_notification" - Platform Log event that describes the failure to send JobRun - resource update Pub/Sub notification. - - Attributes: - message (str): - Debug message for when a notification fails - to send. - job_run (str): - The name of the ``JobRun``. - pipeline_uid (str): - Unique identifier of the ``DeliveryPipeline``. - release_uid (str): - Unique identifier of the ``Release``. - rollout_uid (str): - Unique identifier of the ``Rollout``. - target_id (str): - ID of the ``Target``. - type_ (google.cloud.deploy_v1.types.Type): - Type of this notification, e.g. for a Pub/Sub - failure. - """ - - message = proto.Field( - proto.STRING, - number=1, - ) - job_run = proto.Field( - proto.STRING, - number=2, - ) - pipeline_uid = proto.Field( - proto.STRING, - number=3, - ) - release_uid = proto.Field( - proto.STRING, - number=4, - ) - rollout_uid = proto.Field( - proto.STRING, - number=5, - ) - target_id = proto.Field( - proto.STRING, - number=6, - ) - type_ = proto.Field( - proto.ENUM, - number=7, - enum=log_enums.Type, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py deleted file mode 100644 index ba4f410..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/log_enums.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'Type', - }, -) - - -class Type(proto.Enum): - r"""Type indicates the type of the log entry and can be used as a - filter. - """ - TYPE_UNSPECIFIED = 0 - TYPE_PUBSUB_NOTIFICATION_FAILURE = 1 - TYPE_RENDER_STATUES_CHANGE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py deleted file mode 100644 index fec3657..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_notification_payload.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.deploy_v1.types import log_enums - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'ReleaseNotificationEvent', - }, -) - - -class ReleaseNotificationEvent(proto.Message): - r"""Payload proto for "clouddeploy.googleapis.com/release_notification" - Platform Log event that describes the failure to send release status - change Pub/Sub notification. - - Attributes: - message (str): - Debug message for when a notification fails - to send. - release (str): - The name of the ``Release``. - type_ (google.cloud.deploy_v1.types.Type): - Type of this notification, e.g. for a Pub/Sub - failure. - """ - - message = proto.Field( - proto.STRING, - number=1, - ) - release = proto.Field( - proto.STRING, - number=2, - ) - type_ = proto.Field( - proto.ENUM, - number=3, - enum=log_enums.Type, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py deleted file mode 100644 index 88ceff5..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/release_render_payload.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'ReleaseRenderEvent', - }, -) - - -class ReleaseRenderEvent(proto.Message): - r"""Payload proto for "clouddeploy.googleapis.com/release_render" - Platform Log event that describes the render status change. - - Attributes: - message (str): - Debug message for when a render transition - occurs. Provides further details as rendering - progresses through render states. - release (str): - The name of the ``Release``. - """ - - message = proto.Field( - proto.STRING, - number=1, - ) - release = proto.Field( - proto.STRING, - number=2, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py deleted file mode 100644 index 278f53a..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/rollout_notification_payload.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.deploy_v1.types import log_enums - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'RolloutNotificationEvent', - }, -) - - -class RolloutNotificationEvent(proto.Message): - r"""Payload proto for "clouddeploy.googleapis.com/rollout_notification" - Platform Log event that describes the failure to send rollout status - change Pub/Sub notification. - - Attributes: - message (str): - Debug message for when a notification fails - to send. - pipeline_uid (str): - Unique identifier of the ``DeliveryPipeline``. - release_uid (str): - Unique identifier of the ``Release``. - rollout (str): - The name of the ``Rollout``. - type_ (google.cloud.deploy_v1.types.Type): - Type of this notification, e.g. for a Pub/Sub - failure. - target_id (str): - ID of the ``Target`` that the rollout is deployed to. - """ - - message = proto.Field( - proto.STRING, - number=1, - ) - pipeline_uid = proto.Field( - proto.STRING, - number=2, - ) - release_uid = proto.Field( - proto.STRING, - number=3, - ) - rollout = proto.Field( - proto.STRING, - number=4, - ) - type_ = proto.Field( - proto.ENUM, - number=5, - enum=log_enums.Type, - ) - target_id = proto.Field( - proto.STRING, - number=6, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py b/owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py deleted file mode 100644 index 62d3ef1..0000000 --- a/owl-bot-staging/v1/google/cloud/deploy_v1/types/target_notification_payload.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.deploy_v1.types import log_enums - - -__protobuf__ = proto.module( - package='google.cloud.deploy.v1', - manifest={ - 'TargetNotificationEvent', - }, -) - - -class TargetNotificationEvent(proto.Message): - r"""Payload proto for "clouddeploy.googleapis.com/target_notification" - Platform Log event that describes the failure to send target status - change Pub/Sub notification. - - Attributes: - message (str): - Debug message for when a notification fails - to send. - target (str): - The name of the ``Target``. - type_ (google.cloud.deploy_v1.types.Type): - Type of this notification, e.g. for a Pub/Sub - failure. - """ - - message = proto.Field( - proto.STRING, - number=1, - ) - target = proto.Field( - proto.STRING, - number=2, - ) - type_ = proto.Field( - proto.ENUM, - number=3, - enum=log_enums.Type, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini deleted file mode 100644 index 574c5ae..0000000 --- a/owl-bot-staging/v1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py deleted file mode 100644 index 16ee5a2..0000000 --- a/owl-bot-staging/v1/noxfile.py +++ /dev/null @@ -1,179 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import pathlib -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.10" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "lint_setup_py", -] - -@nox.session(python=ALL_PYTHON) -def unit(session): - """Run the unit test suite.""" - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.') - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/deploy_v1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)) - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def cover(session): - """Run the final coverage report. - This outputs the coverage report aggregating coverage from the unit - test runs (not system test runs), and then erases coverage data. - """ - session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") - - session.run("coverage", "erase") - - -@nox.session(python=ALL_PYTHON) -def mypy(session): - """Run the type checker.""" - session.install('mypy', 'types-pkg_resources') - session.install('.') - session.run( - 'mypy', - '--explicit-package-bases', - 'google', - ) - - -@nox.session -def update_lower_bounds(session): - """Update lower bounds in constraints.txt to match setup.py""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'update', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - - -@nox.session -def check_lower_bounds(session): - """Check lower bounds in setup.py are reflected in constraints file""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'check', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def docs(session): - """Build the docs for this library.""" - - session.install("-e", ".") - session.install("sphinx==4.0.1", "alabaster", "recommonmark") - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-W", # warnings as errors - "-T", # show full traceback on exception - "-N", # no colors - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint(session): - """Run linters. - - Returns a failure if the linters find linting errors or sufficiently - serious code quality issues. - """ - session.install("flake8", BLACK_VERSION) - session.run( - "black", - "--check", - *BLACK_PATHS, - ) - session.run("flake8", "google", "tests", "samples") - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def blacken(session): - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - session.run( - "black", - *BLACK_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") - session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py deleted file mode 100644 index b010d9f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AbandonRelease -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_AbandonRelease_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_abandon_release(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.AbandonReleaseRequest( - name="name_value", - ) - - # Make the request - response = await client.abandon_release(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_AbandonRelease_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py deleted file mode 100644 index 8ea56be..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AbandonRelease -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_AbandonRelease_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_abandon_release(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.AbandonReleaseRequest( - name="name_value", - ) - - # Make the request - response = client.abandon_release(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_AbandonRelease_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py deleted file mode 100644 index 29c49c1..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ApproveRollout -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ApproveRollout_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_approve_rollout(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ApproveRolloutRequest( - name="name_value", - approved=True, - ) - - # Make the request - response = await client.approve_rollout(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ApproveRollout_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py deleted file mode 100644 index fa4d05f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ApproveRollout -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ApproveRollout_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_approve_rollout(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ApproveRolloutRequest( - name="name_value", - approved=True, - ) - - # Make the request - response = client.approve_rollout(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ApproveRollout_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py deleted file mode 100644 index 64b719d..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_create_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.CreateDeliveryPipelineRequest( - parent="parent_value", - delivery_pipeline_id="delivery_pipeline_id_value", - ) - - # Make the request - operation = client.create_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py deleted file mode 100644 index 142679f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_create_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.CreateDeliveryPipelineRequest( - parent="parent_value", - delivery_pipeline_id="delivery_pipeline_id_value", - ) - - # Make the request - operation = client.create_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py deleted file mode 100644 index f67e10f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRelease -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateRelease_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_create_release(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.CreateReleaseRequest( - parent="parent_value", - release_id="release_id_value", - ) - - # Make the request - operation = client.create_release(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateRelease_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py deleted file mode 100644 index 7898ed3..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRelease -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateRelease_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_create_release(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.CreateReleaseRequest( - parent="parent_value", - release_id="release_id_value", - ) - - # Make the request - operation = client.create_release(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateRelease_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py deleted file mode 100644 index e597f88..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRollout -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateRollout_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_create_rollout(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - rollout = deploy_v1.Rollout() - rollout.target_id = "target_id_value" - - request = deploy_v1.CreateRolloutRequest( - parent="parent_value", - rollout_id="rollout_id_value", - rollout=rollout, - ) - - # Make the request - operation = client.create_rollout(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateRollout_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py deleted file mode 100644 index 544ff1f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRollout -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateRollout_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_create_rollout(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - rollout = deploy_v1.Rollout() - rollout.target_id = "target_id_value" - - request = deploy_v1.CreateRolloutRequest( - parent="parent_value", - rollout_id="rollout_id_value", - rollout=rollout, - ) - - # Make the request - operation = client.create_rollout(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateRollout_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py deleted file mode 100644 index 3dc717c..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateTarget_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_create_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.CreateTargetRequest( - parent="parent_value", - target_id="target_id_value", - ) - - # Make the request - operation = client.create_target(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py deleted file mode 100644 index c6b93df..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_CreateTarget_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_create_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.CreateTargetRequest( - parent="parent_value", - target_id="target_id_value", - ) - - # Make the request - operation = client.create_target(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_CreateTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py deleted file mode 100644 index a692a80..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_delete_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py deleted file mode 100644 index 09c4c75..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_delete_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py deleted file mode 100644 index 1bc2576..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_DeleteTarget_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_delete_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteTargetRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_target(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_DeleteTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py deleted file mode 100644 index 707cd34..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_DeleteTarget_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_delete_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.DeleteTargetRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_target(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_DeleteTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py deleted file mode 100644 index 554b5b8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_get_config(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_config(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py deleted file mode 100644 index 31da0f3..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_config_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_get_config(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_config(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py deleted file mode 100644 index 719090b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_get_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - response = await client.get_delivery_pipeline(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py deleted file mode 100644 index 6a0e52c..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_get_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetDeliveryPipelineRequest( - name="name_value", - ) - - # Make the request - response = client.get_delivery_pipeline(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py deleted file mode 100644 index c2a80af..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetJobRun -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetJobRun_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_get_job_run(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetJobRunRequest( - name="name_value", - ) - - # Make the request - response = await client.get_job_run(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetJobRun_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py deleted file mode 100644 index 98e70b3..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetJobRun -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetJobRun_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_get_job_run(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetJobRunRequest( - name="name_value", - ) - - # Make the request - response = client.get_job_run(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetJobRun_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py deleted file mode 100644 index 58defdb..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRelease -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetRelease_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_get_release(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetReleaseRequest( - name="name_value", - ) - - # Make the request - response = await client.get_release(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetRelease_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py deleted file mode 100644 index 2943b12..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_release_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRelease -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetRelease_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_get_release(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetReleaseRequest( - name="name_value", - ) - - # Make the request - response = client.get_release(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetRelease_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py deleted file mode 100644 index 94db6be..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRollout -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetRollout_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_get_rollout(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetRolloutRequest( - name="name_value", - ) - - # Make the request - response = await client.get_rollout(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetRollout_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py deleted file mode 100644 index 2c26c55..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRollout -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetRollout_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_get_rollout(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetRolloutRequest( - name="name_value", - ) - - # Make the request - response = client.get_rollout(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetRollout_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py deleted file mode 100644 index 922f76b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetTarget_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_get_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.GetTargetRequest( - name="name_value", - ) - - # Make the request - response = await client.get_target(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py deleted file mode 100644 index b4fd3eb..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_get_target_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_GetTarget_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_get_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.GetTargetRequest( - name="name_value", - ) - - # Make the request - response = client.get_target(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_GetTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py deleted file mode 100644 index 11959d3..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDeliveryPipelines -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_list_delivery_pipelines(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListDeliveryPipelinesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_delivery_pipelines(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py deleted file mode 100644 index c303b39..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDeliveryPipelines -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_list_delivery_pipelines(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListDeliveryPipelinesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_delivery_pipelines(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py deleted file mode 100644 index 93414bf..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListJobRuns -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListJobRuns_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_list_job_runs(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListJobRunsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_job_runs(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListJobRuns_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py deleted file mode 100644 index e63aa53..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListJobRuns -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListJobRuns_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_list_job_runs(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListJobRunsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_job_runs(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListJobRuns_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py deleted file mode 100644 index c517811..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReleases -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListReleases_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_list_releases(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListReleasesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_releases(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListReleases_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py deleted file mode 100644 index fc3a469..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReleases -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListReleases_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_list_releases(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListReleasesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_releases(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListReleases_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py deleted file mode 100644 index 67a4ecc..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListRollouts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListRollouts_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_list_rollouts(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListRolloutsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_rollouts(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListRollouts_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py deleted file mode 100644 index 3cd2e68..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListRollouts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListRollouts_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_list_rollouts(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListRolloutsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_rollouts(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListRollouts_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py deleted file mode 100644 index e9a1dee..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTargets -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListTargets_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_list_targets(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.ListTargetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_targets(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListTargets_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py deleted file mode 100644 index f967150..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTargets -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_ListTargets_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_list_targets(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.ListTargetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_targets(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_ListTargets_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py deleted file mode 100644 index d29e7d7..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RetryJob -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_RetryJob_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_retry_job(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.RetryJobRequest( - rollout="rollout_value", - phase_id="phase_id_value", - job_id="job_id_value", - ) - - # Make the request - response = await client.retry_job(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_RetryJob_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py deleted file mode 100644 index 9ecfb1e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RetryJob -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_RetryJob_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_retry_job(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.RetryJobRequest( - rollout="rollout_value", - phase_id="phase_id_value", - job_id="job_id_value", - ) - - # Make the request - response = client.retry_job(request=request) - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_RetryJob_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py deleted file mode 100644 index 6055e9a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_update_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateDeliveryPipelineRequest( - ) - - # Make the request - operation = client.update_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py deleted file mode 100644 index 0f51fd2..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDeliveryPipeline -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_update_delivery_pipeline(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateDeliveryPipelineRequest( - ) - - # Make the request - operation = client.update_delivery_pipeline(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py deleted file mode 100644 index 9130f33..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_UpdateTarget_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -async def sample_update_target(): - # Create a client - client = deploy_v1.CloudDeployAsyncClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateTargetRequest( - ) - - # Make the request - operation = client.update_target(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_UpdateTarget_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py b/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py deleted file mode 100644 index aed4b23..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_update_target_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateTarget -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-deploy - - -# [START clouddeploy_v1_generated_CloudDeploy_UpdateTarget_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import deploy_v1 - - -def sample_update_target(): - # Create a client - client = deploy_v1.CloudDeployClient() - - # Initialize request argument(s) - request = deploy_v1.UpdateTargetRequest( - ) - - # Make the request - operation = client.update_target(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END clouddeploy_v1_generated_CloudDeploy_UpdateTarget_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json deleted file mode 100644 index 718fa57..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_deploy_v1.json +++ /dev/null @@ -1,3652 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.deploy.v1", - "version": "v1" - } - ], - "language": "PYTHON", - "name": "google-cloud-deploy" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.abandon_release", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.AbandonRelease", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "AbandonRelease" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.AbandonReleaseRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.AbandonReleaseResponse", - "shortName": "abandon_release" - }, - "description": "Sample for AbandonRelease", - "file": "clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_AbandonRelease_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_abandon_release_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.abandon_release", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.AbandonRelease", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "AbandonRelease" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.AbandonReleaseRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.AbandonReleaseResponse", - "shortName": "abandon_release" - }, - "description": "Sample for AbandonRelease", - "file": "clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_AbandonRelease_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_abandon_release_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.approve_rollout", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ApproveRollout", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ApproveRollout" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ApproveRolloutRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.ApproveRolloutResponse", - "shortName": "approve_rollout" - }, - "description": "Sample for ApproveRollout", - "file": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ApproveRollout_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.approve_rollout", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ApproveRollout", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ApproveRollout" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ApproveRolloutRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.ApproveRolloutResponse", - "shortName": "approve_rollout" - }, - "description": "Sample for ApproveRollout", - "file": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ApproveRollout_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_approve_rollout_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "delivery_pipeline", - "type": "google.cloud.deploy_v1.types.DeliveryPipeline" - }, - { - "name": "delivery_pipeline_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_delivery_pipeline" - }, - "description": "Sample for CreateDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateDeliveryPipelineRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "delivery_pipeline", - "type": "google.cloud.deploy_v1.types.DeliveryPipeline" - }, - { - "name": "delivery_pipeline_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_delivery_pipeline" - }, - "description": "Sample for CreateDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateDeliveryPipeline_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_release", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRelease", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateRelease" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateReleaseRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "release", - "type": "google.cloud.deploy_v1.types.Release" - }, - { - "name": "release_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_release" - }, - "description": "Sample for CreateRelease", - "file": "clouddeploy_v1_generated_cloud_deploy_create_release_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRelease_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_release_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_release", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRelease", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateRelease" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateReleaseRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "release", - "type": "google.cloud.deploy_v1.types.Release" - }, - { - "name": "release_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_release" - }, - "description": "Sample for CreateRelease", - "file": "clouddeploy_v1_generated_cloud_deploy_create_release_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRelease_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_release_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_rollout", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRollout", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateRollout" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateRolloutRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "rollout", - "type": "google.cloud.deploy_v1.types.Rollout" - }, - { - "name": "rollout_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_rollout" - }, - "description": "Sample for CreateRollout", - "file": "clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRollout_async", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_rollout", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateRollout", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateRollout" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateRolloutRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "rollout", - "type": "google.cloud.deploy_v1.types.Rollout" - }, - { - "name": "rollout_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_rollout" - }, - "description": "Sample for CreateRollout", - "file": "clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateRollout_sync", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_rollout_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.create_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateTargetRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "target", - "type": "google.cloud.deploy_v1.types.Target" - }, - { - "name": "target_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_target" - }, - "description": "Sample for CreateTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_create_target_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateTarget_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_target_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.create_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.CreateTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "CreateTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.CreateTargetRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "target", - "type": "google.cloud.deploy_v1.types.Target" - }, - { - "name": "target_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_target" - }, - "description": "Sample for CreateTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_create_target_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_CreateTarget_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_create_target_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.delete_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "DeleteDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_delivery_pipeline" - }, - "description": "Sample for DeleteDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.delete_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "DeleteDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.DeleteDeliveryPipelineRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_delivery_pipeline" - }, - "description": "Sample for DeleteDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteDeliveryPipeline_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_delete_delivery_pipeline_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.delete_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "DeleteTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.DeleteTargetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_target" - }, - "description": "Sample for DeleteTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_delete_target_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteTarget_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_delete_target_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.delete_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.DeleteTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "DeleteTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.DeleteTargetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_target" - }, - "description": "Sample for DeleteTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_DeleteTarget_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_delete_target_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_config", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetConfig", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Config", - "shortName": "get_config" - }, - "description": "Sample for GetConfig", - "file": "clouddeploy_v1_generated_cloud_deploy_get_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetConfig_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_config", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetConfig", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Config", - "shortName": "get_config" - }, - "description": "Sample for GetConfig", - "file": "clouddeploy_v1_generated_cloud_deploy_get_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetConfig_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetDeliveryPipelineRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.DeliveryPipeline", - "shortName": "get_delivery_pipeline" - }, - "description": "Sample for GetDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetDeliveryPipelineRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.DeliveryPipeline", - "shortName": "get_delivery_pipeline" - }, - "description": "Sample for GetDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetDeliveryPipeline_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_delivery_pipeline_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_job_run", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetJobRun", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetJobRun" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetJobRunRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.JobRun", - "shortName": "get_job_run" - }, - "description": "Sample for GetJobRun", - "file": "clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetJobRun_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_job_run_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_job_run", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetJobRun", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetJobRun" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetJobRunRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.JobRun", - "shortName": "get_job_run" - }, - "description": "Sample for GetJobRun", - "file": "clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetJobRun_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_job_run_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_release", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRelease", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetRelease" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetReleaseRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Release", - "shortName": "get_release" - }, - "description": "Sample for GetRelease", - "file": "clouddeploy_v1_generated_cloud_deploy_get_release_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRelease_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_release_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_release", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRelease", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetRelease" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetReleaseRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Release", - "shortName": "get_release" - }, - "description": "Sample for GetRelease", - "file": "clouddeploy_v1_generated_cloud_deploy_get_release_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRelease_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_release_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_rollout", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRollout", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetRollout" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetRolloutRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Rollout", - "shortName": "get_rollout" - }, - "description": "Sample for GetRollout", - "file": "clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRollout_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_rollout_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_rollout", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetRollout", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetRollout" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetRolloutRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Rollout", - "shortName": "get_rollout" - }, - "description": "Sample for GetRollout", - "file": "clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetRollout_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_rollout_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.get_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetTargetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Target", - "shortName": "get_target" - }, - "description": "Sample for GetTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_get_target_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetTarget_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_target_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.get_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.GetTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "GetTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.GetTargetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.Target", - "shortName": "get_target" - }, - "description": "Sample for GetTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_get_target_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_GetTarget_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_get_target_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_delivery_pipelines", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListDeliveryPipelines", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListDeliveryPipelines" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesAsyncPager", - "shortName": "list_delivery_pipelines" - }, - "description": "Sample for ListDeliveryPipelines", - "file": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_delivery_pipelines", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListDeliveryPipelines", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListDeliveryPipelines" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListDeliveryPipelinesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListDeliveryPipelinesPager", - "shortName": "list_delivery_pipelines" - }, - "description": "Sample for ListDeliveryPipelines", - "file": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListDeliveryPipelines_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_delivery_pipelines_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_job_runs", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListJobRuns", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListJobRuns" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListJobRunsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsAsyncPager", - "shortName": "list_job_runs" - }, - "description": "Sample for ListJobRuns", - "file": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListJobRuns_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_job_runs", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListJobRuns", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListJobRuns" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListJobRunsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListJobRunsPager", - "shortName": "list_job_runs" - }, - "description": "Sample for ListJobRuns", - "file": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListJobRuns_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_job_runs_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_releases", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListReleases", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListReleases" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListReleasesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesAsyncPager", - "shortName": "list_releases" - }, - "description": "Sample for ListReleases", - "file": "clouddeploy_v1_generated_cloud_deploy_list_releases_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListReleases_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_releases_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_releases", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListReleases", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListReleases" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListReleasesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListReleasesPager", - "shortName": "list_releases" - }, - "description": "Sample for ListReleases", - "file": "clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListReleases_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_releases_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_rollouts", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListRollouts", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListRollouts" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListRolloutsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsAsyncPager", - "shortName": "list_rollouts" - }, - "description": "Sample for ListRollouts", - "file": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListRollouts_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_rollouts", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListRollouts", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListRollouts" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListRolloutsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListRolloutsPager", - "shortName": "list_rollouts" - }, - "description": "Sample for ListRollouts", - "file": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListRollouts_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_rollouts_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.list_targets", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListTargets", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListTargets" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListTargetsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsAsyncPager", - "shortName": "list_targets" - }, - "description": "Sample for ListTargets", - "file": "clouddeploy_v1_generated_cloud_deploy_list_targets_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListTargets_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_targets_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.list_targets", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.ListTargets", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "ListTargets" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.ListTargetsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.services.cloud_deploy.pagers.ListTargetsPager", - "shortName": "list_targets" - }, - "description": "Sample for ListTargets", - "file": "clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_ListTargets_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_list_targets_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.retry_job", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.RetryJob", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "RetryJob" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.RetryJobRequest" - }, - { - "name": "rollout", - "type": "str" - }, - { - "name": "phase_id", - "type": "str" - }, - { - "name": "job_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.RetryJobResponse", - "shortName": "retry_job" - }, - "description": "Sample for RetryJob", - "file": "clouddeploy_v1_generated_cloud_deploy_retry_job_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_RetryJob_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_retry_job_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.retry_job", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.RetryJob", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "RetryJob" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.RetryJobRequest" - }, - { - "name": "rollout", - "type": "str" - }, - { - "name": "phase_id", - "type": "str" - }, - { - "name": "job_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.deploy_v1.types.RetryJobResponse", - "shortName": "retry_job" - }, - "description": "Sample for RetryJob", - "file": "clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_RetryJob_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_retry_job_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.update_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "UpdateDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest" - }, - { - "name": "delivery_pipeline", - "type": "google.cloud.deploy_v1.types.DeliveryPipeline" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_delivery_pipeline" - }, - "description": "Sample for UpdateDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.update_delivery_pipeline", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateDeliveryPipeline", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "UpdateDeliveryPipeline" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.UpdateDeliveryPipelineRequest" - }, - { - "name": "delivery_pipeline", - "type": "google.cloud.deploy_v1.types.DeliveryPipeline" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_delivery_pipeline" - }, - "description": "Sample for UpdateDeliveryPipeline", - "file": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateDeliveryPipeline_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_update_delivery_pipeline_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient", - "shortName": "CloudDeployAsyncClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployAsyncClient.update_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "UpdateTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.UpdateTargetRequest" - }, - { - "name": "target", - "type": "google.cloud.deploy_v1.types.Target" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_target" - }, - "description": "Sample for UpdateTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_update_target_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateTarget_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_update_target_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.deploy_v1.CloudDeployClient", - "shortName": "CloudDeployClient" - }, - "fullName": "google.cloud.deploy_v1.CloudDeployClient.update_target", - "method": { - "fullName": "google.cloud.deploy.v1.CloudDeploy.UpdateTarget", - "service": { - "fullName": "google.cloud.deploy.v1.CloudDeploy", - "shortName": "CloudDeploy" - }, - "shortName": "UpdateTarget" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.deploy_v1.types.UpdateTargetRequest" - }, - { - "name": "target", - "type": "google.cloud.deploy_v1.types.Target" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_target" - }, - "description": "Sample for UpdateTarget", - "file": "clouddeploy_v1_generated_cloud_deploy_update_target_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "clouddeploy_v1_generated_CloudDeploy_UpdateTarget_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "clouddeploy_v1_generated_cloud_deploy_update_target_sync.py" - } - ] -} diff --git a/owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py deleted file mode 100644 index a785c71..0000000 --- a/owl-bot-staging/v1/scripts/fixup_deploy_v1_keywords.py +++ /dev/null @@ -1,197 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class deployCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'abandon_release': ('name', ), - 'approve_rollout': ('name', 'approved', ), - 'create_delivery_pipeline': ('parent', 'delivery_pipeline_id', 'delivery_pipeline', 'request_id', 'validate_only', ), - 'create_release': ('parent', 'release_id', 'release', 'request_id', 'validate_only', ), - 'create_rollout': ('parent', 'rollout_id', 'rollout', 'request_id', 'validate_only', ), - 'create_target': ('parent', 'target_id', 'target', 'request_id', 'validate_only', ), - 'delete_delivery_pipeline': ('name', 'request_id', 'allow_missing', 'validate_only', 'force', 'etag', ), - 'delete_target': ('name', 'request_id', 'allow_missing', 'validate_only', 'etag', ), - 'get_config': ('name', ), - 'get_delivery_pipeline': ('name', ), - 'get_job_run': ('name', ), - 'get_release': ('name', ), - 'get_rollout': ('name', ), - 'get_target': ('name', ), - 'list_delivery_pipelines': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_job_runs': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_releases': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_rollouts': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_targets': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'retry_job': ('rollout', 'phase_id', 'job_id', ), - 'update_delivery_pipeline': ('update_mask', 'delivery_pipeline', 'request_id', 'allow_missing', 'validate_only', ), - 'update_target': ('update_mask', 'target', 'request_id', 'allow_missing', 'validate_only', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=deployCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the deploy client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py deleted file mode 100644 index fff3b05..0000000 --- a/owl-bot-staging/v1/setup.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import io -import os -import setuptools # type: ignore - -version = '0.1.0' - -package_root = os.path.abspath(os.path.dirname(__file__)) - -readme_filename = os.path.join(package_root, 'README.rst') -with io.open(readme_filename, encoding='utf-8') as readme_file: - readme = readme_file.read() - -setuptools.setup( - name='google-cloud-deploy', - author="Google LLC", - author_email="googleapis-packages@google.com", - url="https://github.com/googleapis/python-google-cloud-deploy", - version=version, - long_description=readme, - packages=setuptools.PEP420PackageFinder.find(), - namespace_packages=('google', 'google.cloud'), - platforms='Posix; MacOS X; Windows', - include_package_data=True, - install_requires=( - 'google-api-core[grpc] >= 2.10.0, < 3.0.0dev', - 'libcst >= 0.2.5', - 'googleapis-common-protos >= 1.55.0, <2.0.0dev', - 'proto-plus >= 1.19.7', - 'grpc-google-iam-v1 >= 0.12.4, < 0.13dev', - ), - python_requires='>=3.7', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Internet', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], - zip_safe=False, -) diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py b/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py deleted file mode 100644 index 73d9d4e..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/deploy_v1/test_cloud_deploy.py +++ /dev/null @@ -1,8966 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers - -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation -from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.cloud.deploy_v1.services.cloud_deploy import CloudDeployAsyncClient -from google.cloud.deploy_v1.services.cloud_deploy import CloudDeployClient -from google.cloud.deploy_v1.services.cloud_deploy import pagers -from google.cloud.deploy_v1.services.cloud_deploy import transports -from google.cloud.deploy_v1.types import cloud_deploy -from google.cloud.location import locations_pb2 -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import options_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.oauth2 import service_account -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert CloudDeployClient._get_default_mtls_endpoint(None) is None - assert CloudDeployClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert CloudDeployClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert CloudDeployClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert CloudDeployClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert CloudDeployClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CloudDeployClient, "grpc"), - (CloudDeployAsyncClient, "grpc_asyncio"), -]) -def test_cloud_deploy_client_from_service_account_info(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: - factory.return_value = creds - info = {"valid": True} - client = client_class.from_service_account_info(info, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'clouddeploy.googleapis.com:443' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.CloudDeployGrpcTransport, "grpc"), - (transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cloud_deploy_client_service_account_always_use_jwt(transport_class, transport_name): - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CloudDeployClient, "grpc"), - (CloudDeployAsyncClient, "grpc_asyncio"), -]) -def test_cloud_deploy_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: - factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'clouddeploy.googleapis.com:443' - ) - - -def test_cloud_deploy_client_get_transport_class(): - transport = CloudDeployClient.get_transport_class() - available_transports = [ - transports.CloudDeployGrpcTransport, - ] - assert transport in available_transports - - transport = CloudDeployClient.get_transport_class("grpc") - assert transport == transports.CloudDeployGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc"), - (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(CloudDeployClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployClient)) -@mock.patch.object(CloudDeployAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployAsyncClient)) -def test_cloud_deploy_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(CloudDeployClient, 'get_transport_class') as gtc: - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(CloudDeployClient, 'get_transport_class') as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions(api_audience="https://language.googleapis.com") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com" - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ - (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", "true"), - (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", "false"), - (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(CloudDeployClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployClient)) -@mock.patch.object(CloudDeployAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_cloud_deploy_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - if use_client_cert_env == "false": - expected_client_cert_source = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_client_cert_source = client_cert_source_callback - expected_host = client.DEFAULT_MTLS_ENDPOINT - - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): - if use_client_cert_env == "false": - expected_host = client.DEFAULT_ENDPOINT - expected_client_cert_source = None - else: - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_client_cert_source = client_cert_source_callback - - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ - CloudDeployClient, CloudDeployAsyncClient -]) -@mock.patch.object(CloudDeployClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployClient)) -@mock.patch.object(CloudDeployAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudDeployAsyncClient)) -def test_cloud_deploy_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc"), - (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cloud_deploy_client_client_options_scopes(client_class, transport_class, transport_name): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", grpc_helpers), - (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cloud_deploy_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -def test_cloud_deploy_client_client_options_from_dict(): - with mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = CloudDeployClient( - client_options={'api_endpoint': 'squid.clam.whelk'} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CloudDeployClient, transports.CloudDeployGrpcTransport, "grpc", grpc_helpers), - (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cloud_deploy_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "clouddeploy.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - scopes=None, - default_host="clouddeploy.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.ListDeliveryPipelinesRequest, - dict, -]) -def test_list_delivery_pipelines(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListDeliveryPipelinesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - ) - response = client.list_delivery_pipelines(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListDeliveryPipelinesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDeliveryPipelinesPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -def test_list_delivery_pipelines_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - client.list_delivery_pipelines() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListDeliveryPipelinesRequest() - -@pytest.mark.asyncio -async def test_list_delivery_pipelines_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListDeliveryPipelinesRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListDeliveryPipelinesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_delivery_pipelines(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListDeliveryPipelinesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDeliveryPipelinesAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_delivery_pipelines_async_from_dict(): - await test_list_delivery_pipelines_async(request_type=dict) - - -def test_list_delivery_pipelines_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListDeliveryPipelinesRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - call.return_value = cloud_deploy.ListDeliveryPipelinesResponse() - client.list_delivery_pipelines(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_delivery_pipelines_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListDeliveryPipelinesRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListDeliveryPipelinesResponse()) - await client.list_delivery_pipelines(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_delivery_pipelines_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListDeliveryPipelinesResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_delivery_pipelines( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_delivery_pipelines_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_delivery_pipelines( - cloud_deploy.ListDeliveryPipelinesRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_delivery_pipelines_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListDeliveryPipelinesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListDeliveryPipelinesResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_delivery_pipelines( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_delivery_pipelines_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_delivery_pipelines( - cloud_deploy.ListDeliveryPipelinesRequest(), - parent='parent_value', - ) - - -def test_list_delivery_pipelines_pager(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='abc', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[], - next_page_token='def', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_delivery_pipelines(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cloud_deploy.DeliveryPipeline) - for i in results) -def test_list_delivery_pipelines_pages(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='abc', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[], - next_page_token='def', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - ), - RuntimeError, - ) - pages = list(client.list_delivery_pipelines(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_delivery_pipelines_async_pager(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='abc', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[], - next_page_token='def', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_delivery_pipelines(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, cloud_deploy.DeliveryPipeline) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_delivery_pipelines_async_pages(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_delivery_pipelines), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='abc', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[], - next_page_token='def', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListDeliveryPipelinesResponse( - delivery_pipelines=[ - cloud_deploy.DeliveryPipeline(), - cloud_deploy.DeliveryPipeline(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_delivery_pipelines(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.GetDeliveryPipelineRequest, - dict, -]) -def test_get_delivery_pipeline(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.DeliveryPipeline( - name='name_value', - uid='uid_value', - description='description_value', - etag='etag_value', - suspended=True, - serial_pipeline=cloud_deploy.SerialPipeline(stages=[cloud_deploy.Stage(target_id='target_id_value')]), - ) - response = client.get_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.DeliveryPipeline) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.etag == 'etag_value' - assert response.suspended is True - - -def test_get_delivery_pipeline_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_delivery_pipeline), - '__call__') as call: - client.get_delivery_pipeline() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetDeliveryPipelineRequest() - -@pytest.mark.asyncio -async def test_get_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetDeliveryPipelineRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.DeliveryPipeline( - name='name_value', - uid='uid_value', - description='description_value', - etag='etag_value', - suspended=True, - )) - response = await client.get_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.DeliveryPipeline) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.etag == 'etag_value' - assert response.suspended is True - - -@pytest.mark.asyncio -async def test_get_delivery_pipeline_async_from_dict(): - await test_get_delivery_pipeline_async(request_type=dict) - - -def test_get_delivery_pipeline_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetDeliveryPipelineRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_delivery_pipeline), - '__call__') as call: - call.return_value = cloud_deploy.DeliveryPipeline() - client.get_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_delivery_pipeline_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetDeliveryPipelineRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_delivery_pipeline), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.DeliveryPipeline()) - await client.get_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_delivery_pipeline_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.DeliveryPipeline() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_delivery_pipeline( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_delivery_pipeline_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_delivery_pipeline( - cloud_deploy.GetDeliveryPipelineRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_delivery_pipeline_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.DeliveryPipeline() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.DeliveryPipeline()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_delivery_pipeline( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_delivery_pipeline_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_delivery_pipeline( - cloud_deploy.GetDeliveryPipelineRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.CreateDeliveryPipelineRequest, - dict, -]) -def test_create_delivery_pipeline(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_delivery_pipeline_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_delivery_pipeline), - '__call__') as call: - client.create_delivery_pipeline() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateDeliveryPipelineRequest() - -@pytest.mark.asyncio -async def test_create_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateDeliveryPipelineRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_delivery_pipeline_async_from_dict(): - await test_create_delivery_pipeline_async(request_type=dict) - - -def test_create_delivery_pipeline_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateDeliveryPipelineRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_delivery_pipeline), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_delivery_pipeline_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateDeliveryPipelineRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_delivery_pipeline), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_delivery_pipeline_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_delivery_pipeline( - parent='parent_value', - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - delivery_pipeline_id='delivery_pipeline_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].delivery_pipeline - mock_val = cloud_deploy.DeliveryPipeline(name='name_value') - assert arg == mock_val - arg = args[0].delivery_pipeline_id - mock_val = 'delivery_pipeline_id_value' - assert arg == mock_val - - -def test_create_delivery_pipeline_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_delivery_pipeline( - cloud_deploy.CreateDeliveryPipelineRequest(), - parent='parent_value', - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - delivery_pipeline_id='delivery_pipeline_id_value', - ) - -@pytest.mark.asyncio -async def test_create_delivery_pipeline_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_delivery_pipeline( - parent='parent_value', - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - delivery_pipeline_id='delivery_pipeline_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].delivery_pipeline - mock_val = cloud_deploy.DeliveryPipeline(name='name_value') - assert arg == mock_val - arg = args[0].delivery_pipeline_id - mock_val = 'delivery_pipeline_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_delivery_pipeline_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_delivery_pipeline( - cloud_deploy.CreateDeliveryPipelineRequest(), - parent='parent_value', - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - delivery_pipeline_id='delivery_pipeline_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.UpdateDeliveryPipelineRequest, - dict, -]) -def test_update_delivery_pipeline(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.update_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_update_delivery_pipeline_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_delivery_pipeline), - '__call__') as call: - client.update_delivery_pipeline() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateDeliveryPipelineRequest() - -@pytest.mark.asyncio -async def test_update_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.UpdateDeliveryPipelineRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.update_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_delivery_pipeline_async_from_dict(): - await test_update_delivery_pipeline_async(request_type=dict) - - -def test_update_delivery_pipeline_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.UpdateDeliveryPipelineRequest() - - request.delivery_pipeline.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_delivery_pipeline), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.update_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'delivery_pipeline.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_delivery_pipeline_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.UpdateDeliveryPipelineRequest() - - request.delivery_pipeline.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_delivery_pipeline), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.update_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'delivery_pipeline.name=name_value', - ) in kw['metadata'] - - -def test_update_delivery_pipeline_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_delivery_pipeline( - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].delivery_pipeline - mock_val = cloud_deploy.DeliveryPipeline(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_delivery_pipeline_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_delivery_pipeline( - cloud_deploy.UpdateDeliveryPipelineRequest(), - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_delivery_pipeline_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_delivery_pipeline( - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].delivery_pipeline - mock_val = cloud_deploy.DeliveryPipeline(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_delivery_pipeline_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_delivery_pipeline( - cloud_deploy.UpdateDeliveryPipelineRequest(), - delivery_pipeline=cloud_deploy.DeliveryPipeline(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.DeleteDeliveryPipelineRequest, - dict, -]) -def test_delete_delivery_pipeline(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_delete_delivery_pipeline_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_delivery_pipeline), - '__call__') as call: - client.delete_delivery_pipeline() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteDeliveryPipelineRequest() - -@pytest.mark.asyncio -async def test_delete_delivery_pipeline_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.DeleteDeliveryPipelineRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteDeliveryPipelineRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_delivery_pipeline_async_from_dict(): - await test_delete_delivery_pipeline_async(request_type=dict) - - -def test_delete_delivery_pipeline_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.DeleteDeliveryPipelineRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_delivery_pipeline), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_delivery_pipeline_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.DeleteDeliveryPipelineRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_delivery_pipeline), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_delivery_pipeline(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_delivery_pipeline_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_delivery_pipeline( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_delivery_pipeline_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_delivery_pipeline( - cloud_deploy.DeleteDeliveryPipelineRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_delivery_pipeline_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_delivery_pipeline), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_delivery_pipeline( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_delivery_pipeline_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_delivery_pipeline( - cloud_deploy.DeleteDeliveryPipelineRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.ListTargetsRequest, - dict, -]) -def test_list_targets(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListTargetsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - ) - response = client.list_targets(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListTargetsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListTargetsPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -def test_list_targets_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - client.list_targets() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListTargetsRequest() - -@pytest.mark.asyncio -async def test_list_targets_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListTargetsRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListTargetsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_targets(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListTargetsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListTargetsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_targets_async_from_dict(): - await test_list_targets_async(request_type=dict) - - -def test_list_targets_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListTargetsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - call.return_value = cloud_deploy.ListTargetsResponse() - client.list_targets(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_targets_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListTargetsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListTargetsResponse()) - await client.list_targets(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_targets_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListTargetsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_targets( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_targets_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_targets( - cloud_deploy.ListTargetsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_targets_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListTargetsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListTargetsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_targets( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_targets_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_targets( - cloud_deploy.ListTargetsRequest(), - parent='parent_value', - ) - - -def test_list_targets_pager(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - next_page_token='abc', - ), - cloud_deploy.ListTargetsResponse( - targets=[], - next_page_token='def', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_targets(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cloud_deploy.Target) - for i in results) -def test_list_targets_pages(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - next_page_token='abc', - ), - cloud_deploy.ListTargetsResponse( - targets=[], - next_page_token='def', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - ), - RuntimeError, - ) - pages = list(client.list_targets(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_targets_async_pager(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - next_page_token='abc', - ), - cloud_deploy.ListTargetsResponse( - targets=[], - next_page_token='def', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_targets(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, cloud_deploy.Target) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_targets_async_pages(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_targets), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - next_page_token='abc', - ), - cloud_deploy.ListTargetsResponse( - targets=[], - next_page_token='def', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListTargetsResponse( - targets=[ - cloud_deploy.Target(), - cloud_deploy.Target(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_targets(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.GetTargetRequest, - dict, -]) -def test_get_target(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Target( - name='name_value', - target_id='target_id_value', - uid='uid_value', - description='description_value', - require_approval=True, - etag='etag_value', - gke=cloud_deploy.GkeCluster(cluster='cluster_value'), - ) - response = client.get_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Target) - assert response.name == 'name_value' - assert response.target_id == 'target_id_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.require_approval is True - assert response.etag == 'etag_value' - - -def test_get_target_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_target), - '__call__') as call: - client.get_target() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetTargetRequest() - -@pytest.mark.asyncio -async def test_get_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetTargetRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Target( - name='name_value', - target_id='target_id_value', - uid='uid_value', - description='description_value', - require_approval=True, - etag='etag_value', - )) - response = await client.get_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Target) - assert response.name == 'name_value' - assert response.target_id == 'target_id_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.require_approval is True - assert response.etag == 'etag_value' - - -@pytest.mark.asyncio -async def test_get_target_async_from_dict(): - await test_get_target_async(request_type=dict) - - -def test_get_target_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetTargetRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_target), - '__call__') as call: - call.return_value = cloud_deploy.Target() - client.get_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_target_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetTargetRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_target), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Target()) - await client.get_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_target_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Target() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_target( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_target_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_target( - cloud_deploy.GetTargetRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_target_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Target() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Target()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_target( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_target_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_target( - cloud_deploy.GetTargetRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.CreateTargetRequest, - dict, -]) -def test_create_target(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_target_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_target), - '__call__') as call: - client.create_target() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateTargetRequest() - -@pytest.mark.asyncio -async def test_create_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateTargetRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_target_async_from_dict(): - await test_create_target_async(request_type=dict) - - -def test_create_target_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateTargetRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_target), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_target_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateTargetRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_target), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_target_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_target( - parent='parent_value', - target=cloud_deploy.Target(name='name_value'), - target_id='target_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].target - mock_val = cloud_deploy.Target(name='name_value') - assert arg == mock_val - arg = args[0].target_id - mock_val = 'target_id_value' - assert arg == mock_val - - -def test_create_target_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_target( - cloud_deploy.CreateTargetRequest(), - parent='parent_value', - target=cloud_deploy.Target(name='name_value'), - target_id='target_id_value', - ) - -@pytest.mark.asyncio -async def test_create_target_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_target( - parent='parent_value', - target=cloud_deploy.Target(name='name_value'), - target_id='target_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].target - mock_val = cloud_deploy.Target(name='name_value') - assert arg == mock_val - arg = args[0].target_id - mock_val = 'target_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_target_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_target( - cloud_deploy.CreateTargetRequest(), - parent='parent_value', - target=cloud_deploy.Target(name='name_value'), - target_id='target_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.UpdateTargetRequest, - dict, -]) -def test_update_target(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.update_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_update_target_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_target), - '__call__') as call: - client.update_target() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateTargetRequest() - -@pytest.mark.asyncio -async def test_update_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.UpdateTargetRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.update_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_target_async_from_dict(): - await test_update_target_async(request_type=dict) - - -def test_update_target_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.UpdateTargetRequest() - - request.target.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_target), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.update_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'target.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_target_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.UpdateTargetRequest() - - request.target.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_target), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.update_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'target.name=name_value', - ) in kw['metadata'] - - -def test_update_target_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_target( - target=cloud_deploy.Target(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].target - mock_val = cloud_deploy.Target(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_target_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_target( - cloud_deploy.UpdateTargetRequest(), - target=cloud_deploy.Target(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_target_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_target( - target=cloud_deploy.Target(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].target - mock_val = cloud_deploy.Target(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_target_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_target( - cloud_deploy.UpdateTargetRequest(), - target=cloud_deploy.Target(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.DeleteTargetRequest, - dict, -]) -def test_delete_target(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_delete_target_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_target), - '__call__') as call: - client.delete_target() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteTargetRequest() - -@pytest.mark.asyncio -async def test_delete_target_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.DeleteTargetRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteTargetRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_target_async_from_dict(): - await test_delete_target_async(request_type=dict) - - -def test_delete_target_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.DeleteTargetRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_target), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_target_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.DeleteTargetRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_target), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_target(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_target_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_target( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_target_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_target( - cloud_deploy.DeleteTargetRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_target_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_target), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_target( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_target_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_target( - cloud_deploy.DeleteTargetRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.ListReleasesRequest, - dict, -]) -def test_list_releases(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListReleasesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - ) - response = client.list_releases(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListReleasesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListReleasesPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -def test_list_releases_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - client.list_releases() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListReleasesRequest() - -@pytest.mark.asyncio -async def test_list_releases_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListReleasesRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListReleasesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_releases(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListReleasesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListReleasesAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_releases_async_from_dict(): - await test_list_releases_async(request_type=dict) - - -def test_list_releases_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListReleasesRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - call.return_value = cloud_deploy.ListReleasesResponse() - client.list_releases(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_releases_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListReleasesRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListReleasesResponse()) - await client.list_releases(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_releases_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListReleasesResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_releases( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_releases_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_releases( - cloud_deploy.ListReleasesRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_releases_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListReleasesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListReleasesResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_releases( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_releases_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_releases( - cloud_deploy.ListReleasesRequest(), - parent='parent_value', - ) - - -def test_list_releases_pager(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - next_page_token='abc', - ), - cloud_deploy.ListReleasesResponse( - releases=[], - next_page_token='def', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_releases(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cloud_deploy.Release) - for i in results) -def test_list_releases_pages(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - next_page_token='abc', - ), - cloud_deploy.ListReleasesResponse( - releases=[], - next_page_token='def', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - ), - RuntimeError, - ) - pages = list(client.list_releases(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_releases_async_pager(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - next_page_token='abc', - ), - cloud_deploy.ListReleasesResponse( - releases=[], - next_page_token='def', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_releases(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, cloud_deploy.Release) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_releases_async_pages(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_releases), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - next_page_token='abc', - ), - cloud_deploy.ListReleasesResponse( - releases=[], - next_page_token='def', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListReleasesResponse( - releases=[ - cloud_deploy.Release(), - cloud_deploy.Release(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_releases(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.GetReleaseRequest, - dict, -]) -def test_get_release(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Release( - name='name_value', - uid='uid_value', - description='description_value', - abandoned=True, - skaffold_config_uri='skaffold_config_uri_value', - skaffold_config_path='skaffold_config_path_value', - render_state=cloud_deploy.Release.RenderState.SUCCEEDED, - etag='etag_value', - skaffold_version='skaffold_version_value', - ) - response = client.get_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetReleaseRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Release) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.abandoned is True - assert response.skaffold_config_uri == 'skaffold_config_uri_value' - assert response.skaffold_config_path == 'skaffold_config_path_value' - assert response.render_state == cloud_deploy.Release.RenderState.SUCCEEDED - assert response.etag == 'etag_value' - assert response.skaffold_version == 'skaffold_version_value' - - -def test_get_release_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_release), - '__call__') as call: - client.get_release() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetReleaseRequest() - -@pytest.mark.asyncio -async def test_get_release_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetReleaseRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Release( - name='name_value', - uid='uid_value', - description='description_value', - abandoned=True, - skaffold_config_uri='skaffold_config_uri_value', - skaffold_config_path='skaffold_config_path_value', - render_state=cloud_deploy.Release.RenderState.SUCCEEDED, - etag='etag_value', - skaffold_version='skaffold_version_value', - )) - response = await client.get_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetReleaseRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Release) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.abandoned is True - assert response.skaffold_config_uri == 'skaffold_config_uri_value' - assert response.skaffold_config_path == 'skaffold_config_path_value' - assert response.render_state == cloud_deploy.Release.RenderState.SUCCEEDED - assert response.etag == 'etag_value' - assert response.skaffold_version == 'skaffold_version_value' - - -@pytest.mark.asyncio -async def test_get_release_async_from_dict(): - await test_get_release_async(request_type=dict) - - -def test_get_release_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetReleaseRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_release), - '__call__') as call: - call.return_value = cloud_deploy.Release() - client.get_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_release_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetReleaseRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_release), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Release()) - await client.get_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_release_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Release() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_release( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_release_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_release( - cloud_deploy.GetReleaseRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_release_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Release() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Release()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_release( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_release_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_release( - cloud_deploy.GetReleaseRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.CreateReleaseRequest, - dict, -]) -def test_create_release(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateReleaseRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_release_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_release), - '__call__') as call: - client.create_release() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateReleaseRequest() - -@pytest.mark.asyncio -async def test_create_release_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateReleaseRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateReleaseRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_release_async_from_dict(): - await test_create_release_async(request_type=dict) - - -def test_create_release_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateReleaseRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_release), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_release_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateReleaseRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_release), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_release_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_release( - parent='parent_value', - release=cloud_deploy.Release(name='name_value'), - release_id='release_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].release - mock_val = cloud_deploy.Release(name='name_value') - assert arg == mock_val - arg = args[0].release_id - mock_val = 'release_id_value' - assert arg == mock_val - - -def test_create_release_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_release( - cloud_deploy.CreateReleaseRequest(), - parent='parent_value', - release=cloud_deploy.Release(name='name_value'), - release_id='release_id_value', - ) - -@pytest.mark.asyncio -async def test_create_release_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_release( - parent='parent_value', - release=cloud_deploy.Release(name='name_value'), - release_id='release_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].release - mock_val = cloud_deploy.Release(name='name_value') - assert arg == mock_val - arg = args[0].release_id - mock_val = 'release_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_release_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_release( - cloud_deploy.CreateReleaseRequest(), - parent='parent_value', - release=cloud_deploy.Release(name='name_value'), - release_id='release_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.AbandonReleaseRequest, - dict, -]) -def test_abandon_release(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.abandon_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.AbandonReleaseResponse( - ) - response = client.abandon_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.AbandonReleaseRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.AbandonReleaseResponse) - - -def test_abandon_release_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.abandon_release), - '__call__') as call: - client.abandon_release() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.AbandonReleaseRequest() - -@pytest.mark.asyncio -async def test_abandon_release_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.AbandonReleaseRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.abandon_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.AbandonReleaseResponse( - )) - response = await client.abandon_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.AbandonReleaseRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.AbandonReleaseResponse) - - -@pytest.mark.asyncio -async def test_abandon_release_async_from_dict(): - await test_abandon_release_async(request_type=dict) - - -def test_abandon_release_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.AbandonReleaseRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.abandon_release), - '__call__') as call: - call.return_value = cloud_deploy.AbandonReleaseResponse() - client.abandon_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_abandon_release_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.AbandonReleaseRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.abandon_release), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.AbandonReleaseResponse()) - await client.abandon_release(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_abandon_release_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.abandon_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.AbandonReleaseResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.abandon_release( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_abandon_release_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.abandon_release( - cloud_deploy.AbandonReleaseRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_abandon_release_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.abandon_release), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.AbandonReleaseResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.AbandonReleaseResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.abandon_release( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_abandon_release_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.abandon_release( - cloud_deploy.AbandonReleaseRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.ApproveRolloutRequest, - dict, -]) -def test_approve_rollout(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.approve_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ApproveRolloutResponse( - ) - response = client.approve_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ApproveRolloutRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.ApproveRolloutResponse) - - -def test_approve_rollout_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.approve_rollout), - '__call__') as call: - client.approve_rollout() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ApproveRolloutRequest() - -@pytest.mark.asyncio -async def test_approve_rollout_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ApproveRolloutRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.approve_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ApproveRolloutResponse( - )) - response = await client.approve_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ApproveRolloutRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.ApproveRolloutResponse) - - -@pytest.mark.asyncio -async def test_approve_rollout_async_from_dict(): - await test_approve_rollout_async(request_type=dict) - - -def test_approve_rollout_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ApproveRolloutRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.approve_rollout), - '__call__') as call: - call.return_value = cloud_deploy.ApproveRolloutResponse() - client.approve_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_approve_rollout_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ApproveRolloutRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.approve_rollout), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ApproveRolloutResponse()) - await client.approve_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_approve_rollout_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.approve_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ApproveRolloutResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.approve_rollout( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_approve_rollout_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.approve_rollout( - cloud_deploy.ApproveRolloutRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_approve_rollout_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.approve_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ApproveRolloutResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ApproveRolloutResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.approve_rollout( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_approve_rollout_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.approve_rollout( - cloud_deploy.ApproveRolloutRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.ListRolloutsRequest, - dict, -]) -def test_list_rollouts(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListRolloutsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - ) - response = client.list_rollouts(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListRolloutsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRolloutsPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -def test_list_rollouts_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - client.list_rollouts() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListRolloutsRequest() - -@pytest.mark.asyncio -async def test_list_rollouts_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListRolloutsRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListRolloutsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_rollouts(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListRolloutsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRolloutsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_rollouts_async_from_dict(): - await test_list_rollouts_async(request_type=dict) - - -def test_list_rollouts_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListRolloutsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - call.return_value = cloud_deploy.ListRolloutsResponse() - client.list_rollouts(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_rollouts_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListRolloutsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListRolloutsResponse()) - await client.list_rollouts(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_rollouts_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListRolloutsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_rollouts( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_rollouts_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_rollouts( - cloud_deploy.ListRolloutsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_rollouts_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListRolloutsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListRolloutsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_rollouts( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_rollouts_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_rollouts( - cloud_deploy.ListRolloutsRequest(), - parent='parent_value', - ) - - -def test_list_rollouts_pager(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - next_page_token='abc', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[], - next_page_token='def', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_rollouts(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cloud_deploy.Rollout) - for i in results) -def test_list_rollouts_pages(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - next_page_token='abc', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[], - next_page_token='def', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - ), - RuntimeError, - ) - pages = list(client.list_rollouts(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_rollouts_async_pager(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - next_page_token='abc', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[], - next_page_token='def', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_rollouts(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, cloud_deploy.Rollout) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_rollouts_async_pages(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_rollouts), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - next_page_token='abc', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[], - next_page_token='def', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListRolloutsResponse( - rollouts=[ - cloud_deploy.Rollout(), - cloud_deploy.Rollout(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_rollouts(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.GetRolloutRequest, - dict, -]) -def test_get_rollout(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Rollout( - name='name_value', - uid='uid_value', - description='description_value', - target_id='target_id_value', - approval_state=cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL, - state=cloud_deploy.Rollout.State.SUCCEEDED, - failure_reason='failure_reason_value', - deploying_build='deploying_build_value', - etag='etag_value', - deploy_failure_cause=cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE, - ) - response = client.get_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetRolloutRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Rollout) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.target_id == 'target_id_value' - assert response.approval_state == cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL - assert response.state == cloud_deploy.Rollout.State.SUCCEEDED - assert response.failure_reason == 'failure_reason_value' - assert response.deploying_build == 'deploying_build_value' - assert response.etag == 'etag_value' - assert response.deploy_failure_cause == cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE - - -def test_get_rollout_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_rollout), - '__call__') as call: - client.get_rollout() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetRolloutRequest() - -@pytest.mark.asyncio -async def test_get_rollout_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetRolloutRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Rollout( - name='name_value', - uid='uid_value', - description='description_value', - target_id='target_id_value', - approval_state=cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL, - state=cloud_deploy.Rollout.State.SUCCEEDED, - failure_reason='failure_reason_value', - deploying_build='deploying_build_value', - etag='etag_value', - deploy_failure_cause=cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE, - )) - response = await client.get_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetRolloutRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Rollout) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.description == 'description_value' - assert response.target_id == 'target_id_value' - assert response.approval_state == cloud_deploy.Rollout.ApprovalState.NEEDS_APPROVAL - assert response.state == cloud_deploy.Rollout.State.SUCCEEDED - assert response.failure_reason == 'failure_reason_value' - assert response.deploying_build == 'deploying_build_value' - assert response.etag == 'etag_value' - assert response.deploy_failure_cause == cloud_deploy.Rollout.FailureCause.CLOUD_BUILD_UNAVAILABLE - - -@pytest.mark.asyncio -async def test_get_rollout_async_from_dict(): - await test_get_rollout_async(request_type=dict) - - -def test_get_rollout_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetRolloutRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_rollout), - '__call__') as call: - call.return_value = cloud_deploy.Rollout() - client.get_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_rollout_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetRolloutRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_rollout), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Rollout()) - await client.get_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_rollout_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Rollout() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_rollout( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_rollout_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_rollout( - cloud_deploy.GetRolloutRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_rollout_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Rollout() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Rollout()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_rollout( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_rollout_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_rollout( - cloud_deploy.GetRolloutRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.CreateRolloutRequest, - dict, -]) -def test_create_rollout(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateRolloutRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_rollout_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_rollout), - '__call__') as call: - client.create_rollout() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateRolloutRequest() - -@pytest.mark.asyncio -async def test_create_rollout_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.CreateRolloutRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateRolloutRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_rollout_async_from_dict(): - await test_create_rollout_async(request_type=dict) - - -def test_create_rollout_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateRolloutRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_rollout), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_rollout_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.CreateRolloutRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_rollout), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_rollout(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_rollout_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_rollout( - parent='parent_value', - rollout=cloud_deploy.Rollout(name='name_value'), - rollout_id='rollout_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].rollout - mock_val = cloud_deploy.Rollout(name='name_value') - assert arg == mock_val - arg = args[0].rollout_id - mock_val = 'rollout_id_value' - assert arg == mock_val - - -def test_create_rollout_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_rollout( - cloud_deploy.CreateRolloutRequest(), - parent='parent_value', - rollout=cloud_deploy.Rollout(name='name_value'), - rollout_id='rollout_id_value', - ) - -@pytest.mark.asyncio -async def test_create_rollout_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_rollout), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_rollout( - parent='parent_value', - rollout=cloud_deploy.Rollout(name='name_value'), - rollout_id='rollout_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].rollout - mock_val = cloud_deploy.Rollout(name='name_value') - assert arg == mock_val - arg = args[0].rollout_id - mock_val = 'rollout_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_rollout_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_rollout( - cloud_deploy.CreateRolloutRequest(), - parent='parent_value', - rollout=cloud_deploy.Rollout(name='name_value'), - rollout_id='rollout_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.RetryJobRequest, - dict, -]) -def test_retry_job(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.retry_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.RetryJobResponse( - ) - response = client.retry_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.RetryJobRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.RetryJobResponse) - - -def test_retry_job_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.retry_job), - '__call__') as call: - client.retry_job() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.RetryJobRequest() - -@pytest.mark.asyncio -async def test_retry_job_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.RetryJobRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.retry_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.RetryJobResponse( - )) - response = await client.retry_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.RetryJobRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.RetryJobResponse) - - -@pytest.mark.asyncio -async def test_retry_job_async_from_dict(): - await test_retry_job_async(request_type=dict) - - -def test_retry_job_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.RetryJobRequest() - - request.rollout = 'rollout_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.retry_job), - '__call__') as call: - call.return_value = cloud_deploy.RetryJobResponse() - client.retry_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'rollout=rollout_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_retry_job_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.RetryJobRequest() - - request.rollout = 'rollout_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.retry_job), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.RetryJobResponse()) - await client.retry_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'rollout=rollout_value', - ) in kw['metadata'] - - -def test_retry_job_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.retry_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.RetryJobResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.retry_job( - rollout='rollout_value', - phase_id='phase_id_value', - job_id='job_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].rollout - mock_val = 'rollout_value' - assert arg == mock_val - arg = args[0].phase_id - mock_val = 'phase_id_value' - assert arg == mock_val - arg = args[0].job_id - mock_val = 'job_id_value' - assert arg == mock_val - - -def test_retry_job_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.retry_job( - cloud_deploy.RetryJobRequest(), - rollout='rollout_value', - phase_id='phase_id_value', - job_id='job_id_value', - ) - -@pytest.mark.asyncio -async def test_retry_job_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.retry_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.RetryJobResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.RetryJobResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.retry_job( - rollout='rollout_value', - phase_id='phase_id_value', - job_id='job_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].rollout - mock_val = 'rollout_value' - assert arg == mock_val - arg = args[0].phase_id - mock_val = 'phase_id_value' - assert arg == mock_val - arg = args[0].job_id - mock_val = 'job_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_retry_job_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.retry_job( - cloud_deploy.RetryJobRequest(), - rollout='rollout_value', - phase_id='phase_id_value', - job_id='job_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.ListJobRunsRequest, - dict, -]) -def test_list_job_runs(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListJobRunsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - ) - response = client.list_job_runs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListJobRunsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListJobRunsPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -def test_list_job_runs_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - client.list_job_runs() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListJobRunsRequest() - -@pytest.mark.asyncio -async def test_list_job_runs_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.ListJobRunsRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListJobRunsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_job_runs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListJobRunsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListJobRunsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_job_runs_async_from_dict(): - await test_list_job_runs_async(request_type=dict) - - -def test_list_job_runs_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListJobRunsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - call.return_value = cloud_deploy.ListJobRunsResponse() - client.list_job_runs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_job_runs_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.ListJobRunsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListJobRunsResponse()) - await client.list_job_runs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_job_runs_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListJobRunsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_job_runs( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_job_runs_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_job_runs( - cloud_deploy.ListJobRunsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_job_runs_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.ListJobRunsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.ListJobRunsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_job_runs( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_job_runs_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_job_runs( - cloud_deploy.ListJobRunsRequest(), - parent='parent_value', - ) - - -def test_list_job_runs_pager(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - next_page_token='abc', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[], - next_page_token='def', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_job_runs(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, cloud_deploy.JobRun) - for i in results) -def test_list_job_runs_pages(transport_name: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - next_page_token='abc', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[], - next_page_token='def', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - ), - RuntimeError, - ) - pages = list(client.list_job_runs(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_job_runs_async_pager(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - next_page_token='abc', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[], - next_page_token='def', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_job_runs(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, cloud_deploy.JobRun) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_job_runs_async_pages(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_job_runs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - next_page_token='abc', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[], - next_page_token='def', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - ], - next_page_token='ghi', - ), - cloud_deploy.ListJobRunsResponse( - job_runs=[ - cloud_deploy.JobRun(), - cloud_deploy.JobRun(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_job_runs(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.GetJobRunRequest, - dict, -]) -def test_get_job_run(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_job_run), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.JobRun( - name='name_value', - uid='uid_value', - phase_id='phase_id_value', - job_id='job_id_value', - state=cloud_deploy.JobRun.State.IN_PROGRESS, - etag='etag_value', - deploy_job_run=cloud_deploy.DeployJobRun(build='build_value'), - ) - response = client.get_job_run(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetJobRunRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.JobRun) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.phase_id == 'phase_id_value' - assert response.job_id == 'job_id_value' - assert response.state == cloud_deploy.JobRun.State.IN_PROGRESS - assert response.etag == 'etag_value' - - -def test_get_job_run_empty_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_job_run), - '__call__') as call: - client.get_job_run() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetJobRunRequest() - -@pytest.mark.asyncio -async def test_get_job_run_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetJobRunRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_job_run), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.JobRun( - name='name_value', - uid='uid_value', - phase_id='phase_id_value', - job_id='job_id_value', - state=cloud_deploy.JobRun.State.IN_PROGRESS, - etag='etag_value', - )) - response = await client.get_job_run(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetJobRunRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.JobRun) - assert response.name == 'name_value' - assert response.uid == 'uid_value' - assert response.phase_id == 'phase_id_value' - assert response.job_id == 'job_id_value' - assert response.state == cloud_deploy.JobRun.State.IN_PROGRESS - assert response.etag == 'etag_value' - - -@pytest.mark.asyncio -async def test_get_job_run_async_from_dict(): - await test_get_job_run_async(request_type=dict) - - -def test_get_job_run_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetJobRunRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_job_run), - '__call__') as call: - call.return_value = cloud_deploy.JobRun() - client.get_job_run(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_job_run_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetJobRunRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_job_run), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.JobRun()) - await client.get_job_run(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_job_run_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_job_run), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.JobRun() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_job_run( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_job_run_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_job_run( - cloud_deploy.GetJobRunRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_job_run_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_job_run), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.JobRun() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.JobRun()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_job_run( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_job_run_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_job_run( - cloud_deploy.GetJobRunRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - cloud_deploy.GetConfigRequest, - dict, -]) -def test_get_config(request_type, transport: str = 'grpc'): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Config( - name='name_value', - default_skaffold_version='default_skaffold_version_value', - ) - response = client.get_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] == cloud_deploy.GetConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Config) - assert response.name == 'name_value' - assert response.default_skaffold_version == 'default_skaffold_version_value' - - -def test_get_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 = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_config), - '__call__') as call: - client.get_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetConfigRequest() - -@pytest.mark.asyncio -async def test_get_config_async(transport: str = 'grpc_asyncio', request_type=cloud_deploy.GetConfigRequest): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Config( - name='name_value', - default_skaffold_version='default_skaffold_version_value', - )) - response = await client.get_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, cloud_deploy.Config) - assert response.name == 'name_value' - assert response.default_skaffold_version == 'default_skaffold_version_value' - - -@pytest.mark.asyncio -async def test_get_config_async_from_dict(): - await test_get_config_async(request_type=dict) - - -def test_get_config_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_config), - '__call__') as call: - call.return_value = cloud_deploy.Config() - client.get_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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_config_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = cloud_deploy.GetConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Config()) - await client.get_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_config_flattened(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Config() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_config_flattened_error(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_config( - cloud_deploy.GetConfigRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_config_flattened_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = cloud_deploy.Config() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_deploy.Config()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_config_flattened_error_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_config( - cloud_deploy.GetConfigRequest(), - name='name_value', - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.CloudDeployGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.CloudDeployGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CloudDeployClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.CloudDeployGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CloudDeployClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CloudDeployClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.CloudDeployGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CloudDeployClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.CloudDeployGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = CloudDeployClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.CloudDeployGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.CloudDeployGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.CloudDeployGrpcTransport, - transports.CloudDeployGrpcAsyncIOTransport, -]) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - -@pytest.mark.parametrize("transport_name", [ - "grpc", -]) -def test_transport_kind(transport_name): - transport = CloudDeployClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.CloudDeployGrpcTransport, - ) - -def test_cloud_deploy_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.CloudDeployTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_cloud_deploy_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.CloudDeployTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'list_delivery_pipelines', - 'get_delivery_pipeline', - 'create_delivery_pipeline', - 'update_delivery_pipeline', - 'delete_delivery_pipeline', - 'list_targets', - 'get_target', - 'create_target', - 'update_target', - 'delete_target', - 'list_releases', - 'get_release', - 'create_release', - 'abandon_release', - 'approve_rollout', - 'list_rollouts', - 'get_rollout', - 'create_rollout', - 'retry_job', - 'list_job_runs', - 'get_job_run', - 'get_config', - 'set_iam_policy', - 'get_iam_policy', - 'test_iam_permissions', - 'get_location', - 'list_locations', - 'get_operation', - 'cancel_operation', - 'delete_operation', - 'list_operations', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - 'kind', - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_cloud_deploy_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.CloudDeployTransport( - 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", - ) - - -def test_cloud_deploy_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.deploy_v1.services.cloud_deploy.transports.CloudDeployTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.CloudDeployTransport() - adc.assert_called_once() - - -def test_cloud_deploy_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - CloudDeployClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.CloudDeployGrpcTransport, - transports.CloudDeployGrpcAsyncIOTransport, - ], -) -def test_cloud_deploy_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( 'https://www.googleapis.com/auth/cloud-platform',), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.CloudDeployGrpcTransport, - transports.CloudDeployGrpcAsyncIOTransport, - ], -) -def test_cloud_deploy_transport_auth_gdch_credentials(transport_class): - host = 'https://language.com' - api_audience_tests = [None, 'https://language2.com'] - api_audience_expect = [host, 'https://language2.com'] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with( - e - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.CloudDeployGrpcTransport, grpc_helpers), - (transports.CloudDeployGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -def test_cloud_deploy_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( - "clouddeploy.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="clouddeploy.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("transport_class", [transports.CloudDeployGrpcTransport, transports.CloudDeployGrpcAsyncIOTransport]) -def test_cloud_deploy_grpc_transport_client_cert_source_for_mtls( - transport_class -): - cred = ga_credentials.AnonymousCredentials() - - # Check ssl_channel_credentials is used if provided. - with mock.patch.object(transport_class, "create_channel") as mock_create_channel: - mock_ssl_channel_creds = mock.Mock() - transport_class( - host="squid.clam.whelk", - credentials=cred, - ssl_channel_credentials=mock_ssl_channel_creds - ) - mock_create_channel.assert_called_once_with( - "squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_channel_creds, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls - # is used. - with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): - with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: - transport_class( - credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback - ) - expected_cert, expected_key = client_cert_source_callback() - mock_ssl_cred.assert_called_once_with( - certificate_chain=expected_cert, - private_key=expected_key - ) - - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_cloud_deploy_host_no_port(transport_name): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='clouddeploy.googleapis.com'), - transport=transport_name, - ) - assert client.transport._host == ( - 'clouddeploy.googleapis.com:443' - ) - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_cloud_deploy_host_with_port(transport_name): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='clouddeploy.googleapis.com:8000'), - transport=transport_name, - ) - assert client.transport._host == ( - 'clouddeploy.googleapis.com:8000' - ) - -def test_cloud_deploy_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CloudDeployGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_cloud_deploy_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CloudDeployGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CloudDeployGrpcTransport, transports.CloudDeployGrpcAsyncIOTransport]) -def test_cloud_deploy_transport_channel_mtls_with_client_cert_source( - transport_class -): - with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - assert transport._ssl_channel_credentials == mock_ssl_cred - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CloudDeployGrpcTransport, transports.CloudDeployGrpcAsyncIOTransport]) -def test_cloud_deploy_transport_channel_mtls_with_adc( - transport_class -): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_cloud_deploy_grpc_lro_client(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_cloud_deploy_grpc_lro_async_client(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc_asyncio', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_build_path(): - project = "squid" - location = "clam" - build = "whelk" - expected = "projects/{project}/locations/{location}/builds/{build}".format(project=project, location=location, build=build, ) - actual = CloudDeployClient.build_path(project, location, build) - assert expected == actual - - -def test_parse_build_path(): - expected = { - "project": "octopus", - "location": "oyster", - "build": "nudibranch", - } - path = CloudDeployClient.build_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_build_path(path) - assert expected == actual - -def test_cluster_path(): - project = "cuttlefish" - location = "mussel" - cluster = "winkle" - expected = "projects/{project}/locations/{location}/clusters/{cluster}".format(project=project, location=location, cluster=cluster, ) - actual = CloudDeployClient.cluster_path(project, location, cluster) - assert expected == actual - - -def test_parse_cluster_path(): - expected = { - "project": "nautilus", - "location": "scallop", - "cluster": "abalone", - } - path = CloudDeployClient.cluster_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_cluster_path(path) - assert expected == actual - -def test_config_path(): - project = "squid" - location = "clam" - expected = "projects/{project}/locations/{location}/config".format(project=project, location=location, ) - actual = CloudDeployClient.config_path(project, location) - assert expected == actual - - -def test_parse_config_path(): - expected = { - "project": "whelk", - "location": "octopus", - } - path = CloudDeployClient.config_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_config_path(path) - assert expected == actual - -def test_delivery_pipeline_path(): - project = "oyster" - location = "nudibranch" - delivery_pipeline = "cuttlefish" - expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, ) - actual = CloudDeployClient.delivery_pipeline_path(project, location, delivery_pipeline) - assert expected == actual - - -def test_parse_delivery_pipeline_path(): - expected = { - "project": "mussel", - "location": "winkle", - "delivery_pipeline": "nautilus", - } - path = CloudDeployClient.delivery_pipeline_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_delivery_pipeline_path(path) - assert expected == actual - -def test_job_run_path(): - project = "scallop" - location = "abalone" - delivery_pipeline = "squid" - release = "clam" - rollout = "whelk" - job_run = "octopus" - expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{job_run}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, job_run=job_run, ) - actual = CloudDeployClient.job_run_path(project, location, delivery_pipeline, release, rollout, job_run) - assert expected == actual - - -def test_parse_job_run_path(): - expected = { - "project": "oyster", - "location": "nudibranch", - "delivery_pipeline": "cuttlefish", - "release": "mussel", - "rollout": "winkle", - "job_run": "nautilus", - } - path = CloudDeployClient.job_run_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_job_run_path(path) - assert expected == actual - -def test_membership_path(): - project = "scallop" - location = "abalone" - membership = "squid" - expected = "projects/{project}/locations/{location}/memberships/{membership}".format(project=project, location=location, membership=membership, ) - actual = CloudDeployClient.membership_path(project, location, membership) - assert expected == actual - - -def test_parse_membership_path(): - expected = { - "project": "clam", - "location": "whelk", - "membership": "octopus", - } - path = CloudDeployClient.membership_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_membership_path(path) - assert expected == actual - -def test_release_path(): - project = "oyster" - location = "nudibranch" - delivery_pipeline = "cuttlefish" - release = "mussel" - expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, ) - actual = CloudDeployClient.release_path(project, location, delivery_pipeline, release) - assert expected == actual - - -def test_parse_release_path(): - expected = { - "project": "winkle", - "location": "nautilus", - "delivery_pipeline": "scallop", - "release": "abalone", - } - path = CloudDeployClient.release_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_release_path(path) - assert expected == actual - -def test_rollout_path(): - project = "squid" - location = "clam" - delivery_pipeline = "whelk" - release = "octopus" - rollout = "oyster" - expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}".format(project=project, location=location, delivery_pipeline=delivery_pipeline, release=release, rollout=rollout, ) - actual = CloudDeployClient.rollout_path(project, location, delivery_pipeline, release, rollout) - assert expected == actual - - -def test_parse_rollout_path(): - expected = { - "project": "nudibranch", - "location": "cuttlefish", - "delivery_pipeline": "mussel", - "release": "winkle", - "rollout": "nautilus", - } - path = CloudDeployClient.rollout_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_rollout_path(path) - assert expected == actual - -def test_target_path(): - project = "scallop" - location = "abalone" - target = "squid" - expected = "projects/{project}/locations/{location}/targets/{target}".format(project=project, location=location, target=target, ) - actual = CloudDeployClient.target_path(project, location, target) - assert expected == actual - - -def test_parse_target_path(): - expected = { - "project": "clam", - "location": "whelk", - "target": "octopus", - } - path = CloudDeployClient.target_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_target_path(path) - assert expected == actual - -def test_worker_pool_path(): - project = "oyster" - location = "nudibranch" - worker_pool = "cuttlefish" - expected = "projects/{project}/locations/{location}/workerPools/{worker_pool}".format(project=project, location=location, worker_pool=worker_pool, ) - actual = CloudDeployClient.worker_pool_path(project, location, worker_pool) - assert expected == actual - - -def test_parse_worker_pool_path(): - expected = { - "project": "mussel", - "location": "winkle", - "worker_pool": "nautilus", - } - path = CloudDeployClient.worker_pool_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_worker_pool_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "scallop" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = CloudDeployClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "abalone", - } - path = CloudDeployClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "squid" - expected = "folders/{folder}".format(folder=folder, ) - actual = CloudDeployClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "clam", - } - path = CloudDeployClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "whelk" - expected = "organizations/{organization}".format(organization=organization, ) - actual = CloudDeployClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "octopus", - } - path = CloudDeployClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "oyster" - expected = "projects/{project}".format(project=project, ) - actual = CloudDeployClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "nudibranch", - } - path = CloudDeployClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_common_project_path(path) - assert expected == actual - -def test_common_location_path(): - project = "cuttlefish" - location = "mussel" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) - actual = CloudDeployClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "winkle", - "location": "nautilus", - } - path = CloudDeployClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object(transports.CloudDeployTransport, '_prep_wrapped_messages') as prep: - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.CloudDeployTransport, '_prep_wrapped_messages') as prep: - transport_class = CloudDeployClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_delete_operation(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.DeleteOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_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] == request - - # Establish that the response is the type that we expect. - assert response is None -@pytest.mark.asyncio -async def test_delete_operation_async(transport: str = "grpc"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.DeleteOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.delete_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] == request - - # Establish that the response is the type that we expect. - assert response is None - -def test_delete_operation_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.DeleteOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = None - - client.delete_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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_delete_operation_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.DeleteOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - await client.delete_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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_delete_operation_from_dict(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - - response = client.delete_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_delete_operation_from_dict_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.delete_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_cancel_operation(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.CancelOperationRequest() - - # 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 - 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] == request - - # Establish that the response is the type that we expect. - assert response is None -@pytest.mark.asyncio -async def test_cancel_operation_async(transport: str = "grpc"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.CancelOperationRequest() - - # 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 = 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) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - -def test_cancel_operation_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.CancelOperationRequest() - request.name = "locations" - - # 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_cancel_operation_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.CancelOperationRequest() - request.name = "locations" - - # 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_cancel_operation_from_dict(): - client = CloudDeployClient( - 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 - - response = client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_cancel_operation_from_dict_async(): - client = CloudDeployAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_get_operation(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.GetOperationRequest() - - # 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 = operations_pb2.Operation() - 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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.Operation) -@pytest.mark.asyncio -async def test_get_operation_async(transport: str = "grpc"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.GetOperationRequest() - - # 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 = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - response = await 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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.Operation) - -def test_get_operation_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.GetOperationRequest() - request.name = "locations" - - # 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 = operations_pb2.Operation() - - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_get_operation_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.GetOperationRequest() - request.name = "locations" - - # 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 = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - await 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_get_operation_from_dict(): - client = CloudDeployClient( - 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 = operations_pb2.Operation() - - response = client.get_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_get_operation_from_dict_async(): - client = CloudDeployAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - response = await client.get_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_list_operations(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.ListOperationsRequest() - - # 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 = operations_pb2.ListOperationsResponse() - 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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.ListOperationsResponse) -@pytest.mark.asyncio -async def test_list_operations_async(transport: str = "grpc"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.ListOperationsRequest() - - # 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 = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - response = await 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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.ListOperationsResponse) - -def test_list_operations_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.ListOperationsRequest() - request.name = "locations" - - # 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 = operations_pb2.ListOperationsResponse() - - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_list_operations_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.ListOperationsRequest() - request.name = "locations" - - # 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 = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - await 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_list_operations_from_dict(): - client = CloudDeployClient( - 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 = operations_pb2.ListOperationsResponse() - - response = client.list_operations( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_list_operations_from_dict_async(): - client = CloudDeployAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - response = await client.list_operations( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_list_locations(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.ListLocationsRequest() - - # 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 = locations_pb2.ListLocationsResponse() - 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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.ListLocationsResponse) -@pytest.mark.asyncio -async def test_list_locations_async(transport: str = "grpc"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.ListLocationsRequest() - - # 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 = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.ListLocationsResponse() - ) - response = await 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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.ListLocationsResponse) - -def test_list_locations_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = locations_pb2.ListLocationsRequest() - request.name = "locations" - - # 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 = locations_pb2.ListLocationsResponse() - - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_list_locations_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = locations_pb2.ListLocationsRequest() - request.name = "locations" - - # 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 = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.ListLocationsResponse() - ) - await 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_list_locations_from_dict(): - client = CloudDeployClient( - 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 = locations_pb2.ListLocationsResponse() - - response = client.list_locations( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_list_locations_from_dict_async(): - client = CloudDeployAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.ListLocationsResponse() - ) - response = await client.list_locations( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_get_location(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.GetLocationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = locations_pb2.Location() - response = client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.Location) -@pytest.mark.asyncio -async def test_get_location_async(transport: str = "grpc_asyncio"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.GetLocationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.Location() - ) - response = await client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.Location) - -def test_get_location_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials()) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = locations_pb2.GetLocationRequest() - request.name = "locations/abc" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - call.return_value = locations_pb2.Location() - - client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] -@pytest.mark.asyncio -async def test_get_location_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials() - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = locations_pb2.GetLocationRequest() - request.name = "locations/abc" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.Location() - ) - await client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] - -def test_get_location_from_dict(): - client = CloudDeployClient( - 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 = locations_pb2.Location() - - response = client.get_location( - request={ - "name": "locations/abc", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_get_location_from_dict_async(): - client = CloudDeployAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.Location() - ) - response = await client.get_location( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_set_iam_policy(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = iam_policy_pb2.SetIamPolicyRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) - response = client.set_iam_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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, policy_pb2.Policy) - - assert response.version == 774 - - assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = iam_policy_pb2.SetIamPolicyRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - # Designate an appropriate return value for the call. - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) - ) - response = await client.set_iam_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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, policy_pb2.Policy) - - assert response.version == 774 - - assert response.etag == b"etag_blob" - -def test_set_iam_policy_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - call.return_value = policy_pb2.Policy() - - client.set_iam_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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] -@pytest.mark.asyncio -async def test_set_iam_policy_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) - - await client.set_iam_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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] - -def test_set_iam_policy_from_dict(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy() - - response = client.set_iam_policy( - request={ - "resource": "resource_value", - "policy": policy_pb2.Policy(version=774), - } - ) - call.assert_called() - - -@pytest.mark.asyncio -async def test_set_iam_policy_from_dict_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy() - ) - - response = await client.set_iam_policy( - request={ - "resource": "resource_value", - "policy": policy_pb2.Policy(version=774), - } - ) - call.assert_called() - -def test_get_iam_policy(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = iam_policy_pb2.GetIamPolicyRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) - - response = client.get_iam_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] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, policy_pb2.Policy) - - assert response.version == 774 - - assert response.etag == b"etag_blob" - - -@pytest.mark.asyncio -async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = iam_policy_pb2.GetIamPolicyRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_iam_policy), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) - ) - - response = await client.get_iam_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, policy_pb2.Policy) - - assert response.version == 774 - - assert response.etag == b"etag_blob" - - -def test_get_iam_policy_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: - call.return_value = policy_pb2.Policy() - - client.get_iam_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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_get_iam_policy_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_iam_policy), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) - - await client.get_iam_policy(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] - - -def test_get_iam_policy_from_dict(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy() - - response = client.get_iam_policy( - request={ - "resource": "resource_value", - "options": options_pb2.GetPolicyOptions(requested_policy_version=2598), - } - ) - call.assert_called() - -@pytest.mark.asyncio -async def test_get_iam_policy_from_dict_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy() - ) - - response = await client.get_iam_policy( - request={ - "resource": "resource_value", - "options": options_pb2.GetPolicyOptions(requested_policy_version=2598), - } - ) - call.assert_called() - -def test_test_iam_permissions(transport: str = "grpc"): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = iam_policy_pb2.TestIamPermissionsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.test_iam_permissions), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = iam_policy_pb2.TestIamPermissionsResponse( - permissions=["permissions_value"], - ) - - response = client.test_iam_permissions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) - - assert response.permissions == ["permissions_value"] - - -@pytest.mark.asyncio -async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = iam_policy_pb2.TestIamPermissionsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.test_iam_permissions), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - iam_policy_pb2.TestIamPermissionsResponse(permissions=["permissions_value"],) - ) - - response = await client.test_iam_permissions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) - - assert response.permissions == ["permissions_value"] - - -def test_test_iam_permissions_field_headers(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.test_iam_permissions), "__call__" - ) as call: - call.return_value = iam_policy_pb2.TestIamPermissionsResponse() - - client.test_iam_permissions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_test_iam_permissions_field_headers_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.test_iam_permissions), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - iam_policy_pb2.TestIamPermissionsResponse() - ) - - await client.test_iam_permissions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] - - -def test_test_iam_permissions_from_dict(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.test_iam_permissions), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = iam_policy_pb2.TestIamPermissionsResponse() - - response = client.test_iam_permissions( - request={ - "resource": "resource_value", - "permissions": ["permissions_value"], - } - ) - call.assert_called() - -@pytest.mark.asyncio -async def test_test_iam_permissions_from_dict_async(): - client = CloudDeployAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.test_iam_permissions), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - iam_policy_pb2.TestIamPermissionsResponse() - ) - - response = await client.test_iam_permissions( - request={ - "resource": "resource_value", - "permissions": ["permissions_value"], - } - ) - call.assert_called() - -def test_transport_close(): - transports = { - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - -def test_client_ctx(): - transports = [ - 'grpc', - ] - for transport in transports: - client = CloudDeployClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - -@pytest.mark.parametrize("client_class,transport_class", [ - (CloudDeployClient, transports.CloudDeployGrpcTransport), - (CloudDeployAsyncClient, transports.CloudDeployGrpcAsyncIOTransport), -]) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/tests/unit/gapic/deploy_v1/test_cloud_deploy.py b/tests/unit/gapic/deploy_v1/test_cloud_deploy.py index b4a8c86..db5f09f 100644 --- a/tests/unit/gapic/deploy_v1/test_cloud_deploy.py +++ b/tests/unit/gapic/deploy_v1/test_cloud_deploy.py @@ -7683,33 +7683,10 @@ def test_parse_job_run_path(): assert expected == actual -def test_location_path(): +def test_membership_path(): project = "scallop" location = "abalone" - expected = "projects/{project}/locations/{location}".format( - project=project, - location=location, - ) - actual = CloudDeployClient.location_path(project, location) - assert expected == actual - - -def test_parse_location_path(): - expected = { - "project": "squid", - "location": "clam", - } - path = CloudDeployClient.location_path(**expected) - - # Check that the path construction is reversible. - actual = CloudDeployClient.parse_location_path(path) - assert expected == actual - - -def test_membership_path(): - project = "whelk" - location = "octopus" - membership = "oyster" + membership = "squid" expected = ( "projects/{project}/locations/{location}/memberships/{membership}".format( project=project, @@ -7723,9 +7700,9 @@ def test_membership_path(): def test_parse_membership_path(): expected = { - "project": "nudibranch", - "location": "cuttlefish", - "membership": "mussel", + "project": "clam", + "location": "whelk", + "membership": "octopus", } path = CloudDeployClient.membership_path(**expected) @@ -7735,10 +7712,10 @@ def test_parse_membership_path(): def test_release_path(): - project = "winkle" - location = "nautilus" - delivery_pipeline = "scallop" - release = "abalone" + project = "oyster" + location = "nudibranch" + delivery_pipeline = "cuttlefish" + release = "mussel" expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}".format( project=project, location=location, @@ -7753,10 +7730,10 @@ def test_release_path(): def test_parse_release_path(): expected = { - "project": "squid", - "location": "clam", - "delivery_pipeline": "whelk", - "release": "octopus", + "project": "winkle", + "location": "nautilus", + "delivery_pipeline": "scallop", + "release": "abalone", } path = CloudDeployClient.release_path(**expected) @@ -7766,11 +7743,11 @@ def test_parse_release_path(): def test_rollout_path(): - project = "oyster" - location = "nudibranch" - delivery_pipeline = "cuttlefish" - release = "mussel" - rollout = "winkle" + project = "squid" + location = "clam" + delivery_pipeline = "whelk" + release = "octopus" + rollout = "oyster" expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}".format( project=project, location=location, @@ -7786,11 +7763,11 @@ def test_rollout_path(): def test_parse_rollout_path(): expected = { - "project": "nautilus", - "location": "scallop", - "delivery_pipeline": "abalone", - "release": "squid", - "rollout": "clam", + "project": "nudibranch", + "location": "cuttlefish", + "delivery_pipeline": "mussel", + "release": "winkle", + "rollout": "nautilus", } path = CloudDeployClient.rollout_path(**expected) @@ -7800,9 +7777,9 @@ def test_parse_rollout_path(): def test_target_path(): - project = "whelk" - location = "octopus" - target = "oyster" + project = "scallop" + location = "abalone" + target = "squid" expected = "projects/{project}/locations/{location}/targets/{target}".format( project=project, location=location, @@ -7814,9 +7791,9 @@ def test_target_path(): def test_parse_target_path(): expected = { - "project": "nudibranch", - "location": "cuttlefish", - "target": "mussel", + "project": "clam", + "location": "whelk", + "target": "octopus", } path = CloudDeployClient.target_path(**expected) @@ -7826,9 +7803,9 @@ def test_parse_target_path(): def test_worker_pool_path(): - project = "winkle" - location = "nautilus" - worker_pool = "scallop" + project = "oyster" + location = "nudibranch" + worker_pool = "cuttlefish" expected = ( "projects/{project}/locations/{location}/workerPools/{worker_pool}".format( project=project, @@ -7842,9 +7819,9 @@ def test_worker_pool_path(): def test_parse_worker_pool_path(): expected = { - "project": "abalone", - "location": "squid", - "worker_pool": "clam", + "project": "mussel", + "location": "winkle", + "worker_pool": "nautilus", } path = CloudDeployClient.worker_pool_path(**expected) @@ -7854,7 +7831,7 @@ def test_parse_worker_pool_path(): def test_common_billing_account_path(): - billing_account = "whelk" + billing_account = "scallop" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -7864,7 +7841,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "octopus", + "billing_account": "abalone", } path = CloudDeployClient.common_billing_account_path(**expected) @@ -7874,7 +7851,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "oyster" + folder = "squid" expected = "folders/{folder}".format( folder=folder, ) @@ -7884,7 +7861,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "nudibranch", + "folder": "clam", } path = CloudDeployClient.common_folder_path(**expected) @@ -7894,7 +7871,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "cuttlefish" + organization = "whelk" expected = "organizations/{organization}".format( organization=organization, ) @@ -7904,7 +7881,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "mussel", + "organization": "octopus", } path = CloudDeployClient.common_organization_path(**expected) @@ -7914,7 +7891,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "winkle" + project = "oyster" expected = "projects/{project}".format( project=project, ) @@ -7924,7 +7901,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "nautilus", + "project": "nudibranch", } path = CloudDeployClient.common_project_path(**expected) @@ -7934,8 +7911,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "scallop" - location = "abalone" + project = "cuttlefish" + location = "mussel" expected = "projects/{project}/locations/{location}".format( project=project, location=location, @@ -7946,8 +7923,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "squid", - "location": "clam", + "project": "winkle", + "location": "nautilus", } path = CloudDeployClient.common_location_path(**expected)